diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/ui/impl-trait/in-trait/missing-lt-outlives-in-rpitit-114274.rs | 13 | ||||
| -rw-r--r-- | tests/ui/impl-trait/in-trait/missing-lt-outlives-in-rpitit-114274.stderr | 38 |
2 files changed, 51 insertions, 0 deletions
diff --git a/tests/ui/impl-trait/in-trait/missing-lt-outlives-in-rpitit-114274.rs b/tests/ui/impl-trait/in-trait/missing-lt-outlives-in-rpitit-114274.rs new file mode 100644 index 00000000000..2fbc977b165 --- /dev/null +++ b/tests/ui/impl-trait/in-trait/missing-lt-outlives-in-rpitit-114274.rs @@ -0,0 +1,13 @@ +#![feature(return_position_impl_trait_in_trait)] + +trait Iterable { + type Item<'a> + where + Self: 'a; + + fn iter(&self) -> impl Iterator<Item = Self::Item<'missing>>; + //~^ ERROR use of undeclared lifetime name `'missing` + //~| ERROR the parameter type `Self` may not live long enough +} + +fn main() {} diff --git a/tests/ui/impl-trait/in-trait/missing-lt-outlives-in-rpitit-114274.stderr b/tests/ui/impl-trait/in-trait/missing-lt-outlives-in-rpitit-114274.stderr new file mode 100644 index 00000000000..dad308936dc --- /dev/null +++ b/tests/ui/impl-trait/in-trait/missing-lt-outlives-in-rpitit-114274.stderr @@ -0,0 +1,38 @@ +error[E0261]: use of undeclared lifetime name `'missing` + --> $DIR/missing-lt-outlives-in-rpitit-114274.rs:8:55 + | +LL | fn iter(&self) -> impl Iterator<Item = Self::Item<'missing>>; + | ^^^^^^^^ undeclared lifetime + | + = note: for more information on higher-ranked polymorphism, visit https://doc.rust-lang.org/nomicon/hrtb.html +help: consider making the bound lifetime-generic with a new `'missing` lifetime + | +LL | fn iter(&self) -> impl for<'missing> Iterator<Item = Self::Item<'missing>>; + | +++++++++++++ +help: consider introducing lifetime `'missing` here + | +LL | fn iter<'missing>(&self) -> impl Iterator<Item = Self::Item<'missing>>; + | ++++++++++ +help: consider introducing lifetime `'missing` here + | +LL | trait Iterable<'missing> { + | ++++++++++ + +error[E0311]: the parameter type `Self` may not live long enough + --> $DIR/missing-lt-outlives-in-rpitit-114274.rs:8:37 + | +LL | fn iter(&self) -> impl Iterator<Item = Self::Item<'missing>>; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: consider adding an explicit lifetime bound `Self: 'a`... + = note: ...so that the type `Self` will meet its required lifetime bounds... +note: ...that is required by this bound + --> $DIR/missing-lt-outlives-in-rpitit-114274.rs:6:15 + | +LL | Self: 'a; + | ^^ + +error: aborting due to 2 previous errors + +Some errors have detailed explanations: E0261, E0311. +For more information about an error, try `rustc --explain E0261`. |
