about summary refs log tree commit diff
path: root/tests/ui/implied-bounds
diff options
context:
space:
mode:
authorOli Scherer <git-spam-no-reply9815368754983@oli-obk.de>2024-02-09 12:17:55 +0000
committerOli Scherer <git-spam-no-reply9815368754983@oli-obk.de>2024-02-14 11:00:30 +0000
commit5f6390f947373528355d30a276ede65d92baaa57 (patch)
treecfccfb4047807d2dcf9aa0192ebae291d30f040e /tests/ui/implied-bounds
parentbb89df6903539e7014b8db29bccd6a9ee9553122 (diff)
downloadrust-5f6390f947373528355d30a276ede65d92baaa57.tar.gz
rust-5f6390f947373528355d30a276ede65d92baaa57.zip
Continue compilation after check_mod_type_wf errors
Diffstat (limited to 'tests/ui/implied-bounds')
-rw-r--r--tests/ui/implied-bounds/hrlt-implied-trait-bounds-guard.rs3
-rw-r--r--tests/ui/implied-bounds/hrlt-implied-trait-bounds-guard.stderr45
2 files changed, 45 insertions, 3 deletions
diff --git a/tests/ui/implied-bounds/hrlt-implied-trait-bounds-guard.rs b/tests/ui/implied-bounds/hrlt-implied-trait-bounds-guard.rs
index 27c8f30ec32..eba4ecd3a28 100644
--- a/tests/ui/implied-bounds/hrlt-implied-trait-bounds-guard.rs
+++ b/tests/ui/implied-bounds/hrlt-implied-trait-bounds-guard.rs
@@ -29,16 +29,19 @@ impl<'long: 'short, 'short, T> Convert<'long, 'short> for T {
 fn badboi<'in_, 'out, T>(x: Foo<'in_, 'out, T>, sadness: &'in_ T) -> &'out T {
     //~^ ERROR lifetime mismatch
     sadness.cast()
+    //~^ ERROR may not live long enough
 }
 
 fn badboi2<'in_, 'out, T>(x: Foo<'in_, 'out, T>, sadness: &'in_ T) {
     //~^ ERROR lifetime mismatch
     let _: &'out T = sadness.cast();
+    //~^ ERROR may not live long enough
 }
 
 fn badboi3<'in_, 'out, T>(a: Foo<'in_, 'out, (&'in_ T, &'out T)>, sadness: &'in_ T) {
     //~^ ERROR lifetime mismatch
     let _: &'out T = sadness.cast();
+    //~^ ERROR may not live long enough
 }
 
 fn bad<'short, T>(value: &'short T) -> &'static T {
diff --git a/tests/ui/implied-bounds/hrlt-implied-trait-bounds-guard.stderr b/tests/ui/implied-bounds/hrlt-implied-trait-bounds-guard.stderr
index 0c00bbc380e..c9dc820fd60 100644
--- a/tests/ui/implied-bounds/hrlt-implied-trait-bounds-guard.stderr
+++ b/tests/ui/implied-bounds/hrlt-implied-trait-bounds-guard.stderr
@@ -8,7 +8,7 @@ LL | fn badboi<'in_, 'out, T>(x: Foo<'in_, 'out, T>, sadness: &'in_ T) -> &'out
    |                             ...but data from `x` is returned here
 
 error[E0623]: lifetime mismatch
-  --> $DIR/hrlt-implied-trait-bounds-guard.rs:34:30
+  --> $DIR/hrlt-implied-trait-bounds-guard.rs:35:30
    |
 LL | fn badboi2<'in_, 'out, T>(x: Foo<'in_, 'out, T>, sadness: &'in_ T) {
    |                              ^^^^^^^^^^^^^^^^^^
@@ -17,7 +17,7 @@ LL | fn badboi2<'in_, 'out, T>(x: Foo<'in_, 'out, T>, sadness: &'in_ T) {
    |                              ...but data with one lifetime flows into the other here
 
 error[E0623]: lifetime mismatch
-  --> $DIR/hrlt-implied-trait-bounds-guard.rs:39:30
+  --> $DIR/hrlt-implied-trait-bounds-guard.rs:41:30
    |
 LL | fn badboi3<'in_, 'out, T>(a: Foo<'in_, 'out, (&'in_ T, &'out T)>, sadness: &'in_ T) {
    |                              ^^^^^^^^^^^^^^^^^-------^^-------^^
@@ -25,6 +25,45 @@ LL | fn badboi3<'in_, 'out, T>(a: Foo<'in_, 'out, (&'in_ T, &'out T)>, sadness:
    |                              |                these two types are declared with different lifetimes...
    |                              ...but data from `a` flows into `a` here
 
-error: aborting due to 3 previous errors
+error: lifetime may not live long enough
+  --> $DIR/hrlt-implied-trait-bounds-guard.rs:31:5
+   |
+LL | fn badboi<'in_, 'out, T>(x: Foo<'in_, 'out, T>, sadness: &'in_ T) -> &'out T {
+   |           ----  ---- lifetime `'out` defined here
+   |           |
+   |           lifetime `'in_` defined here
+LL |
+LL |     sadness.cast()
+   |     ^^^^^^^^^^^^^^ function was supposed to return data with lifetime `'out` but it is returning data with lifetime `'in_`
+   |
+   = help: consider adding the following bound: `'in_: 'out`
+
+error: lifetime may not live long enough
+  --> $DIR/hrlt-implied-trait-bounds-guard.rs:37:12
+   |
+LL | fn badboi2<'in_, 'out, T>(x: Foo<'in_, 'out, T>, sadness: &'in_ T) {
+   |            ----  ---- lifetime `'out` defined here
+   |            |
+   |            lifetime `'in_` defined here
+LL |
+LL |     let _: &'out T = sadness.cast();
+   |            ^^^^^^^ type annotation requires that `'in_` must outlive `'out`
+   |
+   = help: consider adding the following bound: `'in_: 'out`
+
+error: lifetime may not live long enough
+  --> $DIR/hrlt-implied-trait-bounds-guard.rs:43:12
+   |
+LL | fn badboi3<'in_, 'out, T>(a: Foo<'in_, 'out, (&'in_ T, &'out T)>, sadness: &'in_ T) {
+   |            ----  ---- lifetime `'out` defined here
+   |            |
+   |            lifetime `'in_` defined here
+LL |
+LL |     let _: &'out T = sadness.cast();
+   |            ^^^^^^^ type annotation requires that `'in_` must outlive `'out`
+   |
+   = help: consider adding the following bound: `'in_: 'out`
+
+error: aborting due to 6 previous errors
 
 For more information about this error, try `rustc --explain E0623`.