forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#67822 - wesleywiser:revert_67676, r=oli-obk
Revert `const_err` lint checking of casts Reverts part of rust-lang#67676 r? @oli-obk cc @SimonSapin
- Loading branch information
Showing
4 changed files
with
18 additions
and
91 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
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 |
---|---|---|
@@ -1,9 +1,15 @@ | ||
// build-fail | ||
// ignore-tidy-linelength | ||
// check-pass | ||
|
||
enum Foo { | ||
Bar = -42, | ||
Baz = 42, | ||
} | ||
|
||
fn main() { | ||
let _ = 0u8 as u32; | ||
let _ = (1u32 << 31) as u16; //~ ERROR truncating cast: the value 2147483648 requires 32 bits but the target type is only 16 bits | ||
let _ = (1u16 << 15) as u8; //~ ERROR truncating cast: the value 32768 requires 16 bits but the target type is only 8 bits | ||
let _ = (!0u16) as u8; //~ ERROR truncating cast: the value 65535 requires 16 bits but the target type is only 8 bits | ||
let _ = (1u32 << 31) as u16; | ||
let _ = (1u16 << 15) as u8; | ||
let _ = (!0u16) as u8; | ||
let _ = (-1i16) as i8; | ||
let _ = (Foo::Bar) as i8; | ||
} |
This file was deleted.
Oops, something went wrong.
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