Skip to content

Commit

Permalink
Add a test
Browse files Browse the repository at this point in the history
  • Loading branch information
compiler-errors committed Mar 22, 2024
1 parent 1447f9d commit c855bf6
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
pub trait Bar: Super<SuperAssoc: Bound> {}

pub trait Super {
type SuperAssoc;
}

pub trait Bound {}
8 changes: 8 additions & 0 deletions tests/ui/associated-type-bounds/implied-predicates.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
//@ aux-build:implied-predicates.rs

extern crate implied_predicates;
use implied_predicates::Bar;

fn bar<B: Bar>() {}

fn main() {}
19 changes: 19 additions & 0 deletions tests/ui/associated-type-bounds/implied-predicates.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
error[E0277]: the trait bound `<B as Super>::SuperAssoc: implied_predicates::Bound` is not satisfied
--> $DIR/implied-predicates.rs:6:11
|
LL | fn bar<B: Bar>() {}
| ^^^ the trait `implied_predicates::Bound` is not implemented for `<B as Super>::SuperAssoc`
|
note: required by a bound in `Bar`
--> $DIR/auxiliary/implied-predicates.rs:1:34
|
LL | pub trait Bar: Super<SuperAssoc: Bound> {}
| ^^^^^ required by this bound in `Bar`
help: consider further restricting the associated type
|
LL | fn bar<B: Bar>() where <B as Super>::SuperAssoc: implied_predicates::Bound {}
| +++++++++++++++++++++++++++++++++++++++++++++++++++++++++

error: aborting due to 1 previous error

For more information about this error, try `rustc --explain E0277`.

0 comments on commit c855bf6

Please sign in to comment.