Prepare for using wfcheck on existential types

This commit is contained in:
Oliver Schneider 2018-07-17 13:44:42 +02:00
parent feb139f53f
commit fdd719aa3d
6 changed files with 54 additions and 36 deletions

View file

@ -1,17 +1,18 @@
error[E0308]: mismatched types
--> $DIR/generic_type_does_not_live_long_enough.rs:16:18
|
LL | let z: i32 = x; //~ ERROR mismatched types
| ^ expected i32, found anonymized type
|
= note: expected type `i32`
found type `WrongGeneric::<&{integer}>`
warning: not reporting region error due to nll
--> $DIR/generic_type_does_not_live_long_enough.rs:16:1
--> $DIR/generic_type_does_not_live_long_enough.rs:19:1
|
LL | existential type WrongGeneric<T>: 'static;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0310]: the parameter type `T` may not live long enough
--> $DIR/generic_type_does_not_live_long_enough.rs:20:5
|
LL | t
| ^
|
= help: consider adding an explicit lifetime bound `T: 'static`...
error: aborting due to previous error
For more information about this error, try `rustc --explain E0310`.
For more information about this error, try `rustc --explain E0308`.

View file

@ -8,10 +8,13 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(existential_type)]
fn main() {}
fn main() {
let y = 42;
let x = wrong_generic(&y);
let z: i32 = x; //~ ERROR mismatched types
}
existential type WrongGeneric<T>: 'static;
//~^ ERROR the parameter type `T` may not live long enough

View file

@ -1,5 +1,14 @@
error[E0308]: mismatched types
--> $DIR/generic_type_does_not_live_long_enough.rs:16:18
|
LL | let z: i32 = x; //~ ERROR mismatched types
| ^ expected i32, found anonymized type
|
= note: expected type `i32`
found type `WrongGeneric::<&{integer}>`
error[E0310]: the parameter type `T` may not live long enough
--> $DIR/generic_type_does_not_live_long_enough.rs:16:1
--> $DIR/generic_type_does_not_live_long_enough.rs:19:1
|
LL | existential type WrongGeneric<T>: 'static;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -8,11 +17,12 @@ LL | fn wrong_generic<T>(t: T) -> WrongGeneric<T> {
| - help: consider adding an explicit lifetime bound `T: 'static`...
|
note: ...so that the type `T` will meet its required lifetime bounds
--> $DIR/generic_type_does_not_live_long_enough.rs:16:1
--> $DIR/generic_type_does_not_live_long_enough.rs:19:1
|
LL | existential type WrongGeneric<T>: 'static;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to previous error
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0310`.
Some errors occurred: E0308, E0310.
For more information about an error, try `rustc --explain E0308`.