mirror of
https://github.com/rust-lang/rust.git
synced 2024-10-31 22:41:50 +00:00
Add some tests for #67945
This commit is contained in:
parent
be2d5535ea
commit
f22bc7b1cf
8
src/test/ui/enum/issue-67945-1.rs
Normal file
8
src/test/ui/enum/issue-67945-1.rs
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
enum Bug<S> {
|
||||||
|
Var = {
|
||||||
|
let x: S = 0; //~ ERROR: mismatched types
|
||||||
|
0
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {}
|
17
src/test/ui/enum/issue-67945-1.stderr
Normal file
17
src/test/ui/enum/issue-67945-1.stderr
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
error[E0308]: mismatched types
|
||||||
|
--> $DIR/issue-67945-1.rs:3:20
|
||||||
|
|
|
||||||
|
LL | enum Bug<S> {
|
||||||
|
| - this type parameter
|
||||||
|
LL | Var = {
|
||||||
|
LL | let x: S = 0;
|
||||||
|
| - ^ expected type parameter `S`, found integer
|
||||||
|
| |
|
||||||
|
| expected due to this
|
||||||
|
|
|
||||||
|
= note: expected type parameter `S`
|
||||||
|
found type `{integer}`
|
||||||
|
|
||||||
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
For more information about this error, try `rustc --explain E0308`.
|
9
src/test/ui/enum/issue-67945-2.rs
Normal file
9
src/test/ui/enum/issue-67945-2.rs
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
#![feature(type_ascription)]
|
||||||
|
|
||||||
|
enum Bug<S> {
|
||||||
|
Var = 0: S,
|
||||||
|
//~^ ERROR: mismatched types
|
||||||
|
//~| ERROR: mismatched types
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {}
|
25
src/test/ui/enum/issue-67945-2.stderr
Normal file
25
src/test/ui/enum/issue-67945-2.stderr
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
error[E0308]: mismatched types
|
||||||
|
--> $DIR/issue-67945-2.rs:4:11
|
||||||
|
|
|
||||||
|
LL | enum Bug<S> {
|
||||||
|
| - this type parameter
|
||||||
|
LL | Var = 0: S,
|
||||||
|
| ^ expected type parameter `S`, found integer
|
||||||
|
|
|
||||||
|
= note: expected type parameter `S`
|
||||||
|
found type `{integer}`
|
||||||
|
|
||||||
|
error[E0308]: mismatched types
|
||||||
|
--> $DIR/issue-67945-2.rs:4:11
|
||||||
|
|
|
||||||
|
LL | enum Bug<S> {
|
||||||
|
| - this type parameter
|
||||||
|
LL | Var = 0: S,
|
||||||
|
| ^^^^ expected `isize`, found type parameter `S`
|
||||||
|
|
|
||||||
|
= note: expected type `isize`
|
||||||
|
found type parameter `S`
|
||||||
|
|
||||||
|
error: aborting due to 2 previous errors
|
||||||
|
|
||||||
|
For more information about this error, try `rustc --explain E0308`.
|
Loading…
Reference in New Issue
Block a user