Skip to content

Commit fa99459

Browse files
committed
Reintroduce the span printing in miri (plus point to spans where possible)
1 parent 7782a2b commit fa99459

File tree

358 files changed

+423
-420
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

358 files changed

+423
-420
lines changed

src/tools/miri/src/diagnostics.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,10 @@ fn report_msg<'tcx>(
364364
if is_local && idx > 0 {
365365
err.span_note(frame_info.span, &frame_info.to_string());
366366
} else {
367-
err.note(&frame_info.to_string());
367+
let sm = sess.source_map();
368+
let lo = sm.lookup_char_pos(frame_info.span.lo());
369+
let filename = sm.filename_for_diagnostics(&lo.file.name);
370+
err.note(format!("{frame_info} at {}:{}:{}", filename, lo.line, lo.col.0 + 1));
368371
}
369372
}
370373

src/tools/miri/tests/extern-so/fail/function_not_in_so.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ LL | foo();
66
|
77
= help: this is likely not a bug in the program; it indicates that the program performed an operation that the interpreter does not support
88
= note: BACKTRACE:
9-
= note: inside `main`
9+
= note: inside `main` at $DIR/function_not_in_so.rs:LL:CC
1010

1111
note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace
1212

src/tools/miri/tests/fail/abort-terminator.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ LL | | panic!()
99
LL | | }
1010
| |_^ the program aborted execution
1111
|
12-
= note: inside `panic_abort`
12+
= note: inside `panic_abort` at $DIR/abort-terminator.rs:LL:CC
1313
note: inside `main`
1414
--> $DIR/abort-terminator.rs:LL:CC
1515
|

src/tools/miri/tests/fail/alloc/deallocate-bad-alignment.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ LL | unsafe { __rust_dealloc(ptr, layout.size(), layout.align()) }
77
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
88
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
99
= note: BACKTRACE:
10-
= note: inside `std::alloc::dealloc`
10+
= note: inside `std::alloc::dealloc` at RUSTLIB/alloc/src/alloc.rs:LL:CC
1111
note: inside `main`
1212
--> $DIR/deallocate-bad-alignment.rs:LL:CC
1313
|

src/tools/miri/tests/fail/alloc/deallocate-bad-size.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ LL | unsafe { __rust_dealloc(ptr, layout.size(), layout.align()) }
77
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
88
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
99
= note: BACKTRACE:
10-
= note: inside `std::alloc::dealloc`
10+
= note: inside `std::alloc::dealloc` at RUSTLIB/alloc/src/alloc.rs:LL:CC
1111
note: inside `main`
1212
--> $DIR/deallocate-bad-size.rs:LL:CC
1313
|

src/tools/miri/tests/fail/alloc/deallocate-twice.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ LL | unsafe { __rust_dealloc(ptr, layout.size(), layout.align()) }
77
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
88
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
99
= note: BACKTRACE:
10-
= note: inside `std::alloc::dealloc`
10+
= note: inside `std::alloc::dealloc` at RUSTLIB/alloc/src/alloc.rs:LL:CC
1111
note: inside `main`
1212
--> $DIR/deallocate-twice.rs:LL:CC
1313
|

src/tools/miri/tests/fail/alloc/global_system_mixup.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ LL | FREE();
77
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
88
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
99
= note: BACKTRACE:
10-
= note: inside `std::sys::PLATFORM::alloc::<impl std::alloc::GlobalAlloc for std::alloc::System>::dealloc`
11-
= note: inside `<std::alloc::System as std::alloc::Allocator>::deallocate`
10+
= note: inside `std::sys::PLATFORM::alloc::<impl std::alloc::GlobalAlloc for std::alloc::System>::dealloc` at RUSTLIB/std/src/sys/PLATFORM/alloc.rs:LL:CC
11+
= note: inside `<std::alloc::System as std::alloc::Allocator>::deallocate` at RUSTLIB/std/src/alloc.rs:LL:CC
1212
note: inside `main`
1313
--> $DIR/global_system_mixup.rs:LL:CC
1414
|

src/tools/miri/tests/fail/alloc/no_global_allocator.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ LL | __rust_alloc(1, 1);
66
|
77
= help: this is likely not a bug in the program; it indicates that the program performed an operation that the interpreter does not support
88
= note: BACKTRACE:
9-
= note: inside `start`
9+
= note: inside `start` at $DIR/no_global_allocator.rs:LL:CC
1010

1111
error: aborting due to previous error
1212

src/tools/miri/tests/fail/alloc/reallocate-bad-size.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ LL | unsafe { __rust_realloc(ptr, layout.size(), layout.align(), new_size) }
77
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
88
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
99
= note: BACKTRACE:
10-
= note: inside `std::alloc::realloc`
10+
= note: inside `std::alloc::realloc` at RUSTLIB/alloc/src/alloc.rs:LL:CC
1111
note: inside `main`
1212
--> $DIR/reallocate-bad-size.rs:LL:CC
1313
|

src/tools/miri/tests/fail/alloc/reallocate-change-alloc.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ LL | let _z = *x;
77
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
88
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
99
= note: BACKTRACE:
10-
= note: inside `main`
10+
= note: inside `main` at $DIR/reallocate-change-alloc.rs:LL:CC
1111

1212
note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace
1313

0 commit comments

Comments
 (0)