diff --git a/tests/ui/associated-type-bounds/auxiliary/implied-predicates.rs b/tests/ui/associated-type-bounds/auxiliary/implied-predicates.rs new file mode 100644 index 0000000000000..fe74c64fbe2aa --- /dev/null +++ b/tests/ui/associated-type-bounds/auxiliary/implied-predicates.rs @@ -0,0 +1,7 @@ +pub trait Bar: Super {} + +pub trait Super { + type SuperAssoc; +} + +pub trait Bound {} diff --git a/tests/ui/associated-type-bounds/implied-predicates.rs b/tests/ui/associated-type-bounds/implied-predicates.rs new file mode 100644 index 0000000000000..91b8a94c64f26 --- /dev/null +++ b/tests/ui/associated-type-bounds/implied-predicates.rs @@ -0,0 +1,8 @@ +//@ aux-build:implied-predicates.rs + +extern crate implied_predicates; +use implied_predicates::Bar; + +fn bar() {} + +fn main() {} diff --git a/tests/ui/associated-type-bounds/implied-predicates.stderr b/tests/ui/associated-type-bounds/implied-predicates.stderr new file mode 100644 index 0000000000000..6527f9f36411d --- /dev/null +++ b/tests/ui/associated-type-bounds/implied-predicates.stderr @@ -0,0 +1,19 @@ +error[E0277]: the trait bound `::SuperAssoc: implied_predicates::Bound` is not satisfied + --> $DIR/implied-predicates.rs:6:11 + | +LL | fn bar() {} + | ^^^ the trait `implied_predicates::Bound` is not implemented for `::SuperAssoc` + | +note: required by a bound in `Bar` + --> $DIR/auxiliary/implied-predicates.rs:1:34 + | +LL | pub trait Bar: Super {} + | ^^^^^ required by this bound in `Bar` +help: consider further restricting the associated type + | +LL | fn bar() where ::SuperAssoc: implied_predicates::Bound {} + | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0277`.