mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-31 21:47:15 +03:00
test raw pointer tracking; we cannot track raw pointers on Windows
This commit is contained in:
@@ -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; }
|
||||
}
|
||||
@@ -1,5 +1,3 @@
|
||||
// compile-flags: -Zmiri-track-raw-pointers
|
||||
|
||||
fn main() {
|
||||
println!("Hello {}", 13);
|
||||
println!("{:0<width$}", "hello", width = 10);
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// compile-flags: -Zmiri-track-raw-pointers
|
||||
#![feature(new_uninit)]
|
||||
|
||||
use std::slice;
|
||||
|
||||
@@ -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>) {
|
||||
|
||||
@@ -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>) {
|
||||
|
||||
Reference in New Issue
Block a user