-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
miri-unleashed: test that we detect heap allocations
- Loading branch information
Showing
3 changed files
with
29 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// compile-flags: -Zunleash-the-miri-inside-of-you | ||
#![feature(const_mut_refs, box_syntax)] | ||
#![deny(const_err)] | ||
|
||
use std::mem::ManuallyDrop; | ||
|
||
fn main() {} | ||
|
||
static TEST_BAD: &mut i32 = { | ||
&mut *(box 0) | ||
//~^ WARN skipping const check | ||
//~| ERROR could not evaluate static initializer | ||
//~| NOTE heap allocations | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
warning: skipping const checks | ||
--> $DIR/box.rs:10:11 | ||
| | ||
LL | &mut *(box 0) | ||
| ^^^^^^^ | ||
|
||
error[E0080]: could not evaluate static initializer | ||
--> $DIR/box.rs:10:11 | ||
| | ||
LL | &mut *(box 0) | ||
| ^^^^^^^ "heap allocations via `box` keyword" needs an rfc before being allowed inside constants | ||
|
||
error: aborting due to previous error; 1 warning emitted | ||
|
||
For more information about this error, try `rustc --explain E0080`. |