Skip to content

Commit b70464d

Browse files
committed
Hide the full path to the sysroot
1 parent 5bd594c commit b70464d

Some content is hidden

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

47 files changed

+179
-322
lines changed

cargo-miri/bin.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,7 @@ path = "lib.rs"
461461
command.env_remove("RUSTFLAGS");
462462
// Disable debug assertions in the standard library -- Miri is already slow enough.
463463
// But keep the overflow checks, they are cheap.
464-
command.env("RUSTFLAGS", "-Cdebug-assertions=off -Coverflow-checks=on");
464+
command.env("RUSTFLAGS", "-Cdebug-assertions=off -Coverflow-checks=on -Zremap-cwd-prefix=rustc_src");
465465
// Finally run it!
466466
if command.status().expect("failed to run xargo").success().not() {
467467
show_error(format!("failed to run xargo"));

tests/compile-fail/alloc/deallocate-bad-alignment.stderr

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
11
error: Undefined Behavior: incorrect layout on deallocation: alloc962 has size 1 and alignment 1, but gave size 1 and alignment 2
2-
--> /home/ubuntu/.rustup/toolchains/miri/lib/rustlib/src/rust/library/alloc/src/alloc.rs:105:14
3-
|
4-
LL | unsafe { __rust_dealloc(ptr, layout.size(), layout.align()) }
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ incorrect layout on deallocation: alloc962 has size 1 and alignment 1, but gave size 1 and alignment 2
62
|
73
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
84
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
95

10-
= note: inside `std::alloc::dealloc` at /home/ubuntu/.rustup/toolchains/miri/lib/rustlib/src/rust/library/alloc/src/alloc.rs:105:14
6+
= note: inside `std::alloc::dealloc` at rustc_src/src/alloc.rs:105:14
117
note: inside `main` at $DIR/deallocate-bad-alignment.rs:8:9
128
--> $DIR/deallocate-bad-alignment.rs:8:9
139
|

tests/compile-fail/alloc/deallocate-bad-size.stderr

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
11
error: Undefined Behavior: incorrect layout on deallocation: alloc962 has size 1 and alignment 1, but gave size 2 and alignment 1
2-
--> /home/ubuntu/.rustup/toolchains/miri/lib/rustlib/src/rust/library/alloc/src/alloc.rs:105:14
3-
|
4-
LL | unsafe { __rust_dealloc(ptr, layout.size(), layout.align()) }
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ incorrect layout on deallocation: alloc962 has size 1 and alignment 1, but gave size 2 and alignment 1
62
|
73
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
84
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
95

10-
= note: inside `std::alloc::dealloc` at /home/ubuntu/.rustup/toolchains/miri/lib/rustlib/src/rust/library/alloc/src/alloc.rs:105:14
6+
= note: inside `std::alloc::dealloc` at rustc_src/src/alloc.rs:105:14
117
note: inside `main` at $DIR/deallocate-bad-size.rs:8:9
128
--> $DIR/deallocate-bad-size.rs:8:9
139
|

tests/compile-fail/alloc/deallocate-twice.stderr

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
11
error: Undefined Behavior: pointer to alloc962 was dereferenced after this allocation got freed
2-
--> /home/ubuntu/.rustup/toolchains/miri/lib/rustlib/src/rust/library/alloc/src/alloc.rs:105:14
3-
|
4-
LL | unsafe { __rust_dealloc(ptr, layout.size(), layout.align()) }
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pointer to alloc962 was dereferenced after this allocation got freed
62
|
73
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
84
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
95

10-
= note: inside `std::alloc::dealloc` at /home/ubuntu/.rustup/toolchains/miri/lib/rustlib/src/rust/library/alloc/src/alloc.rs:105:14
6+
= note: inside `std::alloc::dealloc` at rustc_src/src/alloc.rs:105:14
117
note: inside `main` at $DIR/deallocate-twice.rs:9:9
128
--> $DIR/deallocate-twice.rs:9:9
139
|

tests/compile-fail/alloc/global_system_mixup.stderr

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
11
error: Undefined Behavior: deallocating alloc975, which is Rust heap memory, using C heap deallocation operation
2-
--> /home/ubuntu/.rustup/toolchains/miri/lib/rustlib/src/rust/library/std/src/sys/unix/alloc.rs:42:9
3-
|
4-
LL | libc::free(ptr as *mut libc::c_void)
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ deallocating alloc975, which is Rust heap memory, using C heap deallocation operation
62
|
73
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
84
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
95

10-
= note: inside `std::sys::unix::alloc::<impl std::alloc::GlobalAlloc for std::alloc::System>::dealloc` at /home/ubuntu/.rustup/toolchains/miri/lib/rustlib/src/rust/library/std/src/sys/unix/alloc.rs:42:9
11-
= note: inside `<std::alloc::System as std::alloc::Allocator>::deallocate` at /home/ubuntu/.rustup/toolchains/miri/lib/rustlib/src/rust/library/std/src/alloc.rs:218:22
6+
= note: inside `std::sys::unix::alloc::<impl std::alloc::GlobalAlloc for std::alloc::System>::dealloc` at rustc_src/src/sys/unix/alloc.rs:42:9
7+
= note: inside `<std::alloc::System as std::alloc::Allocator>::deallocate` at rustc_src/src/alloc.rs:218:22
128
note: inside `main` at $DIR/global_system_mixup.rs:12:14
139
--> $DIR/global_system_mixup.rs:12:14
1410
|

tests/compile-fail/alloc/reallocate-bad-size.stderr

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
11
error: Undefined Behavior: incorrect layout on deallocation: alloc962 has size 1 and alignment 1, but gave size 2 and alignment 1
2-
--> /home/ubuntu/.rustup/toolchains/miri/lib/rustlib/src/rust/library/alloc/src/alloc.rs:124:14
3-
|
4-
LL | unsafe { __rust_realloc(ptr, layout.size(), layout.align(), new_size) }
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ incorrect layout on deallocation: alloc962 has size 1 and alignment 1, but gave size 2 and alignment 1
62
|
73
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
84
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
95

10-
= note: inside `std::alloc::realloc` at /home/ubuntu/.rustup/toolchains/miri/lib/rustlib/src/rust/library/alloc/src/alloc.rs:124:14
6+
= note: inside `std::alloc::realloc` at rustc_src/src/alloc.rs:124:14
117
note: inside `main` at $DIR/reallocate-bad-size.rs:8:18
128
--> $DIR/reallocate-bad-size.rs:8:18
139
|

tests/compile-fail/alloc/reallocate-dangling.stderr

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
11
error: Undefined Behavior: pointer to alloc962 was dereferenced after this allocation got freed
2-
--> /home/ubuntu/.rustup/toolchains/miri/lib/rustlib/src/rust/library/alloc/src/alloc.rs:124:14
3-
|
4-
LL | unsafe { __rust_realloc(ptr, layout.size(), layout.align(), new_size) }
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pointer to alloc962 was dereferenced after this allocation got freed
62
|
73
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
84
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
95

10-
= note: inside `std::alloc::realloc` at /home/ubuntu/.rustup/toolchains/miri/lib/rustlib/src/rust/library/alloc/src/alloc.rs:124:14
6+
= note: inside `std::alloc::realloc` at rustc_src/src/alloc.rs:124:14
117
note: inside `main` at $DIR/reallocate-dangling.rs:9:18
128
--> $DIR/reallocate-dangling.rs:9:18
139
|

tests/compile-fail/alloc/stack_free.stderr

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,13 @@
11
error: Undefined Behavior: deallocating alloc508, which is stack variable memory, using Rust heap deallocation operation
2-
--> /home/ubuntu/.rustup/toolchains/miri/lib/rustlib/src/rust/library/alloc/src/alloc.rs:105:14
3-
|
4-
LL | unsafe { __rust_dealloc(ptr, layout.size(), layout.align()) }
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ deallocating alloc508, which is stack variable memory, using Rust heap deallocation operation
62
|
73
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
84
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
95

10-
= note: inside `std::alloc::dealloc` at /home/ubuntu/.rustup/toolchains/miri/lib/rustlib/src/rust/library/alloc/src/alloc.rs:105:14
11-
= note: inside `<std::alloc::Global as std::alloc::Allocator>::deallocate` at /home/ubuntu/.rustup/toolchains/miri/lib/rustlib/src/rust/library/alloc/src/alloc.rs:242:22
12-
= note: inside `alloc::alloc::box_free::<i32, std::alloc::Global>` at /home/ubuntu/.rustup/toolchains/miri/lib/rustlib/src/rust/library/alloc/src/alloc.rs:340:9
13-
= note: inside `std::ptr::drop_in_place::<std::boxed::Box<i32>> - shim(Some(std::boxed::Box<i32>))` at /home/ubuntu/.rustup/toolchains/miri/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:188:1
14-
= note: inside `std::mem::drop::<std::boxed::Box<i32>>` at /home/ubuntu/.rustup/toolchains/miri/lib/rustlib/src/rust/library/core/src/mem/mod.rs:965:24
6+
= note: inside `std::alloc::dealloc` at rustc_src/src/alloc.rs:105:14
7+
= note: inside `<std::alloc::Global as std::alloc::Allocator>::deallocate` at rustc_src/src/alloc.rs:242:22
8+
= note: inside `alloc::alloc::box_free::<i32, std::alloc::Global>` at rustc_src/src/alloc.rs:340:9
9+
= note: inside `std::ptr::drop_in_place::<std::boxed::Box<i32>> - shim(Some(std::boxed::Box<i32>))` at rustc_src/src/ptr/mod.rs:188:1
10+
= note: inside `std::mem::drop::<std::boxed::Box<i32>>` at rustc_src/src/mem/mod.rs:965:24
1511
note: inside `main` at $DIR/stack_free.rs:9:5
1612
--> $DIR/stack_free.rs:9:5
1713
|

tests/compile-fail/concurrency/too_few_args.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ LL | panic!()
99
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
1010
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
1111

12-
= note: inside `thread_start` at /home/ubuntu/.rustup/toolchains/miri/lib/rustlib/src/rust/library/std/src/panic.rs:19:9
12+
= note: inside `thread_start` at rustc_src/src/panic.rs:19:9
1313
= note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info)
1414

