diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/ui/implied-bounds/issue-110161.rs | 24 | ||||
| -rw-r--r-- | tests/ui/implied-bounds/issue-110161.stderr | 12 |
2 files changed, 36 insertions, 0 deletions
diff --git a/tests/ui/implied-bounds/issue-110161.rs b/tests/ui/implied-bounds/issue-110161.rs new file mode 100644 index 00000000000..ca75026ffe8 --- /dev/null +++ b/tests/ui/implied-bounds/issue-110161.rs @@ -0,0 +1,24 @@ +// ICE regression relating to unconstrained lifetimes in implied +// bounds. See #110161. + +// compile-flags: --crate-type=lib + +trait Trait { + type Ty; +} + +// erroneous `Ty` impl +impl Trait for () { +//~^ ERROR not all trait items implemented, missing: `Ty` [E0046] +} + +// `'lt` is not constrained by the erroneous `Ty` +impl<'lt, T> Trait for Box<T> +where + T: Trait<Ty = &'lt ()>, +{ + type Ty = &'lt (); +} + +// unconstrained lifetime appears in implied bounds +fn test(_: <Box<()> as Trait>::Ty) {} diff --git a/tests/ui/implied-bounds/issue-110161.stderr b/tests/ui/implied-bounds/issue-110161.stderr new file mode 100644 index 00000000000..c76b4737626 --- /dev/null +++ b/tests/ui/implied-bounds/issue-110161.stderr @@ -0,0 +1,12 @@ +error[E0046]: not all trait items implemented, missing: `Ty` + --> $DIR/issue-110161.rs:11:1 + | +LL | type Ty; + | ------- `Ty` from trait +... +LL | impl Trait for () { + | ^^^^^^^^^^^^^^^^^ missing `Ty` in implementation + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0046`. |
