Skip to content

Commit

Permalink
Auto merge of #130303 - Zalathar:rollup-8vsqdox, r=Zalathar
Browse files Browse the repository at this point in the history
Rollup of 3 pull requests

Successful merges:

 - #130245 (make basic allocation functions track_caller in Miri for nicer backtraces)
 - #130261 (skip target sanity check when it's a `local-rebuild`)
 - #130287 (rustdoc: rename `issue-\d+.rs` tests to have meaningful names (part 9))

r? `@ghost`
`@rustbot` modify labels: rollup
  • Loading branch information
bors committed Sep 13, 2024
2 parents b2f11d6 + 144f401 commit 30e8618
Show file tree
Hide file tree
Showing 26 changed files with 65 additions and 156 deletions.
4 changes: 1 addition & 3 deletions tests/fail/alloc/deallocate-bad-alignment.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
use std::alloc::{alloc, dealloc, Layout};

//@error-in-other-file: has size 1 and alignment 1, but gave size 1 and alignment 2

fn main() {
unsafe {
let x = alloc(Layout::from_size_align_unchecked(1, 1));
dealloc(x, Layout::from_size_align_unchecked(1, 2));
dealloc(x, Layout::from_size_align_unchecked(1, 2)); //~ERROR: has size 1 and alignment 1, but gave size 1 and alignment 2
}
}
13 changes: 4 additions & 9 deletions tests/fail/alloc/deallocate-bad-alignment.stderr
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
error: Undefined Behavior: incorrect layout on deallocation: ALLOC has size 1 and alignment ALIGN, but gave size 1 and alignment ALIGN
--> RUSTLIB/alloc/src/alloc.rs:LL:CC
--> $DIR/deallocate-bad-alignment.rs:LL:CC
|
LL | unsafe { __rust_dealloc(ptr, layout.size(), layout.align()) }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ incorrect layout on deallocation: ALLOC has size 1 and alignment ALIGN, but gave size 1 and alignment ALIGN
LL | dealloc(x, Layout::from_size_align_unchecked(1, 2));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ incorrect layout on deallocation: ALLOC has size 1 and alignment ALIGN, but gave size 1 and alignment ALIGN
|
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
= note: BACKTRACE:
= note: inside `std::alloc::dealloc` at RUSTLIB/alloc/src/alloc.rs:LL:CC
note: inside `main`
--> $DIR/deallocate-bad-alignment.rs:LL:CC
|
LL | dealloc(x, Layout::from_size_align_unchecked(1, 2));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: inside `main` at $DIR/deallocate-bad-alignment.rs:LL:CC

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

Expand Down
4 changes: 1 addition & 3 deletions tests/fail/alloc/deallocate-bad-size.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
use std::alloc::{alloc, dealloc, Layout};

//@error-in-other-file: has size 1 and alignment 1, but gave size 2 and alignment 1

fn main() {
unsafe {
let x = alloc(Layout::from_size_align_unchecked(1, 1));
dealloc(x, Layout::from_size_align_unchecked(2, 1));
dealloc(x, Layout::from_size_align_unchecked(2, 1)); //~ERROR: has size 1 and alignment 1, but gave size 2 and alignment 1
}
}
13 changes: 4 additions & 9 deletions tests/fail/alloc/deallocate-bad-size.stderr
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
error: Undefined Behavior: incorrect layout on deallocation: ALLOC has size 1 and alignment ALIGN, but gave size 2 and alignment ALIGN
--> RUSTLIB/alloc/src/alloc.rs:LL:CC
--> $DIR/deallocate-bad-size.rs:LL:CC
|
LL | unsafe { __rust_dealloc(ptr, layout.size(), layout.align()) }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ incorrect layout on deallocation: ALLOC has size 1 and alignment ALIGN, but gave size 2 and alignment ALIGN
LL | dealloc(x, Layout::from_size_align_unchecked(2, 1));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ incorrect layout on deallocation: ALLOC has size 1 and alignment ALIGN, but gave size 2 and alignment ALIGN
|
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
= note: BACKTRACE:
= note: inside `std::alloc::dealloc` at RUSTLIB/alloc/src/alloc.rs:LL:CC
note: inside `main`
--> $DIR/deallocate-bad-size.rs:LL:CC
|
LL | dealloc(x, Layout::from_size_align_unchecked(2, 1));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: inside `main` at $DIR/deallocate-bad-size.rs:LL:CC

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

Expand Down
4 changes: 1 addition & 3 deletions tests/fail/alloc/deallocate-twice.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
use std::alloc::{alloc, dealloc, Layout};

