diff options
| author | Mazdak Farrokhzad <twingoow@gmail.com> | 2019-11-09 07:18:29 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-11-09 07:18:29 +0100 |
| commit | 666f9f9aa0c193715c68e068880f9c5ce75506c5 (patch) | |
| tree | b8ebe526e6df851fa0c1436d8a7228b9bd706ba1 /src/test | |
| parent | aaceeded9ee7a05d5bea960ae6fdf3b7af8d2163 (diff) | |
| parent | 9534b5863f0a6e41c6566795995219bd06ec4bf9 (diff) | |
Rollup merge of #65994 - estebank:where-bound, r=nikomatsakis
Point at where clauses where the associated item was restricted CC #57663. r? @nikomatsakis
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/ui/associated-types/point-at-type-on-obligation-failure-2.rs | 16 | ||||
| -rw-r--r-- | src/test/ui/associated-types/point-at-type-on-obligation-failure-2.stderr | 28 |
2 files changed, 43 insertions, 1 deletions
diff --git a/src/test/ui/associated-types/point-at-type-on-obligation-failure-2.rs b/src/test/ui/associated-types/point-at-type-on-obligation-failure-2.rs index 9360d96f05e..67b7c78071c 100644 --- a/src/test/ui/associated-types/point-at-type-on-obligation-failure-2.rs +++ b/src/test/ui/associated-types/point-at-type-on-obligation-failure-2.rs @@ -8,4 +8,20 @@ impl Foo for () { type Assoc = bool; //~ ERROR the trait bound `bool: Bar` is not satisfied } +trait Baz where Self::Assoc: Bar { + type Assoc; +} + +impl Baz for () { + type Assoc = bool; //~ ERROR the trait bound `bool: Bar` is not satisfied +} + +trait Bat where <Self as Bat>::Assoc: Bar { + type Assoc; +} + +impl Bat for () { + type Assoc = bool; //~ ERROR the trait bound `bool: Bar` is not satisfied +} + fn main() {} diff --git a/src/test/ui/associated-types/point-at-type-on-obligation-failure-2.stderr b/src/test/ui/associated-types/point-at-type-on-obligation-failure-2.stderr index f1a2e343a7e..072e9dad062 100644 --- a/src/test/ui/associated-types/point-at-type-on-obligation-failure-2.stderr +++ b/src/test/ui/associated-types/point-at-type-on-obligation-failure-2.stderr @@ -9,6 +9,32 @@ LL | impl Foo for () { LL | type Assoc = bool; | ^^^^^^^^^^^^^^^^^^ the trait `Bar` is not implemented for `bool` -error: aborting due to previous error +error[E0277]: the trait bound `bool: Bar` is not satisfied + --> $DIR/point-at-type-on-obligation-failure-2.rs:16:5 + | +LL | trait Baz where Self::Assoc: Bar { + | ---------------- restricted in this bound +LL | type Assoc; + | ----- associated type defined here +... +LL | impl Baz for () { + | --------------- in this `impl` item +LL | type Assoc = bool; + | ^^^^^^^^^^^^^^^^^^ the trait `Bar` is not implemented for `bool` + +error[E0277]: the trait bound `bool: Bar` is not satisfied + --> $DIR/point-at-type-on-obligation-failure-2.rs:24:5 + | +LL | trait Bat where <Self as Bat>::Assoc: Bar { + | ------------------------- restricted in this bound +LL | type Assoc; + | ----- associated type defined here +... +LL | impl Bat for () { + | --------------- in this `impl` item +LL | type Assoc = bool; + | ^^^^^^^^^^^^^^^^^^ the trait `Bar` is not implemented for `bool` + +error: aborting due to 3 previous errors For more information about this error, try `rustc --explain E0277`. |
