about summary refs log tree commit diff
diff options
context:
space:
mode:
authorCamille GILLOT <gillot.camille@gmail.com>2022-10-24 16:37:14 +0000
committerCamille GILLOT <gillot.camille@gmail.com>2022-11-12 10:00:18 +0000
commitb676fc4d8ee5a94cc4270d54005899c599b4d818 (patch)
treed2c5affc0c04df434840f1287fa384725a46af57
parent5fc261e9a0902cc7aa41fd434b23fa0c18ed9d7f (diff)
downloadrust-b676fc4d8ee5a94cc4270d54005899c599b4d818.tar.gz
rust-b676fc4d8ee5a94cc4270d54005899c599b4d818.zip
Bless ui tests.
-rw-r--r--src/test/ui/async-await/issue-61949-self-return-type.rs1
-rw-r--r--src/test/ui/async-await/issue-61949-self-return-type.stderr17
-rw-r--r--src/test/ui/impl-trait/bound-normalization-fail.stderr8
-rw-r--r--src/test/ui/nll/ty-outlives/impl-trait-captures.stderr2
-rw-r--r--src/test/ui/type-alias-impl-trait/missing_lifetime_bound.rs2
-rw-r--r--src/test/ui/type-alias-impl-trait/missing_lifetime_bound.stderr7
6 files changed, 27 insertions, 10 deletions
diff --git a/src/test/ui/async-await/issue-61949-self-return-type.rs b/src/test/ui/async-await/issue-61949-self-return-type.rs
index 43429ba2329..d7bf34a4795 100644
--- a/src/test/ui/async-await/issue-61949-self-return-type.rs
+++ b/src/test/ui/async-await/issue-61949-self-return-type.rs
@@ -19,6 +19,7 @@ async fn foo() {
     let x = {
         let bar = 22;
         Foo::new(&bar).await
+        //~^ ERROR `bar` does not live long enough
     };
     drop(x);
 }
diff --git a/src/test/ui/async-await/issue-61949-self-return-type.stderr b/src/test/ui/async-await/issue-61949-self-return-type.stderr
index 52b726e186e..5a769115989 100644
--- a/src/test/ui/async-await/issue-61949-self-return-type.stderr
+++ b/src/test/ui/async-await/issue-61949-self-return-type.stderr
@@ -4,6 +4,19 @@ error[E0760]: `async fn` return type cannot contain a projection or `Self` that
 LL |     pub async fn new(_bar: &'a i32) -> Self {
    |                                        ^^^^ help: consider spelling out the type instead: `Foo<'a>`
 
-error: aborting due to previous error
+error[E0597]: `bar` does not live long enough
+  --> $DIR/issue-61949-self-return-type.rs:21:18
+   |
+LL |     let x = {
+   |         - borrow later stored here
+LL |         let bar = 22;
+LL |         Foo::new(&bar).await
+   |                  ^^^^ borrowed value does not live long enough
+LL |
+LL |     };
+   |     - `bar` dropped here while still borrowed
+
+error: aborting due to 2 previous errors
 
-For more information about this error, try `rustc --explain E0760`.
+Some errors have detailed explanations: E0597, E0760.
+For more information about an error, try `rustc --explain E0597`.
diff --git a/src/test/ui/impl-trait/bound-normalization-fail.stderr b/src/test/ui/impl-trait/bound-normalization-fail.stderr
index bd8d3d3d24e..2bccfd6cf11 100644
--- a/src/test/ui/impl-trait/bound-normalization-fail.stderr
+++ b/src/test/ui/impl-trait/bound-normalization-fail.stderr
@@ -25,11 +25,11 @@ error[E0760]: `impl Trait` return type cannot contain a projection or `Self` tha
 LL |     fn foo2_fail<'a, T: Trait<'a>>() -> impl FooLike<Output = T::Assoc> {
    |                                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
-error[E0271]: type mismatch resolving `<Foo<()> as FooLike>::Output == <T as lifetimes::Trait<'static>>::Assoc`
+error[E0271]: type mismatch resolving `<Foo<()> as FooLike>::Output == <T as lifetimes::Trait<'a>>::Assoc`
   --> $DIR/bound-normalization-fail.rs:41:41
    |
 LL |     fn foo2_fail<'a, T: Trait<'a>>() -> impl FooLike<Output = T::Assoc> {
-   |                                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type mismatch resolving `<Foo<()> as FooLike>::Output == <T as lifetimes::Trait<'static>>::Assoc`
+   |                                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type mismatch resolving `<Foo<()> as FooLike>::Output == <T as lifetimes::Trait<'a>>::Assoc`
 ...
 LL |         Foo(())
    |         ------- return type was inferred to be `Foo<()>` here
@@ -40,8 +40,8 @@ note: expected this to be `()`
 LL |     type Output = T;
    |                   ^
    = note:    expected unit type `()`
-           found associated type `<T as lifetimes::Trait<'static>>::Assoc`
-help: consider constraining the associated type `<T as lifetimes::Trait<'static>>::Assoc` to `()`
+           found associated type `<T as lifetimes::Trait<'a>>::Assoc`
+help: consider constraining the associated type `<T as lifetimes::Trait<'a>>::Assoc` to `()`
    |
 LL |     fn foo2_fail<'a, T: Trait<'a, Assoc = ()>>() -> impl FooLike<Output = T::Assoc> {
    |                                 ++++++++++++
diff --git a/src/test/ui/nll/ty-outlives/impl-trait-captures.stderr b/src/test/ui/nll/ty-outlives/impl-trait-captures.stderr
index 737cb35841c..7b9ed171d2d 100644
--- a/src/test/ui/nll/ty-outlives/impl-trait-captures.stderr
+++ b/src/test/ui/nll/ty-outlives/impl-trait-captures.stderr
@@ -1,4 +1,4 @@
-error[E0700]: hidden type for `Opaque(DefId(0:13 ~ impl_trait_captures[1afc]::foo::{opaque#0}), [ReStatic, T, ReEarlyBound(0, 'a)])` captures lifetime that does not appear in bounds
+error[E0700]: hidden type for `Opaque(DefId(0:13 ~ impl_trait_captures[1afc]::foo::{opaque#0}), [ReEarlyBound(0, 'a), T, ReEarlyBound(0, 'a)])` captures lifetime that does not appear in bounds
   --> $DIR/impl-trait-captures.rs:11:5
    |
 LL | fn foo<'a, T>(x: &T) -> impl Foo<'a> {
diff --git a/src/test/ui/type-alias-impl-trait/missing_lifetime_bound.rs b/src/test/ui/type-alias-impl-trait/missing_lifetime_bound.rs
index 428194058c3..01d1f5db132 100644
--- a/src/test/ui/type-alias-impl-trait/missing_lifetime_bound.rs
+++ b/src/test/ui/type-alias-impl-trait/missing_lifetime_bound.rs
@@ -2,6 +2,6 @@
 
 type Opaque<'a, T> = impl Sized;
 fn defining<'a, T>(x: &'a i32) -> Opaque<T> { x }
-//~^ ERROR: non-defining opaque type use in defining scope
+//~^ ERROR: hidden type for `Opaque<'a, T>` captures lifetime that does not appear in bounds
 
 fn main() {}
diff --git a/src/test/ui/type-alias-impl-trait/missing_lifetime_bound.stderr b/src/test/ui/type-alias-impl-trait/missing_lifetime_bound.stderr
index df2b3ed1911..65a0af0d22f 100644
--- a/src/test/ui/type-alias-impl-trait/missing_lifetime_bound.stderr
+++ b/src/test/ui/type-alias-impl-trait/missing_lifetime_bound.stderr
@@ -1,8 +1,11 @@
-error: non-defining opaque type use in defining scope
+error[E0700]: hidden type for `Opaque<'a, T>` captures lifetime that does not appear in bounds
   --> $DIR/missing_lifetime_bound.rs:4:47
    |
 LL | fn defining<'a, T>(x: &'a i32) -> Opaque<T> { x }
-   |                                               ^ lifetime `'a` is part of concrete type but not used in parameter list of the `impl Trait` type alias
+   |             --                                ^
+   |             |
+   |             hidden type `&'a i32` captures the lifetime `'a` as defined here
 
 error: aborting due to previous error
 
+For more information about this error, try `rustc --explain E0700`.