Logo
Explore Help
Register Sign In
rust-lang/rust
1
0
Fork 0
You've already forked rust
Code Issues Pull Requests Actions 1 Packages Projects Releases Wiki Activity
Files
55b6f649024b372af901b3412a6d36c4284ccf3d
rust/tests/ui/const_prop/const-prop-overflowing-casts.rs

16 lines
245 B
Rust
Raw Normal View History

Revert `const_err` lint checking of casts Reverts part of #67676
2020-01-02 20:28:21 -05:00
// check-pass
enum Foo {
Bar = -42,
Baz = 42,
}
Lint overflowing integer casts in const prop This extends the invalid cases we catch in const prop to include overflowing integer casts using the same machinery as the overflowing binary and unary operation logic.
2019-12-12 22:03:32 -05:00
fn main() {
let _ = 0u8 as u32;
Revert `const_err` lint checking of casts Reverts part of #67676
2020-01-02 20:28:21 -05:00
let _ = (1u32 << 31) as u16;
let _ = (1u16 << 15) as u8;
let _ = (!0u16) as u8;
let _ = (-1i16) as i8;
let _ = (Foo::Bar) as i8;
Lint overflowing integer casts in const prop This extends the invalid cases we catch in const prop to include overflowing integer casts using the same machinery as the overflowing binary and unary operation logic.
2019-12-12 22:03:32 -05:00
}
Reference in New Issue Copy Permalink
Powered by Gitea Version: 1.24.6 Page: 1520ms Template: 2ms
English
Bahasa Indonesia Deutsch English Español Français Gaeilge Italiano Latviešu Magyar nyelv Nederlands Polski Português de Portugal Português do Brasil Suomi Svenska Türkçe Čeština Ελληνικά Български Русский Українська فارسی മലയാളം 日本語 简体中文 繁體中文(台灣) 繁體中文(香港) 한국어
Licenses API