diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2023-09-22 12:15:27 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-09-22 12:15:27 +0200 |
| commit | fc4cfe01f6b0f0117e285b1349be17ff393bbcd4 (patch) | |
| tree | fef7693eee4d7d58ea121178bf12117f92d59a20 /tests | |
| parent | faf13dd112bf0f455e5311cb1acc9db514defe78 (diff) | |
| parent | f2ede49c2f9da8c64782abbec3b4a1710d52a4c5 (diff) | |
| download | rust-fc4cfe01f6b0f0117e285b1349be17ff393bbcd4.tar.gz rust-fc4cfe01f6b0f0117e285b1349be17ff393bbcd4.zip | |
Rollup merge of #116039 - estebank:nested-tait, r=compiler-errors
Account for nested `impl Trait` in TAIT Fix #116031. r? `@compiler-errors`
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/ui/type-alias-impl-trait/nested-impl-trait-in-tait.rs | 9 | ||||
| -rw-r--r-- | tests/ui/type-alias-impl-trait/nested-impl-trait-in-tait.stderr | 47 |
2 files changed, 56 insertions, 0 deletions
diff --git a/tests/ui/type-alias-impl-trait/nested-impl-trait-in-tait.rs b/tests/ui/type-alias-impl-trait/nested-impl-trait-in-tait.rs new file mode 100644 index 00000000000..fec0fdc46fb --- /dev/null +++ b/tests/ui/type-alias-impl-trait/nested-impl-trait-in-tait.rs @@ -0,0 +1,9 @@ +#![feature(type_alias_impl_trait)] + +pub type Tait = impl Iterator<Item = (&'db Key, impl Iterator)>; +//~^ ERROR use of undeclared lifetime name `'db` +//~| ERROR cannot find type `Key` in this scope +//~| ERROR unconstrained opaque type +//~| ERROR unconstrained opaque type + +pub fn main() {} diff --git a/tests/ui/type-alias-impl-trait/nested-impl-trait-in-tait.stderr b/tests/ui/type-alias-impl-trait/nested-impl-trait-in-tait.stderr new file mode 100644 index 00000000000..d4aeace4ae7 --- /dev/null +++ b/tests/ui/type-alias-impl-trait/nested-impl-trait-in-tait.stderr @@ -0,0 +1,47 @@ +error[E0261]: use of undeclared lifetime name `'db` + --> $DIR/nested-impl-trait-in-tait.rs:3:40 + | +LL | pub type Tait = impl Iterator<Item = (&'db Key, impl Iterator)>; + | ^^^ 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 `'db` lifetime + | +LL | pub type Tait = impl for<'db> Iterator<Item = (&'db Key, impl Iterator)>; + | ++++++++ +help: consider introducing lifetime `'db` here + | +LL | pub type Tait<'db> = impl Iterator<Item = (&'db Key, impl Iterator)>; + | +++++ + +error[E0412]: cannot find type `Key` in this scope + --> $DIR/nested-impl-trait-in-tait.rs:3:44 + | +LL | pub type Tait = impl Iterator<Item = (&'db Key, impl Iterator)>; + | ^^^ not found in this scope + | +help: consider importing this struct + | +LL + use std::thread::local_impl::Key; + | + +error: unconstrained opaque type + --> $DIR/nested-impl-trait-in-tait.rs:3:17 + | +LL | pub type Tait = impl Iterator<Item = (&'db Key, impl Iterator)>; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: `Tait` must be used in combination with a concrete type within the same module + +error: unconstrained opaque type + --> $DIR/nested-impl-trait-in-tait.rs:3:49 + | +LL | pub type Tait = impl Iterator<Item = (&'db Key, impl Iterator)>; + | ^^^^^^^^^^^^^ + | + = note: `Tait` must be used in combination with a concrete type within the same module + +error: aborting due to 4 previous errors + +Some errors have detailed explanations: E0261, E0412. +For more information about an error, try `rustc --explain E0261`. |
