diff options
| author | Michael Goulet <michael@errs.io> | 2023-07-27 22:50:40 +0000 |
|---|---|---|
| committer | Michael Goulet <michael@errs.io> | 2023-07-27 22:50:40 +0000 |
| commit | ea2f8b346b09c474d620ada38e4a0cb9f75e0b5f (patch) | |
| tree | 35b7eaf28bcf9880f12a36bf2c1dda2ba1b6b1b4 | |
| parent | bf38111ac1ad499d592b9f9ef9ae28e947c1c587 (diff) | |
| download | rust-ea2f8b346b09c474d620ada38e4a0cb9f75e0b5f.tar.gz rust-ea2f8b346b09c474d620ada38e4a0cb9f75e0b5f.zip | |
Add additional test
| -rw-r--r-- | tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit-2.rs | 11 | ||||
| -rw-r--r-- | tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit-2.stderr | 33 |
2 files changed, 44 insertions, 0 deletions
diff --git a/tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit-2.rs b/tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit-2.rs new file mode 100644 index 00000000000..3a93dfee57f --- /dev/null +++ b/tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit-2.rs @@ -0,0 +1,11 @@ +// issue: 114146 + +#![feature(return_position_impl_trait_in_trait)] + +trait Foo { + fn bar<'other: 'a>() -> impl Sized + 'a {} + //~^ ERROR use of undeclared lifetime name `'a` + //~| ERROR use of undeclared lifetime name `'a` +} + +fn main() {} diff --git a/tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit-2.stderr b/tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit-2.stderr new file mode 100644 index 00000000000..3a1f8f90837 --- /dev/null +++ b/tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit-2.stderr @@ -0,0 +1,33 @@ +error[E0261]: use of undeclared lifetime name `'a` + --> $DIR/bad-item-bound-within-rpitit-2.rs:6:20 + | +LL | fn bar<'other: 'a>() -> impl Sized + 'a {} + | ^^ undeclared lifetime + | +help: consider introducing lifetime `'a` here + | +LL | fn bar<'a, 'other: 'a>() -> impl Sized + 'a {} + | +++ +help: consider introducing lifetime `'a` here + | +LL | trait Foo<'a> { + | ++++ + +error[E0261]: use of undeclared lifetime name `'a` + --> $DIR/bad-item-bound-within-rpitit-2.rs:6:42 + | +LL | fn bar<'other: 'a>() -> impl Sized + 'a {} + | ^^ undeclared lifetime + | +help: consider introducing lifetime `'a` here + | +LL | fn bar<'a, 'other: 'a>() -> impl Sized + 'a {} + | +++ +help: consider introducing lifetime `'a` here + | +LL | trait Foo<'a> { + | ++++ + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0261`. |
