]> git.lizzy.rs Git - rust.git/commitdiff
be more clear which stack we are talking about
authorRalf Jung <post@ralfj.de>
Tue, 12 Feb 2019 09:51:03 +0000 (10:51 +0100)
committerRalf Jung <post@ralfj.de>
Tue, 12 Feb 2019 09:51:03 +0000 (10:51 +0100)
23 files changed:
src/stacked_borrows.rs
tests/compile-fail/stacked_borrows/alias_through_mutation.rs
tests/compile-fail/stacked_borrows/aliasing_mut3.rs
tests/compile-fail/stacked_borrows/box_exclusive_violation1.rs
tests/compile-fail/stacked_borrows/buggy_as_mut_slice.rs
tests/compile-fail/stacked_borrows/buggy_split_at_mut.rs
tests/compile-fail/stacked_borrows/illegal_read1.rs
tests/compile-fail/stacked_borrows/illegal_read2.rs
tests/compile-fail/stacked_borrows/illegal_read3.rs
tests/compile-fail/stacked_borrows/illegal_read4.rs
tests/compile-fail/stacked_borrows/illegal_read5.rs
tests/compile-fail/stacked_borrows/illegal_write2.rs
tests/compile-fail/stacked_borrows/illegal_write3.rs
tests/compile-fail/stacked_borrows/illegal_write5.rs
tests/compile-fail/stacked_borrows/load_invalid_mut.rs
tests/compile-fail/stacked_borrows/outdated_local.rs
tests/compile-fail/stacked_borrows/pass_invalid_mut.rs
tests/compile-fail/stacked_borrows/pointer_smuggling.rs
tests/compile-fail/stacked_borrows/return_invalid_mut.rs
tests/compile-fail/stacked_borrows/return_invalid_mut_option.rs
tests/compile-fail/stacked_borrows/return_invalid_mut_tuple.rs
tests/compile-fail/stacked_borrows/transmute-is-no-escape.rs
tests/compile-fail/stacked_borrows/unescaped_local.rs

index 1fc705c03bb5e30c06a5ea0537b0b6aa150f4e07..be4a607961f3e5a8b493ac7ea1d983e6447a5805 100644 (file)
@@ -221,7 +221,7 @@ fn deref(
             }
         }
         // If we got here, we did not find our item.  We have to error to satisfy U3.
-        Err(format!("Borrow being dereferenced ({:?}) does not exist on the stack", bor))
+        Err(format!("Borrow being dereferenced ({:?}) does not exist on the borrow stack", bor))
     }
 
     /// Perform an actual memory access using `bor`.  We do not know any types here
@@ -294,7 +294,7 @@ fn access(
         }
         // If we got here, we did not find our item.
         err!(MachineError(format!(
-            "Borrow being accessed ({:?}) does not exist on the stack",
+            "Borrow being accessed ({:?}) does not exist on the borrow stack",
             bor
         )))
     }
index db9ac93279f15983d29c00112c1812d24af88cee..30f5921202c3ffb02b76fc126ee06bf03fcf21da 100644 (file)
@@ -9,5 +9,5 @@ fn main() {
     retarget(&mut target_alias, target);
     // now `target_alias` points to the same thing as `target`
     *target = 13;
-    let _val = *target_alias; //~ ERROR does not exist on the stack
+    let _val = *target_alias; //~ ERROR does not exist on the borrow stack
 }
index e564e878ddb19f7857da287901cd518e01aca368..e3c59d1566142f6255dea8ea5addf2316564ea82 100644 (file)
@@ -1,6 +1,6 @@
 use std::mem;
 
-pub fn safe(_x: &mut i32, _y: &i32) {} //~ ERROR does not exist on the stack
+pub fn safe(_x: &mut i32, _y: &i32) {} //~ ERROR does not exist on the borrow stack
 
 fn main() {
     let mut x = 0;
index bd0fec859d8f7c424a677f8f1120fd635b8a97bf..481915faed0401260af9e9a76a0004b1bbc250ac 100644 (file)
@@ -8,7 +8,7 @@ fn demo_mut_advanced_unique(mut our: Box<i32>) -> i32 {
   unknown_code_2();
 
   // We know this will return 5
-  *our //~ ERROR does not exist on the stack
+  *our //~ ERROR does not exist on the borrow stack
 }
 
 // Now comes the evil context
index e08e3bba6840de4de73cd2787d42fd9ed7567206..98d4e6f22965dd24353bafe66f7e9ac430cbd394 100644 (file)
@@ -13,5 +13,5 @@ fn main() {
     let v1 = safe::as_mut_slice(&v);
     let _v2 = safe::as_mut_slice(&v);
     v1[1] = 5;
-    //~^ ERROR does not exist on the stack
+    //~^ ERROR does not exist on the borrow stack
 }
index 959c6314690d277474a5a000dec4cbdaf8ff6f36..42f345f55144cd8a718d71fc860892d381d6397c 100644 (file)
@@ -9,7 +9,7 @@ pub fn split_at_mut<T>(self_: &mut [T], mid: usize) -> (&mut [T], &mut [T]) {
             assert!(mid <= len);
 
             (from_raw_parts_mut(ptr, len - mid), // BUG: should be "mid" instead of "len - mid"
-            //~^ ERROR does not exist on the stack
+            //~^ ERROR does not exist on the borrow stack
             from_raw_parts_mut(ptr.offset(mid as isize), len - mid))
         }
     }