//@error-in-other-file: has been freed

fn main() {
unsafe {
let x = alloc(Layout::from_size_align_unchecked(1, 1));
dealloc(x, Layout::from_size_align_unchecked(1, 1));
dealloc(x, Layout::from_size_align_unchecked(1, 1));
dealloc(x, Layout::from_size_align_unchecked(1, 1)); //~ERROR: has been freed
}
}
13 changes: 4 additions & 9 deletions tests/fail/alloc/deallocate-twice.stderr
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
error: Undefined Behavior: memory access failed: ALLOC has been freed, so this pointer is dangling
--> RUSTLIB/alloc/src/alloc.rs:LL:CC
--> $DIR/deallocate-twice.rs:LL:CC
|
LL | unsafe { __rust_dealloc(ptr, layout.size(), layout.align()) }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ memory access failed: ALLOC has been freed, so this pointer is dangling
LL | dealloc(x, Layout::from_size_align_unchecked(1, 1));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ memory access failed: ALLOC has been freed, so this pointer is dangling
|
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
Expand All @@ -17,12 +17,7 @@ help: ALLOC was deallocated here:
LL | dealloc(x, Layout::from_size_align_unchecked(1, 1));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: BACKTRACE (of the first span):
= note: inside `std::alloc::dealloc` at RUSTLIB/alloc/src/alloc.rs:LL:CC
note: inside `main`
--> $DIR/deallocate-twice.rs:LL:CC
|
LL | dealloc(x, Layout::from_size_align_unchecked(1, 1));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: inside `main` at $DIR/deallocate-twice.rs:LL:CC

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

Expand Down
4 changes: 1 addition & 3 deletions tests/fail/alloc/reallocate-bad-size.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
use std::alloc::{alloc, realloc, Layout};

//@error-in-other-file: has size 1 and alignment 1, but gave size 2 and alignment 1

fn main() {
unsafe {
let x = alloc(Layout::from_size_align_unchecked(1, 1));
let _y = realloc(x, Layout::from_size_align_unchecked(2, 1), 1);
let _y = realloc(x, Layout::from_size_align_unchecked(2, 1), 1); //~ERROR: has size 1 and alignment 1, but gave size 2 and alignment 1
}
}
13 changes: 4 additions & 9 deletions tests/fail/alloc/reallocate-bad-size.stderr
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
error: Undefined Behavior: incorrect layout on deallocation: ALLOC has size 1 and alignment ALIGN, but gave size 2 and alignment ALIGN
--> RUSTLIB/alloc/src/alloc.rs:LL:CC
--> $DIR/reallocate-bad-size.rs:LL:CC
|
LL | unsafe { __rust_realloc(ptr, layout.size(), layout.align(), new_size) }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ incorrect layout on deallocation: ALLOC has size 1 and alignment ALIGN, but gave size 2 and alignment ALIGN
LL | let _y = realloc(x, Layout::from_size_align_unchecked(2, 1), 1);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ incorrect layout on deallocation: ALLOC has size 1 and alignment ALIGN, but gave size 2 and alignment ALIGN
|
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
= note: BACKTRACE:
= note: inside `std::alloc::realloc` at RUSTLIB/alloc/src/alloc.rs:LL:CC
note: inside `main`
--> $DIR/reallocate-bad-size.rs:LL:CC
|
LL | let _y = realloc(x, Layout::from_size_align_unchecked(2, 1), 1);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: inside `main` at $DIR/reallocate-bad-size.rs:LL:CC

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

Expand Down
4 changes: 1 addition & 3 deletions tests/fail/alloc/reallocate-dangling.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
use std::alloc::{alloc, dealloc, realloc, Layout};

//@error-in-other-file: has been freed

