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#94354 - light4:issue-94239, r=Dylan-DPC
Fix show error message when literal overflows in match patterns Fix rust-lang#94239 This changes overflow behavior in [fn lit_to_const](https://github.com/rust-lang/rust/blob/master/compiler/rustc_mir_build/src/thir/constant.rs#L10)
- Loading branch information
Showing
5 changed files
with
32 additions
and
7 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
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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
pub const fn test_match_range(len: u64) -> u64 { | ||
match len { | ||
10000000000000000000..=99999999999999999999 => 0, //~ ERROR literal out of range for `u64` | ||
_ => unreachable!(), | ||
} | ||
} | ||
|
||
fn main() {} |
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,11 @@ | ||
error: literal out of range for `u64` | ||
--> $DIR/issue-94239.rs:3:32 | ||
| | ||
LL | 10000000000000000000..=99999999999999999999 => 0, | ||
| ^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= note: `#[deny(overflowing_literals)]` on by default | ||
= note: the literal `99999999999999999999` does not fit into the type `u64` whose range is `0..=18446744073709551615` | ||
|
||
error: aborting due to previous error | ||
|