Add regression test for #26681
This commit is contained in:
parent
1f61f36849
commit
fd28614cb7
2 changed files with 32 additions and 0 deletions
20
src/test/ui/associated-types/issue-26681.rs
Normal file
20
src/test/ui/associated-types/issue-26681.rs
Normal 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() {}
|
||||
12
src/test/ui/associated-types/issue-26681.stderr
Normal file
12
src/test/ui/associated-types/issue-26681.stderr
Normal 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`.
|
||||
Loading…
Add table
Add a link
Reference in a new issue