fn main() {
unsafe {
let x = alloc(Layout::from_size_align_unchecked(1, 1));
dealloc(x, Layout::from_size_align_unchecked(1, 1));
let _z = realloc(x, Layout::from_size_align_unchecked(1, 1), 1);
let _z = realloc(x, Layout::from_size_align_unchecked(1, 1), 1); //~ERROR: has been freed
}
}
13 changes: 4 additions & 9 deletions tests/fail/alloc/reallocate-dangling.stderr
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
error: Undefined Behavior: memory access failed: ALLOC has been freed, so this pointer is dangling
--> RUSTLIB/alloc/src/alloc.rs:LL:CC
--> $DIR/reallocate-dangling.rs:LL:CC
|
LL | unsafe { __rust_realloc(ptr, layout.size(), layout.align(), new_size) }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ memory access failed: ALLOC has been freed, so this pointer is dangling
LL | let _z = realloc(x, Layout::from_size_align_unchecked(1, 1), 1);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ memory access failed: ALLOC has been freed, so this pointer is dangling
|
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
Expand All @@ -17,12 +17,7 @@ help: ALLOC was deallocated here:
LL | dealloc(x, Layout::from_size_align_unchecked(1, 1));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: BACKTRACE (of the first span):
= note: inside `std::alloc::realloc` at RUSTLIB/alloc/src/alloc.rs:LL:CC
note: inside `main`
--> $DIR/reallocate-dangling.rs:LL:CC
|
LL | let _z = realloc(x, Layout::from_size_align_unchecked(1, 1), 1);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: inside `main` at $DIR/reallocate-dangling.rs:LL:CC

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

Expand Down
8 changes: 3 additions & 5 deletions tests/fail/alloc/stack_free.stderr
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
error: Undefined Behavior: deallocating ALLOC, which is stack variable memory, using Rust heap deallocation operation
--> RUSTLIB/alloc/src/alloc.rs:LL:CC
--> RUSTLIB/alloc/src/boxed.rs:LL:CC
|
LL | unsafe { __rust_dealloc(ptr, layout.size(), layout.align()) }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ deallocating ALLOC, which is stack variable memory, using Rust heap deallocation operation
LL | self.1.deallocate(From::from(ptr.cast()), layout);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ deallocating ALLOC, which is stack variable memory, using Rust heap deallocation operation
|
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
= note: BACKTRACE:
= note: inside `std::alloc::dealloc` at RUSTLIB/alloc/src/alloc.rs:LL:CC
= note: inside `<std::alloc::Global as std::alloc::Allocator>::deallocate` at RUSTLIB/alloc/src/alloc.rs:LL:CC
= note: inside `<std::boxed::Box<i32> as std::ops::Drop>::drop` at RUSTLIB/alloc/src/boxed.rs:LL:CC
= note: inside `std::ptr::drop_in_place::<std::boxed::Box<i32>> - shim(Some(std::boxed::Box<i32>))` at RUSTLIB/core/src/ptr/mod.rs:LL:CC
= note: inside `std::mem::drop::<std::boxed::Box<i32>>` at RUSTLIB/core/src/mem/mod.rs:LL:CC
Expand Down
8 changes: 3 additions & 5 deletions tests/fail/both_borrows/newtype_pair_retagging.tree.stderr
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
error: Undefined Behavior: deallocation through <TAG> at ALLOC[0x0] is forbidden
--> RUSTLIB/alloc/src/alloc.rs:LL:CC
--> RUSTLIB/alloc/src/boxed.rs:LL:CC
|
LL | unsafe { __rust_dealloc(ptr, layout.size(), layout.align()) }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ deallocation through <TAG> at ALLOC[0x0] is forbidden
LL | self.1.deallocate(From::from(ptr.cast()), layout);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ deallocation through <TAG> at ALLOC[0x0] is forbidden
|
= help: this indicates a potential bug in the program: it performed an invalid operation, but the Tree Borrows rules it violated are still experimental
= help: the accessed tag <TAG> is foreign to the protected tag <TAG> (i.e., it is not a child)
Expand All @@ -25,8 +25,6 @@ LL | || drop(Box::from_raw(ptr)),
| ^^^^^^^^^^^^^^^^^^
= help: this transition corresponds to a temporary loss of write permissions until function exit
= note: BACKTRACE (of the first span):
= note: inside `std::alloc::dealloc` at RUSTLIB/alloc/src/alloc.rs:LL:CC
= note: inside `<std::alloc::Global as std::alloc::Allocator>::deallocate` at RUSTLIB/alloc/src/alloc.rs:LL:CC
= note: inside `<std::boxed::Box<i32> as std::ops::Drop>::drop` at RUSTLIB/alloc/src/boxed.rs:LL:CC
= note: inside `std::ptr::drop_in_place::<std::boxed::Box<i32>> - shim(Some(std::boxed::Box<i32>))` at RUSTLIB/core/src/ptr/mod.rs:LL:CC
= note: inside `std::mem::drop::<std::boxed::Box<i32>>` at RUSTLIB/core/src/mem/mod.rs:LL:CC
Expand Down
8 changes: 3 additions & 5 deletions tests/fail/both_borrows/newtype_retagging.tree.stderr
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
error: Undefined Behavior: deallocation through <TAG> at ALLOC[0x0] is forbidden
--> RUSTLIB/alloc/src/alloc.rs:LL:CC
--> RUSTLIB/alloc/src/boxed.rs:LL:CC
|
LL | unsafe { __rust_dealloc(ptr, layout.size(), layout.align()) }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ deallocation through <TAG> at ALLOC[0x0] is forbidden
LL | self.1.deallocate(From::from(ptr.cast()), layout);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ deallocation through <TAG> at ALLOC[0x0] is forbidden
|
= help: this indicates a potential bug in the program: it performed an invalid operation, but the Tree Borrows rules it violated are still experimental
= help: the accessed tag <TAG> is foreign to the protected tag <TAG> (i.e., it is not a child)
Expand All @@ -25,8 +25,6 @@ LL | || drop(Box::from_raw(ptr)),
| ^^^^^^^^^^^^^^^^^^
= help: this transition corresponds to a temporary loss of write permissions until function exit
= note: BACKTRACE (of the first span):
= note: inside `std::alloc::dealloc` at RUSTLIB/alloc/src/alloc.rs:LL:CC
= note: inside `<std::alloc::Global as std::alloc::Allocator>::deallocate` at RUSTLIB/alloc/src/alloc.rs:LL:CC
= note: inside `<std::boxed::Box<i32> as std::ops::Drop>::drop` at RUSTLIB/alloc/src/boxed.rs:LL:CC
= note: inside `std::ptr::drop_in_place::<std::boxed::Box<i32>> - shim(Some(std::boxed::Box<i32>))` at RUSTLIB/core/src/ptr/mod.rs:LL:CC
= note: inside `std::mem::drop::<std::boxed::Box<i32>>` at RUSTLIB/core/src/mem/mod.rs:LL:CC
Expand Down
3 changes: 1 addition & 2 deletions tests/fail/both_borrows/zero-sized-protected.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
//@revisions: stack tree
//@[tree]compile-flags: -Zmiri-tree-borrows
//@[tree]error-in-other-file: /deallocation .* is forbidden/
use std::alloc::{alloc, dealloc, Layout};

