test raw pointer tracking; we cannot track raw pointers on Windows

This commit is contained in:
Ralf Jung 2020-10-28 13:50:27 +01:00
parent 70af7aed88
commit bf54607ba0
5 changed files with 15 additions and 3 deletions

View file

@ -0,0 +1,13 @@
// compile-flags: -Zmiri-track-raw-pointers
// ignore-windows (FIXME: tracking raw pointers does not work on Windows)
//! This demonstrates a provenance problem that requires tracking of raw pointers to be detected.
fn main() {
let mut l = 13;
let raw1 = &mut l as *mut _;
let raw2 = &mut l as *mut _; // invalidates raw1
// Without raw pointer tracking, Stacked Borrows cannot distinguish raw1 and raw2, and thus
// fails to realize that raw1 should not be used any more.
unsafe { *raw1 = 13; } //~ ERROR no item granting write access to tag
unsafe { *raw2 = 13; }
}

View file

@ -1,5 +1,3 @@
// compile-flags: -Zmiri-track-raw-pointers
fn main() {
println!("Hello {}", 13);
println!("{:0<width$}", "hello", width = 10);

View file

@ -1,4 +1,3 @@
// compile-flags: -Zmiri-track-raw-pointers
#![feature(new_uninit)]
use std::slice;

View file

@ -1,4 +1,5 @@
// compile-flags: -Zmiri-track-raw-pointers
// ignore-windows (FIXME: tracking raw pointers does not work on Windows)
// Gather all references from a mutable iterator and make sure Miri notices if
// using them is dangerous.
fn test_all_refs<'a, T: 'a>(dummy: &mut T, iter: impl Iterator<Item = &'a mut T>) {

View file

@ -1,4 +1,5 @@
// compile-flags: -Zmiri-track-raw-pointers
// ignore-windows (FIXME: tracking raw pointers does not work on Windows)
use std::collections::VecDeque;
fn test_all_refs<'a, T: 'a>(dummy: &mut T, iter: impl Iterator<Item = &'a mut T>) {