about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorOliver Schneider <github35764891676564198441@oli-obk.de>2018-07-17 13:44:42 +0200
committerOliver Schneider <github35764891676564198441@oli-obk.de>2018-07-18 10:53:10 +0200
commitfdd719aa3df9bdbbd64b26ca12955605e57ea566 (patch)
tree790fd18954f9fe6b739a9737b5d56b087e721e97 /src/test
parentfeb139f53f62b936ad94e9449212e130a71723b7 (diff)
Prepare for using wfcheck on existential types
Diffstat (limited to 'src/test')
-rw-r--r--src/test/ui/existential_types/generic_type_does_not_live_long_enough.nll.stderr21
-rw-r--r--src/test/ui/existential_types/generic_type_does_not_live_long_enough.rs7
-rw-r--r--src/test/ui/existential_types/generic_type_does_not_live_long_enough.stderr18
3 files changed, 30 insertions, 16 deletions
diff --git a/src/test/ui/existential_types/generic_type_does_not_live_long_enough.nll.stderr b/src/test/ui/existential_types/generic_type_does_not_live_long_enough.nll.stderr
index 8a6cae08ce0..84af8e1dca2 100644
--- a/src/test/ui/existential_types/generic_type_does_not_live_long_enough.nll.stderr
+++ b/src/test/ui/existential_types/generic_type_does_not_live_long_enough.nll.stderr
@@ -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`.
diff --git a/src/test/ui/existential_types/generic_type_does_not_live_long_enough.rs b/src/test/ui/existential_types/generic_type_does_not_live_long_enough.rs
index 092aa1eda16..440fc2d1284 100644
--- a/src/test/ui/existential_types/generic_type_does_not_live_long_enough.rs
+++ b/src/test/ui/existential_types/generic_type_does_not_live_long_enough.rs
@@ -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
diff --git a/src/test/ui/existential_types/generic_type_does_not_live_long_enough.stderr b/src/test/ui/existential_types/generic_type_does_not_live_long_enough.stderr
index cbf994defc8..189ad7d49a4 100644
--- a/src/test/ui/existential_types/generic_type_does_not_live_long_enough.stderr
+++ b/src/test/ui/existential_types/generic_type_does_not_live_long_enough.stderr
@@ -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`.