]> git.lizzy.rs Git - rust.git/blob - src/test/ui/suggestions/impl-on-dyn-trait-with-implicit-static-bound-without-suggestion.rs
Detect when `'static` obligation might come from an `impl`
[rust.git] / src / test / ui / suggestions / impl-on-dyn-trait-with-implicit-static-bound-without-suggestion.rs
1 trait OtherTrait<'a> {}
2 impl<'a> OtherTrait<'a> for &'a () {}
3
4 trait ObjectTrait {}
5
6 impl dyn ObjectTrait {
7     fn use_self(&self) -> &() { panic!() }
8 }
9
10 fn use_it<'a>(val: &'a dyn ObjectTrait) -> impl OtherTrait<'a> + 'a {
11     val.use_self() //~ ERROR mismatched types
12 }
13
14 fn main() {}