]> git.lizzy.rs Git - rust.git/blob - src/test/ui/existential_types/generic_type_does_not_live_long_enough.stderr
Auto merge of #54624 - arielb1:evaluate-outlives, r=nikomatsakis
[rust.git] / src / test / ui / existential_types / generic_type_does_not_live_long_enough.stderr
1 error[E0308]: mismatched types
2   --> $DIR/generic_type_does_not_live_long_enough.rs:16:18
3    |
4 LL |     let z: i32 = x; //~ ERROR mismatched types
5    |                  ^ expected i32, found opaque type
6    |
7    = note: expected type `i32`
8               found type `WrongGeneric::<&{integer}>`
9
10 error[E0310]: the parameter type `T` may not live long enough
11   --> $DIR/generic_type_does_not_live_long_enough.rs:19:1
12    |
13 LL | existential type WrongGeneric<T>: 'static;
14    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
15 ...
16 LL | fn wrong_generic<T>(t: T) -> WrongGeneric<T> {
17    |                  - help: consider adding an explicit lifetime bound `T: 'static`...
18    |
19 note: ...so that the type `T` will meet its required lifetime bounds
20   --> $DIR/generic_type_does_not_live_long_enough.rs:19:1
21    |
22 LL | existential type WrongGeneric<T>: 'static;
23    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
24
25 error: aborting due to 2 previous errors
26
27 Some errors occurred: E0308, E0310.
28 For more information about an error, try `rustc --explain E0308`.