Skip to content

Commit 1a41ce6

Browse files
committed
Merge remote-tracking branch 'origin/master' into stacked-borrows-2-phase
2 parents 61f2076 + 173ad36 commit 1a41ce6

20 files changed

+14
-54
lines changed

tests/compile-fail-fullmir/stacked_borrows/alias_through_mutation.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#![allow(unused_variables)]
2-
31
// This makes a ref that was passed to us via &mut alias with things it should not alias with
42
fn retarget(x: &mut &u32, target: &mut u32) {
53
unsafe { *x = &mut *(target as *mut _); }

tests/compile-fail-fullmir/stacked_borrows/aliasing_mut1.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
#![allow(unused_variables)]
2-
31
use std::mem;
42

5-
pub fn safe(x: &mut i32, y: &mut i32) {} //~ ERROR barrier
3+
pub fn safe(_x: &mut i32, _y: &mut i32) {} //~ ERROR barrier
64

75
fn main() {
86
let mut x = 0;

tests/compile-fail-fullmir/stacked_borrows/aliasing_mut2.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
#![allow(unused_variables)]
2-
31
use std::mem;
42

5-
pub fn safe(x: &i32, y: &mut i32) {} //~ ERROR barrier
3+
pub fn safe(_x: &i32, _y: &mut i32) {} //~ ERROR barrier
64

75
fn main() {
86
let mut x = 0;

tests/compile-fail-fullmir/stacked_borrows/aliasing_mut3.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
#![allow(unused_variables)]
2-
31
use std::mem;
42

5-
pub fn safe(x: &mut i32, y: &i32) {} //~ ERROR does not exist on the stack
3+
pub fn safe(_x: &mut i32, _y: &i32) {} //~ ERROR does not exist on the stack
64

75
fn main() {
86
let mut x = 0;

tests/compile-fail-fullmir/stacked_borrows/aliasing_mut4.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
#![allow(unused_variables)]
2-
31
use std::mem;
42
use std::cell::Cell;
53

64
// Make sure &mut UnsafeCell also is exclusive
7-
pub fn safe(x: &i32, y: &mut Cell<i32>) {} //~ ERROR barrier
5+
pub fn safe(_x: &i32, _y: &mut Cell<i32>) {} //~ ERROR barrier
86

97
fn main() {
108
let mut x = 0;

tests/compile-fail-fullmir/stacked_borrows/buggy_split_at_mut.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#![allow(unused_variables)]
2-
31
mod safe {
42
use std::slice::from_raw_parts_mut;
53

tests/compile-fail-fullmir/stacked_borrows/illegal_write2.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
1-
// We fail to detect this when neither this nor libstd are optimized/have retagging.
2-
// FIXME: Investigate that.
3-
// compile-flags: -Zmir-opt-level=0
4-
5-
#![allow(unused_variables)]
6-
71
fn main() {
82
let target = &mut 42;
93
let target2 = target as *mut _;

tests/compile-fail-fullmir/stacked_borrows/pointer_smuggling.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#![allow(unused_variables)]
2-
31
static mut PTR: *mut u8 = 0 as *mut _;
42

53
fn fun1(x: &mut u8) {
@@ -14,7 +12,8 @@ fn fun2() {
1412
}
1513

1614
fn main() {
17-
let val = &mut 0; // FIXME: This should also work with a local variable, but currently it does not.
15+
let mut val = 0;
16+
let val = &mut val;
1817
fun1(val);
1918
*val = 2; // this invalidates any raw ptrs `fun1` might have created.
2019
fun2(); // if they now use a raw ptr they break our reference

tests/compile-fail/never_transmute_humans.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,12 @@
22
// compile-flags: -Zmiri-disable-validation
33

44
#![feature(never_type)]
5-
#![allow(unreachable_code)]
6-
#![allow(unused_variables)]
75

86
struct Human;
97

108
fn main() {
11-
let x: ! = unsafe {
9+
let _x: ! = unsafe {
1210
std::mem::transmute::<Human, !>(Human) //~ ERROR constant evaluation error
1311
//^~ NOTE entered unreachable code
1412
};
15-
f(x)
1613
}
17-
18-
fn f(x: !) -> ! { x }

tests/compile-fail/never_transmute_void.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
// compile-flags: -Zmiri-disable-validation
33

44
#![feature(never_type)]
5-
#![allow(unreachable_code)]
6-
#![allow(unused_variables)]
75

86
enum Void {}
97

0 commit comments

Comments
 (0)