type-alias-enum-variants-priority-2: account for 'const's + describe test.

This commit is contained in:
Mazdak Farrokhzad 2019-06-09 03:51:13 +02:00
parent ff7d6a18ad
commit 6d1ecb3c95
2 changed files with 25 additions and 3 deletions

View file

@ -1,3 +1,6 @@
// Check that an `enum` variant is resolved, in the value namespace,
// with higher priority than other inherent items when there is a conflict.
enum E {
V(u8)
}
@ -6,6 +9,15 @@ impl E {
fn V() {}
}
enum E2 {
V,
}
impl E2 {
const V: u8 = 0;
}
fn main() {
<E>::V(); //~ ERROR this function takes 1 parameter but 0 parameters were supplied
let _: u8 = <E2>::V; //~ ERROR mismatched types
}

View file

@ -1,5 +1,5 @@
error[E0061]: this function takes 1 parameter but 0 parameters were supplied
--> $DIR/type-alias-enum-variants-priority-2.rs:10:5
--> $DIR/type-alias-enum-variants-priority-2.rs:21:5
|
LL | V(u8)
| ----- defined here
@ -7,6 +7,16 @@ LL | V(u8)
LL | <E>::V();
| ^^^^^^^^ expected 1 parameter
error: aborting due to previous error
error[E0308]: mismatched types
--> $DIR/type-alias-enum-variants-priority-2.rs:22:17
|
LL | let _: u8 = <E2>::V;
| ^^^^^^^ expected u8, found enum `E2`
|
= note: expected type `u8`
found type `E2`
For more information about this error, try `rustc --explain E0061`.
error: aborting due to 2 previous errors
Some errors have detailed explanations: E0061, E0308.
For more information about an error, try `rustc --explain E0061`.