]> git.lizzy.rs Git - rust.git/blob - src/test/ui/object-lifetime/object-lifetime-default-from-rptr-struct-error.rs
Merge commit '3e7c6dec244539970b593824334876f8b6ed0b18' into clippyup
[rust.git] / src / test / ui / object-lifetime / object-lifetime-default-from-rptr-struct-error.rs
1 // Test that the lifetime from the enclosing `&` is "inherited"
2 // through the `MyBox` struct.
3
4 #![allow(dead_code)]
5 #![feature(rustc_error)]
6
7 trait Test {
8     fn foo(&self) { }
9 }
10
11 struct SomeStruct<'a> {
12     t: &'a MyBox<dyn Test>,
13     u: &'a MyBox<dyn Test + 'a>,
14 }
15
16 struct MyBox<T:?Sized> {
17     b: Box<T>
18 }
19
20 fn c<'a>(t: &'a MyBox<dyn Test+'a>, mut ss: SomeStruct<'a>) {
21     ss.t = t; //~ ERROR mismatched types
22 }
23
24 fn main() {
25 }