Add regression test for #26681

This commit is contained in:
Jonas Schievink 2019-09-15 01:15:22 +02:00
parent 1f61f36849
commit fd28614cb7
2 changed files with 32 additions and 0 deletions

View file

@ -0,0 +1,20 @@
#![feature(associated_type_defaults)]
// This is a partial regression test for #26681, which used to fail to resolve
// `Self` in the assoc. constant, and now fails with a type mismatch because
// `Self::Fv` cannot be assumed to equal `u8` inside the trait.
trait Foo {
type Bar;
}
impl Foo for u8 {
type Bar = ();
}
trait Baz {
type Fv: Foo = u8;
const C: <Self::Fv as Foo>::Bar = 6665; //~ error: mismatched types
}
fn main() {}

View file

@ -0,0 +1,12 @@
error[E0308]: mismatched types
--> $DIR/issue-26681.rs:17:39
|
LL | const C: <Self::Fv as Foo>::Bar = 6665;
| ^^^^ expected associated type, found integer
|
= note: expected type `<<Self as Baz>::Fv as Foo>::Bar`
found type `{integer}`
error: aborting due to previous error
For more information about this error, try `rustc --explain E0308`.