// `x` is strongly protected but covers zero bytes.
// Let's see if deallocating the allocation x points to is UB:
// in TB, it is UB, but in SB it is not.
fn test(_x: &mut (), ptr: *mut u8, l: Layout) {
unsafe { dealloc(ptr, l) };
unsafe { dealloc(ptr, l) }; //~[tree] ERROR: /deallocation .* is forbidden/
}

fn main() {
Expand Down
13 changes: 4 additions & 9 deletions tests/fail/both_borrows/zero-sized-protected.tree.stderr
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
error: Undefined Behavior: deallocation through <TAG> (root of the allocation) at ALLOC[0x0] is forbidden
--> RUSTLIB/alloc/src/alloc.rs:LL:CC
--> $DIR/zero-sized-protected.rs:LL:CC
|
LL | unsafe { __rust_dealloc(ptr, layout.size(), layout.align()) }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ deallocation through <TAG> (root of the allocation) at ALLOC[0x0] is forbidden
LL | unsafe { dealloc(ptr, l) };
| ^^^^^^^^^^^^^^^ deallocation through <TAG> (root of the allocation) at ALLOC[0x0] is forbidden
|
= help: this indicates a potential bug in the program: it performed an invalid operation, but the Tree Borrows rules it violated are still experimental
= help: the allocation of the accessed tag <TAG> (root of the allocation) also contains the strongly protected tag <TAG>
Expand All @@ -18,12 +18,7 @@ help: the strongly protected tag <TAG> was created here, in the initial state Re
LL | fn test(_x: &mut (), ptr: *mut u8, l: Layout) {
| ^^
= note: BACKTRACE (of the first span):
= note: inside `std::alloc::dealloc` at RUSTLIB/alloc/src/alloc.rs:LL:CC
note: inside `test`
--> $DIR/zero-sized-protected.rs:LL:CC
|
LL | unsafe { dealloc(ptr, l) };
| ^^^^^^^^^^^^^^^
= note: inside `test` at $DIR/zero-sized-protected.rs:LL:CC
note: inside `main`
--> $DIR/zero-sized-protected.rs:LL:CC
|
Expand Down
3 changes: 1 addition & 2 deletions tests/fail/memleak.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
//@error-in-other-file: memory leaked
//@normalize-stderr-test: ".*│.*" -> "$$stripped$$"

fn main() {
std::mem::forget(Box::new(42));
std::mem::forget(Box::new(42)); //~ERROR: memory leaked
}
15 changes: 3 additions & 12 deletions tests/fail/memleak.stderr
Original file line number Diff line number Diff line change
@@ -1,20 +1,11 @@
error: memory leaked: ALLOC (Rust heap, size: 4, align: 4), allocated here:
--> RUSTLIB/alloc/src/alloc.rs:LL:CC
|
LL | __rust_alloc(layout.size(), layout.align())
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: BACKTRACE:
= note: inside `std::alloc::alloc` at RUSTLIB/alloc/src/alloc.rs:LL:CC
= note: inside `std::alloc::Global::alloc_impl` at RUSTLIB/alloc/src/alloc.rs:LL:CC
= note: inside `<std::alloc::Global as std::alloc::Allocator>::allocate` at RUSTLIB/alloc/src/alloc.rs:LL:CC
= note: inside `alloc::alloc::exchange_malloc` at RUSTLIB/alloc/src/alloc.rs:LL:CC
= note: inside `std::boxed::Box::<i32>::new` at RUSTLIB/alloc/src/boxed.rs:LL:CC
note: inside `main`
--> $DIR/memleak.rs:LL:CC
|
LL | std::mem::forget(Box::new(42));
| ^^^^^^^^^^^^
|
= note: BACKTRACE:
= note: inside `main` at $DIR/memleak.rs:LL:CC

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

Expand Down
11 changes: 3 additions & 8 deletions tests/fail/memleak_rc.stderr
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
error: memory leaked: ALLOC (Rust heap, SIZE, ALIGN), allocated here:
--> RUSTLIB/alloc/src/alloc.rs:LL:CC
--> RUSTLIB/alloc/src/rc.rs:LL:CC
|
LL | __rust_alloc(layout.size(), layout.align())
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL | Box::leak(Box::new(RcBox { strong: Cell::new(1), weak: Cell::new(1), value }))
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: BACKTRACE:
= note: inside `std::alloc::alloc` at RUSTLIB/alloc/src/alloc.rs:LL:CC
= note: inside `std::alloc::Global::alloc_impl` at RUSTLIB/alloc/src/alloc.rs:LL:CC
= note: inside `<std::alloc::Global as std::alloc::Allocator>::allocate` at RUSTLIB/alloc/src/alloc.rs:LL:CC
= note: inside `alloc::alloc::exchange_malloc` at RUSTLIB/alloc/src/alloc.rs:LL:CC
= note: inside `std::boxed::Box::<std::rc::RcBox<std::cell::RefCell<std::option::Option<Dummy>>>>::new` at RUSTLIB/alloc/src/boxed.rs:LL:CC
= note: inside `std::rc::Rc::<std::cell::RefCell<std::option::Option<Dummy>>>::new` at RUSTLIB/alloc/src/rc.rs:LL:CC
note: inside `main`
--> $DIR/memleak_rc.rs:LL:CC
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
error: Undefined Behavior: deallocating while item [Unique for <TAG>] is strongly protected
--> RUSTLIB/alloc/src/alloc.rs:LL:CC
--> RUSTLIB/alloc/src/boxed.rs:LL:CC
|
LL | unsafe { __rust_dealloc(ptr, layout.size(), layout.align()) }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ deallocating while item [Unique for <TAG>] is strongly protected
LL | self.1.deallocate(From::from(ptr.cast()), layout);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ deallocating while item [Unique for <TAG>] is strongly protected
|
= help: this indicates a potential bug in the program: it performed an invalid operation, but the Stacked Borrows rules it violated are still experimental
= help: see https://github.com/rust-lang/unsafe-code-guidelines/blob/master/wip/stacked-borrows.md for further information
= note: BACKTRACE:
= note: inside `std::alloc::dealloc` at RUSTLIB/alloc/src/alloc.rs:LL:CC
= note: inside `<std::alloc::Global as std::alloc::Allocator>::deallocate` at RUSTLIB/alloc/src/alloc.rs:LL:CC
= note: inside `<std::boxed::Box<i32> as std::ops::Drop>::drop` at RUSTLIB/alloc/src/boxed.rs:LL:CC
= note: inside `std::ptr::drop_in_place::<std::boxed::Box<i32>> - shim(Some(std::boxed::Box<i32>))` at RUSTLIB/core/src/ptr/mod.rs:LL:CC
= note: inside `std::mem::drop::<std::boxed::Box<i32>>` at RUSTLIB/core/src/mem/mod.rs:LL:CC
Expand Down
Loading

0 comments on commit 30e8618

Please sign in to comment.