mirror of
https://github.com/rust-lang/rust.git
synced 2026-06-02 06:28:20 +03:00
test the memory limit
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
#![feature(custom_attribute)]
|
||||
#![miri(memory_size="0")]
|
||||
|
||||
fn bar() {
|
||||
let x = 5;
|
||||
assert_eq!(x, 6);
|
||||
}
|
||||
|
||||
fn main() { //~ ERROR tried to allocate 4 more bytes, but only 0 bytes are free of the 0 byte memory
|
||||
bar();
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
#![feature(custom_attribute)]
|
||||
#![miri(memory_size="1000")]
|
||||
|
||||
fn bar(i: i32) {
|
||||
if i < 1000 {
|
||||
bar(i + 1) //~ ERROR tried to allocate 4 more bytes, but only 1 bytes are free of the 1000 byte memory
|
||||
//~^NOTE inside call to bar
|
||||
//~|NOTE inside call to bar
|
||||
//~|NOTE inside call to bar
|
||||
//~|NOTE inside call to bar
|
||||
//~|NOTE inside call to bar
|
||||
//~|NOTE inside call to bar
|
||||
//~|NOTE inside call to bar
|
||||
//~|NOTE inside call to bar
|
||||
//~|NOTE inside call to bar
|
||||
//~|NOTE inside call to bar
|
||||
//~|NOTE inside call to bar
|
||||
//~|NOTE inside call to bar
|
||||
//~|NOTE inside call to bar
|
||||
//~|NOTE inside call to bar
|
||||
//~|NOTE inside call to bar
|
||||
//~|NOTE inside call to bar
|
||||
//~|NOTE inside call to bar
|
||||
//~|NOTE inside call to bar
|
||||
//~|NOTE inside call to bar
|
||||
//~|NOTE inside call to bar
|
||||
//~|NOTE inside call to bar
|
||||
//~|NOTE inside call to bar
|
||||
//~|NOTE inside call to bar
|
||||
//~|NOTE inside call to bar
|
||||
//~|NOTE inside call to bar
|
||||
//~|NOTE inside call to bar
|
||||
}
|
||||
}
|
||||
|
||||
fn main() { //~NOTE inside call to main
|
||||
bar(1);
|
||||
//~^NOTE inside call to bar
|
||||
}
|
||||
Reference in New Issue
Block a user