index dbaccae8827211b0599a09fcf258c103183a1c36..0181f739a899d5d6478c371767ee236e47534553 100644 (file)
@@ -7,7 +7,7 @@ fn main() {
     let xref = unsafe { &mut *xraw }; // derived from raw, so using raw is still okay...
     callee(xraw);
     let _val = *xref; // ...but any use of raw will invalidate our ref.
-    //~^ ERROR: does not exist on the stack
+    //~^ ERROR: does not exist on the borrow stack
 }
 
 fn callee(xraw: *mut i32) {
index 2da755d9aabc137206a1cc8eedc4d50a91dbb2e4..b55fe1c6c88a443b113fd3ff9f117ba0e86f543e 100644 (file)
@@ -7,7 +7,7 @@ fn main() {
     let xref = unsafe { &mut *xraw }; // derived from raw, so using raw is still okay...
     callee(xraw);
     let _val = *xref; // ...but any use of raw will invalidate our ref.
-    //~^ ERROR: does not exist on the stack
+    //~^ ERROR: does not exist on the borrow stack
 }
 
 fn callee(xraw: *mut i32) {
index b0da0511dee3fb52a748b76b39cbd616ae2a5c32..9da4ca09606e73e3347532871688c10cb2aa9632 100644 (file)
@@ -13,7 +13,7 @@ fn main() {
     let xref2 = &mut *xref1; // derived from xref1, so using raw is still okay...
     callee(xref1_sneaky);
     let _val = *xref2; // ...but any use of it will invalidate our ref.
-    //~^ ERROR: does not exist on the stack
+    //~^ ERROR: does not exist on the borrow stack
 }
 
 fn callee(xref1: usize) {
index c86ec1286daad8121b41b45e1672521e69e91f53..bb889de8f839eb7fdc07b16e369a50a4f3291dc5 100644 (file)
@@ -5,5 +5,5 @@ fn main() {
     let xraw = xref1 as *mut _;
     let xref2 = unsafe { &mut *xraw };
     let _val = unsafe { *xraw }; // use the raw again, this invalidates xref2 *even* with the special read except for uniq refs
-    let _illegal = *xref2; //~ ERROR does not exist on the stack
+    let _illegal = *xref2; //~ ERROR does not exist on the borrow stack
 }
index 863649a47b5ef374d74d4fc21fb2f672d70694c9..5f800e754a5d02749346efbd0f0e5d9302cd6aeb 100644 (file)
@@ -12,5 +12,5 @@ fn main() {
     let _val = *xref; // we can even still use our mutable reference
     mem::forget(unsafe { ptr::read(xshr) }); // but after reading through the shared ref
     let _val = *xref; // the mutable one is dead and gone
-    //~^ ERROR does not exist on the stack
+    //~^ ERROR does not exist on the borrow stack
 }
index ba3b6686b84cb2be541f1ef1f50e99ee785b4b01..affa21c7625ead98ae207921dc55d799ca4545f1 100644 (file)
@@ -3,6 +3,6 @@ fn main() {
     let target2 = target as *mut _;
     drop(&mut *target); // reborrow
     // Now make sure our ref is still the only one.
-    unsafe { *target2 = 13; } //~ ERROR does not exist on the stack
+    unsafe { *target2 = 13; } //~ ERROR does not exist on the borrow stack
     let _val = *target;
 }
index a653aa5003f6d4da712027e3f1abe154941ccffe..dc4edcc3a5b4496c5e0424ba68905379f2f52368 100644 (file)
@@ -3,6 +3,6 @@ fn main() {
     // Make sure raw ptr with raw tag cannot mutate frozen location without breaking the shared ref.
     let r#ref = &target; // freeze
     let ptr = r#ref as *const _ as *mut _; // raw ptr, with raw tag
-    unsafe { *ptr = 42; } //~ ERROR does not exist on the stack
+    unsafe { *ptr = 42; } //~ ERROR does not exist on the borrow stack
     let _val = *r#ref;
 }
index 57b2ca87d810236ad8c75fb77bd79dd4ef63af90..af57221260ce893750beecef0161092edc22676f 100644 (file)
@@ -7,7 +7,7 @@ fn main() {
     let xref = unsafe { &mut *xraw }; // derived from raw, so using raw is still okay...
     callee(xraw);
     let _val = *xref; // ...but any use of raw will invalidate our ref.
-    //~^ ERROR: does not exist on the stack
+    //~^ ERROR: does not exist on the borrow stack
 }
 
 fn callee(xraw: *mut i32) {
index 98b9451eda87e77a2217ad9d043f9f7cb13ef5ee..f2e4b36f85cc242234914854df72397a0b8eedea 100644 (file)
@@ -5,5 +5,5 @@ fn main() {
     let xref = unsafe { &mut *xraw };
     let xref_in_mem = Box::new(xref);
     let _val = unsafe { *xraw }; // invalidate xref
-    let _val = *xref_in_mem; //~ ERROR does not exist on the stack
+    let _val = *xref_in_mem; //~ ERROR does not exist on the borrow stack
 }
index 64a8ff69108ec06f75140bb68a00325eebd66bc1..ba36e43e0c5d4c39ab960bdc0bc0c9d2f2ce8aa2 100644 (file)
@@ -3,7 +3,7 @@ fn main() {
     let y: *const i32 = &x;
     x = 1; // this invalidates y by reactivating the lowermost uniq borrow for this local
 
-    assert_eq!(unsafe { *y }, 1); //~ ERROR does not exist on the stack
+    assert_eq!(unsafe { *y }, 1); //~ ERROR does not exist on the borrow stack
 
     assert_eq!(x, 1);
 }
index 28288c6c63623154d91d8915f6900c665ea86325..b239237f019928e4a22209fba51a97859f143128 100644 (file)
@@ -6,5 +6,5 @@ fn main() {
     let xraw = x as *mut _;
     let xref = unsafe { &mut *xraw };
     let _val = unsafe { *xraw }; // invalidate xref
-    foo(xref); //~ ERROR does not exist on the stack
+    foo(xref); //~ ERROR does not exist on the borrow stack
 }
index bd5e28b47e8673a94f48cf26144be28900e49f8d..a8207d58e99b23dccaf4a144175b61c8c96ab8d4 100644 (file)
@@ -8,7 +8,7 @@ fn fun1(x: &mut u8) {
 
 fn fun2() {
     // Now we use a pointer we are not allowed to use
-    let _x = unsafe { *PTR }; //~ ERROR does not exist on the stack
+    let _x = unsafe { *PTR }; //~ ERROR does not exist on the borrow stack
 }
 
 fn main() {
index e7f0b9bc9ddd0e127715a1e03373fca2b0b430f9..31f8a4e33afd906a77efb2d6ee58622d374bdc59 100644 (file)
@@ -3,7 +3,7 @@ fn foo(x: &mut (i32, i32)) -> &mut i32 {
     let xraw = x as *mut (i32, i32);
     let ret = unsafe { &mut (*xraw).1 };
     let _val = unsafe { *xraw }; // invalidate xref
-    ret //~ ERROR does not exist on the stack
+    ret //~ ERROR does not exist on the borrow stack
 }
 
 fn main() {
index 28a1f74c6ac20e5edd698a2ac70508962806f5a5..750d507d6f660150f7ef96d20cbd2dea93768e59 100644 (file)
@@ -3,7 +3,7 @@ fn foo(x: &mut (i32, i32)) -> Option<&mut i32> {
     let xraw = x as *mut (i32, i32);
     let ret = Some(unsafe { &mut (*xraw).1 });
     let _val = unsafe { *xraw }; // invalidate xref
-    ret //~ ERROR does not exist on the stack
+    ret //~ ERROR does not exist on the borrow stack
 }
 
 fn main() {
index 3357af68a8411c1591eeaeddb6016ed072e28ef6..bb712e9e486cd6d977edaa4cafe5b5e18c2f24d3 100644 (file)
@@ -3,7 +3,7 @@ fn foo(x: &mut (i32, i32)) -> (&mut i32,) {
     let xraw = x as *mut (i32, i32);
     let ret = (unsafe { &mut (*xraw).1 },);
     let _val = unsafe { *xraw }; // invalidate xref
-    ret //~ ERROR does not exist on the stack
+    ret //~ ERROR does not exist on the borrow stack
 }
 
 fn main() {
index 197c11197efa679a682ace4911417247e9dc750d..45ada88977788968f3f15be18ed4cae423f02ae1 100644 (file)
@@ -10,5 +10,5 @@ fn main() {
     let _raw: *mut i32 = unsafe { mem::transmute(&mut x[0]) };
     // `raw` still carries a tag, so we get another pointer to the same location that does not carry a tag
     let raw = (&mut x[1] as *mut i32).wrapping_offset(-1);
-    unsafe { *raw = 13; } //~ ERROR does not exist on the stack
+    unsafe { *raw = 13; } //~ ERROR does not exist on the borrow stack
 }
index 054697b04a09d8ea45b3db3b233f4c3efa480351..1db14ea7eda545e6f0bc72162fb05e5516a07452 100644 (file)
@@ -4,5 +4,5 @@ fn main() {
     let mut x = 42;
     let raw = &mut x as *mut i32 as usize as *mut i32;
     let _ptr = &mut x;
-    unsafe { *raw = 13; } //~ ERROR does not exist on the stack
+    unsafe { *raw = 13; } //~ ERROR does not exist on the borrow stack
 }