mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-11-19 03:28:36 +00:00
Fix overflow detection in MIR evaluation
With a bit of higher-order macros everything sorts out well. And also fix a discovered bug when comparing long strings.
This commit is contained in:
parent
4500856e45
commit
bb400ca121
3 changed files with 206 additions and 19 deletions
|
|
@ -10034,6 +10034,40 @@ fn bar() {
|
|||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn i128_max() {
|
||||
check(
|
||||
r#"
|
||||
//- /core.rs library crate:core
|
||||
#![rustc_coherence_is_core]
|
||||
impl u128 {
|
||||
pub const MAX: Self = 340_282_366_920_938_463_463_374_607_431_768_211_455u128;
|
||||
}
|
||||
impl i128 {
|
||||
pub const MAX: Self = (u128::MAX >> 1) as Self;
|
||||
}
|
||||
|
||||
//- /foo.rs crate:foo deps:core
|
||||
fn foo() {
|
||||
let _ = i128::MAX$0;
|
||||
}
|
||||
"#,
|
||||
expect![
|
||||
r#"
|
||||
*MAX*
|
||||
|
||||
```rust
|
||||
core
|
||||
```
|
||||
|
||||
```rust
|
||||
pub const MAX: Self = 170141183460469231731687303715884105727 (0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF)
|
||||
```
|
||||
"#
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_runnables_with_snapshot_tests() {
|
||||
check_actions(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue