]> git.lizzy.rs Git - rust.git/blob - src/test/ui/self/arbitrary_self_types_trait.rs
Rollup merge of #101388 - compiler-errors:issue-101376, r=fee1-dead
[rust.git] / src / test / ui / self / arbitrary_self_types_trait.rs
1 // run-pass
2
3 use std::rc::Rc;
4
5 trait Trait {
6     fn trait_method<'a>(self: &'a Box<Rc<Self>>) -> &'a [i32];
7 }
8
9 impl Trait for Vec<i32> {
10     fn trait_method<'a>(self: &'a Box<Rc<Self>>) -> &'a [i32] {
11         &***self
12     }
13 }
14
15 fn main() {
16     let v = vec![1,2,3];
17
18     assert_eq!(&[1,2,3], Box::new(Rc::new(v)).trait_method());
19 }