]> git.lizzy.rs Git - rust.git/blob - src/test/ui/fn/implied-bounds-unnorm-associated-type.rs
Rollup merge of #97389 - m-ou-se:memory-ordering-diagnostics, r=estebank
[rust.git] / src / test / ui / fn / implied-bounds-unnorm-associated-type.rs
1 // check-fail
2 // See issue #91068. Types in the substs of an associated type can't be implied
3 // to be WF, since they don't actually have to be constructed.
4
5 trait Trait {
6     type Type;
7 }
8
9 impl<T> Trait for T {
10     type Type = ();
11 }
12
13 fn f<'a, 'b>(s: &'b str, _: <&'a &'b () as Trait>::Type) -> &'a str {
14     s
15     //~^ ERROR lifetime may not live long enough
16 }
17
18 fn main() {
19     let x = String::from("Hello World!");
20     let y = f(&x, ());
21     drop(x);
22     println!("{}", y);
23 }