]> git.lizzy.rs Git - rust.git/blob - tests/ui/implied-bounds/impl-header-unnormalized-types.rs
Suggest coercion of `Result` using `?`
[rust.git] / tests / ui / implied-bounds / impl-header-unnormalized-types.rs
1 struct Foo<T>(T);
2
3 trait GoodBye {
4     type Forget;
5 }
6 impl<T> GoodBye for T {
7     type Forget = ();
8 }
9
10 trait NeedsWf<'a, 'b> {
11     type Assoc;
12 }
13
14 impl<'a, 'b> NeedsWf<'a, 'b> for Foo<<&'a &'b () as GoodBye>::Forget> {
15     type Assoc = &'a &'b ();
16     //~^ ERROR in type `&'a &'b ()`, reference has a longer lifetime than the data it references
17 }
18
19 fn needs_wf<'a, 'b, T: NeedsWf<'a, 'b>>() {}
20
21 fn foo<'a: 'a, 'b: 'b>(_: &'b String) {
22     needs_wf::<'a, 'b, Foo<()>>();
23 }
24
25 fn main() {
26     let x = String::from("hello");
27     foo::<'static, '_>(&x);
28 }