From c855bf62d7adf3f016637d57423d7f84ef15c334 Mon Sep 17 00:00:00 2001 From: Michael Goulet Date: Fri, 22 Mar 2024 13:13:04 -0400 Subject: [PATCH] Add a test --- .../auxiliary/implied-predicates.rs | 7 +++++++ .../implied-predicates.rs | 8 ++++++++ .../implied-predicates.stderr | 19 +++++++++++++++++++ 3 files changed, 34 insertions(+) create mode 100644 tests/ui/associated-type-bounds/auxiliary/implied-predicates.rs create mode 100644 tests/ui/associated-type-bounds/implied-predicates.rs create mode 100644 tests/ui/associated-type-bounds/implied-predicates.stderr 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 00000000000..fe74c64fbe2 --- /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 00000000000..91b8a94c64f --- /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 00000000000..6527f9f3641 --- /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`.