Skip to content

Commit 4445e46

Browse files
oli-obkoli
authored and
oli
committed
Add test where diagnostic span points to just the inlined function's body
1 parent 20b1e05 commit 4445e46

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed
+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// build-fail
2+
// compile-flags: -Zmir-opt-level=2
3+
4+
#![deny(warnings)]
5+
6+
fn main() {
7+
let _ = add(u8::MAX, 1);
8+
}
9+
10+
#[inline(always)]
11+
fn add(x: u8, y: u8) -> u8 {
12+
x + y
13+
//~^ ERROR this arithmetic operation will overflow
14+
}
+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
error: this arithmetic operation will overflow
2+
--> $DIR/inline_spans.rs:12:5
3+
|
4+
LL | x + y
5+
| ^^^^^ attempt to compute `u8::MAX + 1_u8` which would overflow
6+
|
7+
= note: `#[deny(arithmetic_overflow)]` on by default
8+
9+
error: aborting due to previous error
10+

0 commit comments

Comments
 (0)