Bless ui tests.

This commit is contained in:
Camille GILLOT 2022-10-24 16:37:14 +00:00
parent 5fc261e9a0
commit b676fc4d8e
6 changed files with 27 additions and 10 deletions

View file

@ -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);
}

View file

@ -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
For more information about this error, try `rustc --explain E0760`.
error: aborting due to 2 previous errors
Some errors have detailed explanations: E0597, E0760.
For more information about an error, try `rustc --explain E0597`.

View file

@ -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> {
| ++++++++++++

View file

@ -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> {

View file

@ -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() {}

View file

@ -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`.