diff --git a/tests/ui/traits/non_lifetime_binders/expected-region-found-kind.rs b/tests/ui/traits/non_lifetime_binders/expected-region-found-kind.rs new file mode 100644 index 0000000000000..c6796e9c3cba3 --- /dev/null +++ b/tests/ui/traits/non_lifetime_binders/expected-region-found-kind.rs @@ -0,0 +1,21 @@ +//! Regression test for . +//@ check-fail + +#![feature(non_lifetime_binders)] +trait E<'e> { + type As; +} + +trait F<'a>: for E<'a> + for<'e> E<'e> {} +//~^ ERROR type annotations needed: cannot satisfy `Self: E<'a>` [E0283] + +struct G<'a, T> +where + T: F<'a, As: E<'a>>, + //~^ ERROR type annotations needed: cannot satisfy `T: E<'a>` [E0283] + //~| ERROR ambiguous associated type `As` in bounds of `F` [E0221] +{ + x: &'a T, +} + +fn main() {} diff --git a/tests/ui/traits/non_lifetime_binders/expected-region-found-kind.stderr b/tests/ui/traits/non_lifetime_binders/expected-region-found-kind.stderr new file mode 100644 index 0000000000000..6ebba35fe9e2b --- /dev/null +++ b/tests/ui/traits/non_lifetime_binders/expected-region-found-kind.stderr @@ -0,0 +1,45 @@ +error[E0283]: type annotations needed: cannot satisfy `Self: E<'a>` + --> $DIR/expected-region-found-kind.rs:9:14 + | +LL | trait F<'a>: for E<'a> + for<'e> E<'e> {} + | ^^^^^^^^^^^^ + | +note: multiple `impl`s or `where` clauses satisfying `Self: E<'a>` found + --> $DIR/expected-region-found-kind.rs:9:14 + | +LL | trait F<'a>: for E<'a> + for<'e> E<'e> {} + | ^^^^^^^^^^^^ ^^^^^^^^^^^^^ + +error[E0221]: ambiguous associated type `As` in bounds of `F` + --> $DIR/expected-region-found-kind.rs:14:14 + | +LL | type As; + | ------- + | | + | ambiguous `As` from `for<'e> E<'e>` + | ambiguous `As` from `E<'a>` +... +LL | T: F<'a, As: E<'a>>, + | ^^^^^^^^^ ambiguous associated type `As` + +error[E0283]: type annotations needed: cannot satisfy `T: E<'a>` + --> $DIR/expected-region-found-kind.rs:14:8 + | +LL | T: F<'a, As: E<'a>>, + | ^^^^^^^^^^^^^^^^ + | +note: multiple `impl`s or `where` clauses satisfying `T: E<'a>` found + --> $DIR/expected-region-found-kind.rs:14:8 + | +LL | T: F<'a, As: E<'a>>, + | ^^^^^^^^^^^^^^^^ +note: required by a bound in `F` + --> $DIR/expected-region-found-kind.rs:9:14 + | +LL | trait F<'a>: for E<'a> + for<'e> E<'e> {} + | ^^^^^^^^^^^^ required by this bound in `F` + +error: aborting due to 3 previous errors + +Some errors have detailed explanations: E0221, E0283. +For more information about an error, try `rustc --explain E0221`.