Skip to content

Commit 6d1ecb3

Browse files
committed
type-alias-enum-variants-priority-2: account for 'const's + describe test.
1 parent ff7d6a1 commit 6d1ecb3

File tree

2 files changed

+25
-3
lines changed

2 files changed

+25
-3
lines changed

src/test/ui/type-alias-enum-variants/type-alias-enum-variants-priority-2.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
// Check that an `enum` variant is resolved, in the value namespace,
2+
// with higher priority than other inherent items when there is a conflict.
3+
14
enum E {
25
V(u8)
36
}
@@ -6,6 +9,15 @@ impl E {
69
fn V() {}
710
}
811

12+
enum E2 {
13+
V,
14+
}
15+
16+
impl E2 {
17+
const V: u8 = 0;
18+
}
19+
920
fn main() {
1021
<E>::V(); //~ ERROR this function takes 1 parameter but 0 parameters were supplied
22+
let _: u8 = <E2>::V; //~ ERROR mismatched types
1123
}
Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,22 @@
11
error[E0061]: this function takes 1 parameter but 0 parameters were supplied
2-
--> $DIR/type-alias-enum-variants-priority-2.rs:10:5
2+
--> $DIR/type-alias-enum-variants-priority-2.rs:21:5
33
|
44
LL | V(u8)
55
| ----- defined here
66
...
77
LL | <E>::V();
88
| ^^^^^^^^ expected 1 parameter
99

10-
error: aborting due to previous error
10+
error[E0308]: mismatched types
11+
--> $DIR/type-alias-enum-variants-priority-2.rs:22:17
12+
|
13+
LL | let _: u8 = <E2>::V;
14+
| ^^^^^^^ expected u8, found enum `E2`
15+
|
16+
= note: expected type `u8`
17+
found type `E2`
18+
19+
error: aborting due to 2 previous errors
1120

12-
For more information about this error, try `rustc --explain E0061`.
21+
Some errors have detailed explanations: E0061, E0308.
22+
For more information about an error, try `rustc --explain E0061`.

0 commit comments

Comments
 (0)