diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:19:13 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:19:13 +0000 |
commit | 218caa410aa38c29984be31a5229b9fa717560ee (patch) | |
tree | c54bd55eeb6e4c508940a30e94c0032fbd45d677 /tests/ui/lint/type-overflow.stderr | |
parent | Releasing progress-linux version 1.67.1+dfsg1-1~progress7.99u1. (diff) | |
download | rustc-218caa410aa38c29984be31a5229b9fa717560ee.tar.xz rustc-218caa410aa38c29984be31a5229b9fa717560ee.zip |
Merging upstream version 1.68.2+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/ui/lint/type-overflow.stderr')
-rw-r--r-- | tests/ui/lint/type-overflow.stderr | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/tests/ui/lint/type-overflow.stderr b/tests/ui/lint/type-overflow.stderr new file mode 100644 index 000000000..62cb1f7f4 --- /dev/null +++ b/tests/ui/lint/type-overflow.stderr @@ -0,0 +1,67 @@ +warning: literal out of range for `i8` + --> $DIR/type-overflow.rs:5:17 + | +LL | let error = 255i8; + | ^^^^^ + | + = note: the literal `255i8` does not fit into the type `i8` whose range is `-128..=127` + = help: consider using the type `u8` instead +note: the lint level is defined here + --> $DIR/type-overflow.rs:2:9 + | +LL | #![warn(overflowing_literals)] + | ^^^^^^^^^^^^^^^^^^^^ + +warning: literal out of range for `i8` + --> $DIR/type-overflow.rs:10:16 + | +LL | let fail = 0b1000_0001i8; + | ^^^^^^^^^^^^^ help: consider using the type `u8` instead: `0b1000_0001u8` + | + = note: the literal `0b1000_0001i8` (decimal `129`) does not fit into the type `i8` and will become `-127i8` + +warning: literal out of range for `i64` + --> $DIR/type-overflow.rs:12:16 + | +LL | let fail = 0x8000_0000_0000_0000i64; + | ^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using the type `u64` instead: `0x8000_0000_0000_0000u64` + | + = note: the literal `0x8000_0000_0000_0000i64` (decimal `9223372036854775808`) does not fit into the type `i64` and will become `-9223372036854775808i64` + +warning: literal out of range for `u32` + --> $DIR/type-overflow.rs:14:16 + | +LL | let fail = 0x1_FFFF_FFFFu32; + | ^^^^^^^^^^^^^^^^ help: consider using the type `u64` instead: `0x1_FFFF_FFFFu64` + | + = note: the literal `0x1_FFFF_FFFFu32` (decimal `8589934591`) does not fit into the type `u32` and will become `4294967295u32` + +warning: literal out of range for `i128` + --> $DIR/type-overflow.rs:16:22 + | +LL | let fail: i128 = 0x8000_0000_0000_0000_0000_0000_0000_0000; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: the literal `0x8000_0000_0000_0000_0000_0000_0000_0000` (decimal `170141183460469231731687303715884105728`) does not fit into the type `i128` and will become `-170141183460469231731687303715884105728i128` + = help: consider using the type `u128` instead + +warning: literal out of range for `i32` + --> $DIR/type-overflow.rs:19:16 + | +LL | let fail = 0x8FFF_FFFF_FFFF_FFFE; + | ^^^^^^^^^^^^^^^^^^^^^ + | + = note: the literal `0x8FFF_FFFF_FFFF_FFFE` (decimal `10376293541461622782`) does not fit into the type `i32` and will become `-2i32` + = help: consider using the type `i128` instead + +warning: literal out of range for `i8` + --> $DIR/type-overflow.rs:21:17 + | +LL | let fail = -0b1111_1111i8; + | ^^^^^^^^^^^^^ help: consider using the type `i16` instead: `0b1111_1111i16` + | + = note: the literal `0b1111_1111i8` (decimal `255`) does not fit into the type `i8` + = note: and the value `-0b1111_1111i8` will become `1i8` + +warning: 7 warnings emitted + |