-
Notifications
You must be signed in to change notification settings - Fork 12.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add ui test for new typeof error messages
- Loading branch information
Showing
2 changed files
with
32 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// Test that using typeof results in the correct type mismatch errors instead of always assuming | ||
// `usize`, in addition to the pre-existing "typeof is reserved and unimplemented" error | ||
fn main() { | ||
const a: u8 = 1; | ||
let b: typeof(a) = 1i8; | ||
//~^ ERROR `typeof` is a reserved keyword but unimplemented | ||
//~| ERROR mismatched types | ||
//~| expected `u8`, found `i8` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
error[E0516]: `typeof` is a reserved keyword but unimplemented | ||
--> $DIR/type_mismatch.rs:5:12 | ||
| | ||
LL | let b: typeof(a) = 1i8; | ||
| ^^^^^^^^^ reserved keyword | ||
|
||
error[E0308]: mismatched types | ||
--> $DIR/type_mismatch.rs:5:24 | ||
| | ||
LL | let b: typeof(a) = 1i8; | ||
| --------- ^^^ expected `u8`, found `i8` | ||
| | | ||
| expected due to this | ||
| | ||
help: change the type of the numeric literal from `i8` to `u8` | ||
| | ||
LL | let b: typeof(a) = 1u8; | ||
| ^^^ | ||
|
||
error: aborting due to 2 previous errors | ||
|
||
Some errors have detailed explanations: E0308, E0516. | ||
For more information about an error, try `rustc --explain E0308`. |