rust/tests/ui/impl-trait/precise-capturing/overcaptures-2024.stderr

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

84 lines
3.8 KiB
Plaintext
Raw Normal View History

2024-04-21 15:27:27 +00:00
error: `impl Sized` will capture more lifetimes than possibly intended in edition 2024
--> $DIR/overcaptures-2024.rs:6:29
2024-04-21 15:27:27 +00:00
|
LL | fn named<'a>(x: &'a i32) -> impl Sized { *x }
| ^^^^^^^^^^
|
= warning: this changes meaning in Rust 2024
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/rpit-lifetime-capture.html>
2024-04-21 15:27:27 +00:00
note: specifically, this lifetime is in scope but not mentioned in the type's bounds
--> $DIR/overcaptures-2024.rs:6:10
2024-04-21 15:27:27 +00:00
|
LL | fn named<'a>(x: &'a i32) -> impl Sized { *x }
| ^^
= note: all lifetimes in scope will be captured by `impl Trait`s in edition 2024
note: the lint level is defined here
--> $DIR/overcaptures-2024.rs:4:9
2024-04-21 15:27:27 +00:00
|
LL | #![deny(impl_trait_overcaptures)]
| ^^^^^^^^^^^^^^^^^^^^^^^
help: use the precise capturing `use<...>` syntax to make the captures explicit
|
2024-06-05 20:18:52 +00:00
LL | fn named<'a>(x: &'a i32) -> impl Sized + use<> { *x }
| +++++++
2024-04-21 15:27:27 +00:00
error: `impl Sized` will capture more lifetimes than possibly intended in edition 2024
--> $DIR/overcaptures-2024.rs:10:25
2024-04-21 15:27:27 +00:00
|
LL | fn implicit(x: &i32) -> impl Sized { *x }
| ^^^^^^^^^^
|
= warning: this changes meaning in Rust 2024
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/rpit-lifetime-capture.html>
2024-04-21 15:27:27 +00:00
note: specifically, this lifetime is in scope but not mentioned in the type's bounds
--> $DIR/overcaptures-2024.rs:10:16
2024-04-21 15:27:27 +00:00
|
LL | fn implicit(x: &i32) -> impl Sized { *x }
| ^
= note: all lifetimes in scope will be captured by `impl Trait`s in edition 2024
help: use the precise capturing `use<...>` syntax to make the captures explicit
|
2024-06-05 20:18:52 +00:00
LL | fn implicit(x: &i32) -> impl Sized + use<> { *x }
| +++++++
2024-04-21 15:27:27 +00:00
error: `impl Sized + '_` will capture more lifetimes than possibly intended in edition 2024
--> $DIR/overcaptures-2024.rs:16:33
2024-04-21 15:27:27 +00:00
|
LL | fn hello(&self, x: &i32) -> impl Sized + '_ { self }
| ^^^^^^^^^^^^^^^
|
= warning: this changes meaning in Rust 2024
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/rpit-lifetime-capture.html>
2024-04-21 15:27:27 +00:00
note: specifically, this lifetime is in scope but not mentioned in the type's bounds
--> $DIR/overcaptures-2024.rs:16:24
2024-04-21 15:27:27 +00:00
|
LL | fn hello(&self, x: &i32) -> impl Sized + '_ { self }
| ^
= note: all lifetimes in scope will be captured by `impl Trait`s in edition 2024
help: use the precise capturing `use<...>` syntax to make the captures explicit
|
2024-06-05 20:18:52 +00:00
LL | fn hello(&self, x: &i32) -> impl Sized + '_ + use<'_> { self }
| +++++++++
2024-04-21 15:27:27 +00:00
error: `impl Sized` will capture more lifetimes than possibly intended in edition 2024
--> $DIR/overcaptures-2024.rs:28:47
2024-04-21 15:27:27 +00:00
|
LL | fn hrtb() -> impl for<'a> Higher<'a, Output = impl Sized> {}
| ^^^^^^^^^^
|
= warning: this changes meaning in Rust 2024
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/rpit-lifetime-capture.html>
2024-04-21 15:27:27 +00:00
note: specifically, this lifetime is in scope but not mentioned in the type's bounds
--> $DIR/overcaptures-2024.rs:28:23
2024-04-21 15:27:27 +00:00
|
LL | fn hrtb() -> impl for<'a> Higher<'a, Output = impl Sized> {}
| ^^
= note: all lifetimes in scope will be captured by `impl Trait`s in edition 2024
help: use the precise capturing `use<...>` syntax to make the captures explicit
|
2024-06-05 20:18:52 +00:00
LL | fn hrtb() -> impl for<'a> Higher<'a, Output = impl Sized + use<>> {}
| +++++++
2024-04-21 15:27:27 +00:00
error: aborting due to 4 previous errors