1515
error: aborting due to previous error; 1 warning emitted

tests/compile-fail/concurrency/too_many_args.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ LL | panic!()
99
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
1010
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
1111

12-
= note: inside `thread_start` at /home/ubuntu/.rustup/toolchains/miri/lib/rustlib/src/rust/library/std/src/panic.rs:19:9
12+
= note: inside `thread_start` at rustc_src/src/panic.rs:19:9
1313
= note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info)
1414

1515
error: aborting due to previous error; 1 warning emitted

tests/compile-fail/dangling_pointers/dangling_pointer_addr_of.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ LL | let x = unsafe { ptr::addr_of!(*p) }; //~ ERROR dereferenced after this
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

10-
= note: inside `main` at /home/ubuntu/.rustup/toolchains/miri/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:1482:5
10+
= note: inside `main` at rustc_src/src/ptr/mod.rs:1482:5
1111
= note: this error originates in the macro `ptr::addr_of` (in Nightly builds, run with -Z macro-backtrace for more info)
1212

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

tests/compile-fail/fs/isolated_file.stderr

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,15 @@
11
error: unsupported operation: `open` not available when isolation is enabled
2-
--> /home/ubuntu/.rustup/toolchains/miri/lib/rustlib/src/rust/library/std/src/sys/unix/fs.rs:843:36
3-
|
4-
LL | let fd = cvt_r(|| unsafe { open64(path.as_ptr(), flags, opts.mode as c_int) })?;
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `open` not available when isolation is enabled
62
|
73
= help: pass the flag `-Zmiri-disable-isolation` to disable isolation;
84
= help: or pass `-Zmiri-isolation-error=warn` to configure Miri to return an error code from isolated operations (if supported for that operation) and continue with a warning
95

