]> git.proxmox.com Git - rustc.git/blob - src/test/ui/self/arbitrary_self_types_unsized_struct.rs
New upstream version 1.41.1+dfsg1
[rustc.git] / src / test / ui / self / arbitrary_self_types_unsized_struct.rs
1 // run-pass
2
3 use std::rc::Rc;
4
5 struct Foo<T: ?Sized>(T);
6
7 impl Foo<[u8]> {
8 fn len(self: Rc<Self>) -> usize {
9 self.0.len()
10 }
11 }
12
13 fn main() {
14 let rc = Rc::new(Foo([1u8,2,3])) as Rc<Foo<[u8]>>;
15 assert_eq!(3, rc.len());
16 }