-
Notifications
You must be signed in to change notification settings - Fork 13.7k
Closed
rust-lang/cargo
#7535Closed
Copy link
Labels
A-testsuiteArea: The testsuite used to check the correctness of rustcArea: The testsuite used to check the correctness of rustcC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.
Description
Consider the following code:
fn main() {
use std::alloc::{alloc, dealloc, Layout};
unsafe {
let ptr = alloc(Layout::from_size_align(4096, 4096).unwrap());
dealloc(ptr, Layout::from_size_align(4096, 1).unwrap());
}
}
Yes, it breaks the invariants for dealloc, and yes, it crashes on Windows, with:
error: process didn't exit successfully: `target/debug/foo.exe` (exit code: 0xc0000374, STATUS_HEAP_CORRUPTION)
The problem is that when that happens in a test, the test just fails in a completely non-useful manner. (just switch to a lib crate, rename the function and add #[test]
).
The test fails with:
running 1 test
error: test failed, to rerun pass '--lib'
And nothing else.
When the crate happens to have other tests, some other tests, but not all, will show test foo... ok
, then the same error.
Metadata
Metadata
Assignees
Labels
A-testsuiteArea: The testsuite used to check the correctness of rustcArea: The testsuite used to check the correctness of rustcC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.