10-
= note: inside closure at /home/ubuntu/.rustup/toolchains/miri/lib/rustlib/src/rust/library/std/src/sys/unix/fs.rs:843:36
11-
= note: inside `std::sys::unix::cvt_r::<i32, [closure@std::sys::unix::fs::File::open_c::{closure#0}]>` at /home/ubuntu/.rustup/toolchains/miri/lib/rustlib/src/rust/library/std/src/sys/unix/mod.rs:212:19
12-
= note: inside `std::sys::unix::fs::File::open_c` at /home/ubuntu/.rustup/toolchains/miri/lib/rustlib/src/rust/library/std/src/sys/unix/fs.rs:843:18
13-
= note: inside `std::sys::unix::fs::File::open` at /home/ubuntu/.rustup/toolchains/miri/lib/rustlib/src/rust/library/std/src/sys/unix/fs.rs:831:9
14-
= note: inside `std::fs::OpenOptions::_open` at /home/ubuntu/.rustup/toolchains/miri/lib/rustlib/src/rust/library/std/src/fs.rs:952:9
15-
= note: inside `std::fs::OpenOptions::open::<&std::path::Path>` at /home/ubuntu/.rustup/toolchains/miri/lib/rustlib/src/rust/library/std/src/fs.rs:948:9
16-
= note: inside `std::fs::File::open::<&str>` at /home/ubuntu/.rustup/toolchains/miri/lib/rustlib/src/rust/library/std/src/fs.rs:328:9
6+
= note: inside closure at rustc_src/src/sys/unix/fs.rs:843:36
7+
= note: inside `std::sys::unix::cvt_r::<i32, [closure@std::sys::unix::fs::File::open_c::{closure#0}]>` at rustc_src/src/sys/unix/mod.rs:212:19
8+
= note: inside `std::sys::unix::fs::File::open_c` at rustc_src/src/sys/unix/fs.rs:843:18
9+
= note: inside `std::sys::unix::fs::File::open` at rustc_src/src/sys/unix/fs.rs:831:9
10+
= note: inside `std::fs::OpenOptions::_open` at rustc_src/src/fs.rs:952:9
11+
= note: inside `std::fs::OpenOptions::open::<&std::path::Path>` at rustc_src/src/fs.rs:948:9
12+
= note: inside `std::fs::File::open::<&str>` at rustc_src/src/fs.rs:328:9
1713
note: inside `main` at $DIR/isolated_file.rs:5:17
1814
--> $DIR/isolated_file.rs:5:17
1915
|

