diff options
Diffstat (limited to 'tests/ui/impl-trait/precise-capturing')
4 files changed, 18 insertions, 12 deletions
diff --git a/tests/ui/impl-trait/precise-capturing/bad-lifetimes.stderr b/tests/ui/impl-trait/precise-capturing/bad-lifetimes.stderr index a8acecf10c7..c8dac3a69cd 100644 --- a/tests/ui/impl-trait/precise-capturing/bad-lifetimes.stderr +++ b/tests/ui/impl-trait/precise-capturing/bad-lifetimes.stderr @@ -7,8 +7,9 @@ LL | fn no_elided_lt() -> impl Sized + use<'_> {} = help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from help: consider using the `'static` lifetime, but this is uncommon unless you're returning a borrowed value from a `const` or a `static`, or if you will only have owned values | -LL | fn no_elided_lt() -> impl Sized + use<'static> {} - | ~~~~~~~ +LL - fn no_elided_lt() -> impl Sized + use<'_> {} +LL + fn no_elided_lt() -> impl Sized + use<'static> {} + | error[E0261]: use of undeclared lifetime name `'missing` --> $DIR/bad-lifetimes.rs:8:37 diff --git a/tests/ui/impl-trait/precise-capturing/hidden-type-suggestion.stderr b/tests/ui/impl-trait/precise-capturing/hidden-type-suggestion.stderr index b0c4cc2fea0..0d8fa650df4 100644 --- a/tests/ui/impl-trait/precise-capturing/hidden-type-suggestion.stderr +++ b/tests/ui/impl-trait/precise-capturing/hidden-type-suggestion.stderr @@ -80,8 +80,9 @@ LL | fn no_params_yet(_: impl Sized, y: &()) -> impl Sized { | ^^^^^^^^^^ help: add a `use<...>` bound to explicitly capture `'_` after turning all argument-position `impl Trait` into type parameters, noting that this possibly affects the API of this crate | -LL | fn no_params_yet<T: Sized>(_: T, y: &()) -> impl Sized + use<'_, T> { - | ++++++++++ ~ ++++++++++++ +LL - fn no_params_yet(_: impl Sized, y: &()) -> impl Sized { +LL + fn no_params_yet<T: Sized>(_: T, y: &()) -> impl Sized + use<'_, T> { + | error[E0700]: hidden type for `impl Sized` captures lifetime that does not appear in bounds --> $DIR/hidden-type-suggestion.rs:36:5 @@ -101,8 +102,9 @@ LL | fn yes_params_yet<'a, T>(_: impl Sized, y: &'a ()) -> impl Sized { | ^^^^^^^^^^ help: add a `use<...>` bound to explicitly capture `'a` after turning all argument-position `impl Trait` into type parameters, noting that this possibly affects the API of this crate | -LL | fn yes_params_yet<'a, T, U: Sized>(_: U, y: &'a ()) -> impl Sized + use<'a, T, U> { - | ++++++++++ ~ +++++++++++++++ +LL - fn yes_params_yet<'a, T>(_: impl Sized, y: &'a ()) -> impl Sized { +LL + fn yes_params_yet<'a, T, U: Sized>(_: U, y: &'a ()) -> impl Sized + use<'a, T, U> { + | error: aborting due to 6 previous errors diff --git a/tests/ui/impl-trait/precise-capturing/migration-note.stderr b/tests/ui/impl-trait/precise-capturing/migration-note.stderr index 9caf7a201ef..676b6c12f52 100644 --- a/tests/ui/impl-trait/precise-capturing/migration-note.stderr +++ b/tests/ui/impl-trait/precise-capturing/migration-note.stderr @@ -305,8 +305,9 @@ LL | fn capture_apit(x: &impl Sized) -> impl Sized {} | ^^^^^^^^^^ help: use the precise capturing `use<...>` syntax to make the captures explicit | -LL | fn capture_apit<T: Sized>(x: &T) -> impl Sized + use<T> {} - | ++++++++++ ~ ++++++++ +LL - fn capture_apit(x: &impl Sized) -> impl Sized {} +LL + fn capture_apit<T: Sized>(x: &T) -> impl Sized + use<T> {} + | help: consider cloning the value if the performance cost is acceptable | LL | let y = capture_apit(&x.clone()); diff --git a/tests/ui/impl-trait/precise-capturing/overcaptures-2024.stderr b/tests/ui/impl-trait/precise-capturing/overcaptures-2024.stderr index 965f8e7b672..3f8511a21a0 100644 --- a/tests/ui/impl-trait/precise-capturing/overcaptures-2024.stderr +++ b/tests/ui/impl-trait/precise-capturing/overcaptures-2024.stderr @@ -100,8 +100,9 @@ LL | fn apit(_: &impl Sized) -> impl Sized {} | ^^^^^^^^^^ help: use the precise capturing `use<...>` syntax to make the captures explicit | -LL | fn apit<T: Sized>(_: &T) -> impl Sized + use<T> {} - | ++++++++++ ~ ++++++++ +LL - fn apit(_: &impl Sized) -> impl Sized {} +LL + fn apit<T: Sized>(_: &T) -> impl Sized + use<T> {} + | error: `impl Sized` will capture more lifetimes than possibly intended in edition 2024 --> $DIR/overcaptures-2024.rs:37:38 @@ -124,8 +125,9 @@ LL | fn apit2<U>(_: &impl Sized, _: U) -> impl Sized {} | ^^^^^^^^^^ help: use the precise capturing `use<...>` syntax to make the captures explicit | -LL | fn apit2<U, T: Sized>(_: &T, _: U) -> impl Sized + use<U, T> {} - | ++++++++++ ~ +++++++++++ +LL - fn apit2<U>(_: &impl Sized, _: U) -> impl Sized {} +LL + fn apit2<U, T: Sized>(_: &T, _: U) -> impl Sized + use<U, T> {} + | error: `impl Sized` will capture more lifetimes than possibly intended in edition 2024 --> $DIR/overcaptures-2024.rs:41:37 |