tests/compile-fail/generator-pinned-moved.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ note: inside `<GeneratorIteratorAdapter<[static generator@$DIR/generator-pinned-
1313
|
1414
LL | match me.resume(()) {
1515
| ^^^^^^^^^^^^^
16-
= note: inside `<std::boxed::Box<GeneratorIteratorAdapter<[static generator@$DIR/generator-pinned-moved.rs:9:5: 15:6]>> as std::iter::Iterator>::next` at /home/ubuntu/.rustup/toolchains/miri/lib/rustlib/src/rust/library/alloc/src/boxed.rs:1787:9
16+
= note: inside `<std::boxed::Box<GeneratorIteratorAdapter<[static generator@$DIR/generator-pinned-moved.rs:9:5: 15:6]>> as std::iter::Iterator>::next` at rustc_src/src/boxed.rs:1787:9
1717
note: inside `main` at $DIR/generator-pinned-moved.rs:43:5
1818
--> $DIR/generator-pinned-moved.rs:43:5
1919
|

tests/compile-fail/intrinsics/copy_overflow.stderr

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
11
error: Undefined Behavior: overflow computing total size of `copy`
2-
--> /home/ubuntu/.rustup/toolchains/miri/lib/rustlib/src/rust/library/core/src/intrinsics.rs:2193:14
3-
|
4-
LL | unsafe { copy(src, dst, count) }
5-
| ^^^^^^^^^^^^^^^^^^^^^ overflow computing total size of `copy`
62
|
73
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
84
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
95

10-
= note: inside `std::intrinsics::copy::<i32>` at /home/ubuntu/.rustup/toolchains/miri/lib/rustlib/src/rust/library/core/src/intrinsics.rs:2193:14
11-
= note: inside `std::ptr::mut_ptr::<impl *mut i32>::copy_from` at /home/ubuntu/.rustup/toolchains/miri/lib/rustlib/src/rust/library/core/src/ptr/mut_ptr.rs:1032:18
6+
= note: inside `std::intrinsics::copy::<i32>` at rustc_src/src/intrinsics.rs:2193:14
7+
= note: inside `std::ptr::mut_ptr::<impl *mut i32>::copy_from` at rustc_src/src/ptr/mut_ptr.rs:1032:18
128
note: inside `main` at $DIR/copy_overflow.rs:8:9
139
--> $DIR/copy_overflow.rs:8:9
1410
|

tests/compile-fail/intrinsics/out_of_bounds_ptr_1.stderr

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
11
error: Undefined Behavior: pointer arithmetic failed: alloc956 has size 4, so pointer to 5 bytes starting at offset 0 is out-of-bounds
2-
--> /home/ubuntu/.rustup/toolchains/miri/lib/rustlib/src/rust/library/core/src/ptr/const_ptr.rs:295:18
3-
|
4-
LL | unsafe { intrinsics::offset(self, count) }
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pointer arithmetic failed: alloc956 has size 4, so pointer to 5 bytes starting at offset 0 is out-of-bounds
62
|
73
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
84
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
95

10-
= note: inside `std::ptr::const_ptr::<impl *const i8>::offset` at /home/ubuntu/.rustup/toolchains/miri/lib/rustlib/src/rust/library/core/src/ptr/const_ptr.rs:295:18
6+
= note: inside `std::ptr::const_ptr::<impl *const i8>::offset` at rustc_src/src/ptr/const_ptr.rs:295:18
117
note: inside `main` at $DIR/out_of_bounds_ptr_1.rs:6:22
128
--> $DIR/out_of_bounds_ptr_1.rs:6:22
139
|

tests/compile-fail/intrinsics/out_of_bounds_ptr_2.stderr

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
11
error: Undefined Behavior: overflowing in-bounds pointer arithmetic
2-
--> /home/ubuntu/.rustup/toolchains/miri/lib/rustlib/src/rust/library/core/src/ptr/const_ptr.rs:295:18
3-
|
4-
LL | unsafe { intrinsics::offset(self, count) }
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ overflowing in-bounds pointer arithmetic
62
|
73
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
84
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
95

10-
= note: inside `std::ptr::const_ptr::<impl *const i8>::offset` at /home/ubuntu/.rustup/toolchains/miri/lib/rustlib/src/rust/library/core/src/ptr/const_ptr.rs:295:18
6+
= note: inside `std::ptr::const_ptr::<impl *const i8>::offset` at rustc_src/src/ptr/const_ptr.rs:295:18
117
note: inside `main` at $DIR/out_of_bounds_ptr_2.rs:5:22
128
--> $DIR/out_of_bounds_ptr_2.rs:5:22
139
|

tests/compile-fail/intrinsics/out_of_bounds_ptr_3.stderr

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
11
error: Undefined Behavior: pointer arithmetic failed: alloc956 has size 4, so pointer to 1 byte starting at offset -1 is out-of-bounds
2-
--> /home/ubuntu/.rustup/toolchains/miri/lib/rustlib/src/rust/library/core/src/ptr/const_ptr.rs:295:18
3-
|
4-
LL | unsafe { intrinsics::offset(self, count) }
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pointer arithmetic failed: alloc956 has size 4, so pointer to 1 byte starting at offset -1 is out-of-bounds
62
|
73
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
84
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
95

10-
= note: inside `std::ptr::const_ptr::<impl *const i8>::offset` at /home/ubuntu/.rustup/toolchains/miri/lib/rustlib/src/rust/library/core/src/ptr/const_ptr.rs:295:18
6+
= note: inside `std::ptr::const_ptr::<impl *const i8>::offset` at rustc_src/src/ptr/const_ptr.rs:295:18
117
note: inside `main` at $DIR/out_of_bounds_ptr_3.rs:5:22
128
--> $DIR/out_of_bounds_ptr_3.rs:5:22
139
|

tests/compile-fail/intrinsics/ptr_offset_0_plus_0.stderr

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
11
error: Undefined Behavior: pointer arithmetic failed: null pointer is not a valid pointer
2-
--> /home/ubuntu/.rustup/toolchains/miri/lib/rustlib/src/rust/library/core/src/ptr/mut_ptr.rs:307:18
3-
|
4-
LL | unsafe { intrinsics::offset(self, count) as *mut T }
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pointer arithmetic failed: null pointer is not a valid pointer
62
|
73
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
84
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
95

10-
= note: inside `std::ptr::mut_ptr::<impl *mut i32>::offset` at /home/ubuntu/.rustup/toolchains/miri/lib/rustlib/src/rust/library/core/src/ptr/mut_ptr.rs:307:18
6+
= note: inside `std::ptr::mut_ptr::<impl *mut i32>::offset` at rustc_src/src/ptr/mut_ptr.rs:307:18
117
note: inside `main` at $DIR/ptr_offset_0_plus_0.rs:6:23
128
--> $DIR/ptr_offset_0_plus_0.rs:6:23
139
|

0 commit comments

Comments
 (0)