diff options
| author | clubby789 <jamie@hill-daniel.co.uk> | 2023-02-27 13:07:44 +0000 |
|---|---|---|
| committer | clubby789 <jamie@hill-daniel.co.uk> | 2023-03-12 13:19:46 +0000 |
| commit | dd7df04e168324fc002ab4985b6c7513f08ccf49 (patch) | |
| tree | d20567e06dfccad24f16dabddb42852a498a8c1a /src/tools/miri/tests | |
| parent | 24c0b81c1fd5de8e00276524896d3352ed91a8cb (diff) | |
| download | rust-dd7df04e168324fc002ab4985b6c7513f08ccf49.tar.gz rust-dd7df04e168324fc002ab4985b6c7513f08ccf49.zip | |
Remove uses of `box_syntax` in rustc and tools
Diffstat (limited to 'src/tools/miri/tests')
| -rw-r--r-- | src/tools/miri/tests/fail/function_pointers/execute_memory.rs | 4 | ||||
| -rw-r--r-- | src/tools/miri/tests/pass/drop_empty_slice.rs | 4 | ||||
| -rw-r--r-- | src/tools/miri/tests/pass/dst-struct.rs | 6 | ||||
| -rw-r--r-- | src/tools/miri/tests/pass/heap.rs | 7 | ||||
| -rw-r--r-- | src/tools/miri/tests/pass/issues/issue-3794.rs | 4 | ||||
| -rw-r--r-- | src/tools/miri/tests/pass/move-arg-2-unique.rs | 4 | ||||
| -rw-r--r-- | src/tools/miri/tests/pass/move-arg-3-unique.rs | 4 | ||||
| -rw-r--r-- | src/tools/miri/tests/pass/mpsc.rs | 14 | ||||
| -rw-r--r-- | src/tools/miri/tests/pass/regions-lifetime-nonfree-late-bound.rs | 6 |
9 files changed, 15 insertions, 38 deletions
diff --git a/src/tools/miri/tests/fail/function_pointers/execute_memory.rs b/src/tools/miri/tests/fail/function_pointers/execute_memory.rs index 967933e769b..89d8d22a9dd 100644 --- a/src/tools/miri/tests/fail/function_pointers/execute_memory.rs +++ b/src/tools/miri/tests/fail/function_pointers/execute_memory.rs @@ -1,10 +1,8 @@ // Validation makes this fail in the wrong place //@compile-flags: -Zmiri-disable-validation -#![feature(box_syntax)] - fn main() { - let x = box 42; + let x = Box::new(42); unsafe { let f = std::mem::transmute::<Box<i32>, fn()>(x); f() //~ ERROR: function pointer but it does not point to a function diff --git a/src/tools/miri/tests/pass/drop_empty_slice.rs b/src/tools/miri/tests/pass/drop_empty_slice.rs index 9805ce0ace3..0413ed1fd0c 100644 --- a/src/tools/miri/tests/pass/drop_empty_slice.rs +++ b/src/tools/miri/tests/pass/drop_empty_slice.rs @@ -1,7 +1,5 @@ -#![feature(box_syntax)] - fn main() { // With the nested Vec, this is calling Offset(Unique::empty(), 0) on drop. let args: Vec<Vec<i32>> = Vec::new(); - let _val = box args; + let _val = Box::new(args); } diff --git a/src/tools/miri/tests/pass/dst-struct.rs b/src/tools/miri/tests/pass/dst-struct.rs index 7191068eb2c..59763bbbfdd 100644 --- a/src/tools/miri/tests/pass/dst-struct.rs +++ b/src/tools/miri/tests/pass/dst-struct.rs @@ -1,5 +1,3 @@ -#![feature(box_syntax)] - struct Fat<T: ?Sized> { f1: isize, f2: &'static str, @@ -109,7 +107,7 @@ pub fn main() { assert_eq!((*f2)[1], 2); // Nested Box. - let f1: Box<Fat<[isize; 3]>> = box Fat { f1: 5, f2: "some str", ptr: [1, 2, 3] }; + let f1: Box<Fat<[isize; 3]>> = Box::new(Fat { f1: 5, f2: "some str", ptr: [1, 2, 3] }); foo(&*f1); let f2: Box<Fat<[isize]>> = f1; foo(&*f2); @@ -117,6 +115,6 @@ pub fn main() { let f3: Box<Fat<[isize]>> = Box::<Fat<[_; 3]>>::new(Fat { f1: 5, f2: "some str", ptr: [1, 2, 3] }); foo(&*f3); - let f4: Box<Fat<[isize]>> = box Fat { f1: 5, f2: "some str", ptr: [1, 2, 3] }; + let f4: Box<Fat<[isize]>> = Box::new(Fat { f1: 5, f2: "some str", ptr: [1, 2, 3] }); foo(&*f4); } diff --git a/src/tools/miri/tests/pass/heap.rs b/src/tools/miri/tests/pass/heap.rs index 44537e74b5a..44e3a60cfe1 100644 --- a/src/tools/miri/tests/pass/heap.rs +++ b/src/tools/miri/tests/pass/heap.rs @@ -1,13 +1,7 @@ -#![feature(box_syntax)] - fn make_box() -> Box<(i16, i16)> { Box::new((1, 2)) } -fn make_box_syntax() -> Box<(i16, i16)> { - box (1, 2) -} - fn allocate_reallocate() { let mut s = String::new(); @@ -29,6 +23,5 @@ fn allocate_reallocate() { fn main() { assert_eq!(*make_box(), (1, 2)); - assert_eq!(*make_box_syntax(), (1, 2)); allocate_reallocate(); } diff --git a/src/tools/miri/tests/pass/issues/issue-3794.rs b/src/tools/miri/tests/pass/issues/issue-3794.rs index 5b5b22b5494..860d72bb586 100644 --- a/src/tools/miri/tests/pass/issues/issue-3794.rs +++ b/src/tools/miri/tests/pass/issues/issue-3794.rs @@ -1,5 +1,3 @@ -#![feature(box_syntax)] - trait T { fn print(&self); } @@ -25,7 +23,7 @@ fn print_s(s: &S) { } pub fn main() { - let s: Box<S> = box S { s: 5 }; + let s: Box<S> = Box::new(S { s: 5 }); print_s(&*s); let t: Box<dyn T> = s as Box<dyn T>; print_t(&*t); diff --git a/src/tools/miri/tests/pass/move-arg-2-unique.rs b/src/tools/miri/tests/pass/move-arg-2-unique.rs index 669602ac704..de21d67eb4f 100644 --- a/src/tools/miri/tests/pass/move-arg-2-unique.rs +++ b/src/tools/miri/tests/pass/move-arg-2-unique.rs @@ -1,11 +1,9 @@ -#![feature(box_syntax)] - fn test(foo: Box<Vec<isize>>) { assert_eq!((*foo)[0], 10); } pub fn main() { - let x = box vec![10]; + let x = Box::new(vec![10]); // Test forgetting a local by move-in test(x); } diff --git a/src/tools/miri/tests/pass/move-arg-3-unique.rs b/src/tools/miri/tests/pass/move-arg-3-unique.rs index 3b5c7cbbd42..6025481c32e 100644 --- a/src/tools/miri/tests/pass/move-arg-3-unique.rs +++ b/src/tools/miri/tests/pass/move-arg-3-unique.rs @@ -1,7 +1,5 @@ -#![feature(box_syntax)] - pub fn main() { - let x = box 10; + let x = Box::new(10); let y = x; assert_eq!(*y, 10); } diff --git a/src/tools/miri/tests/pass/mpsc.rs b/src/tools/miri/tests/pass/mpsc.rs index 6e3c6e771cc..3824a0de907 100644 --- a/src/tools/miri/tests/pass/mpsc.rs +++ b/src/tools/miri/tests/pass/mpsc.rs @@ -1,15 +1,13 @@ -#![feature(box_syntax)] - use std::sync::mpsc::channel; pub fn main() { let (tx, rx) = channel::<Box<_>>(); - tx.send(box 100).unwrap(); + tx.send(Box::new(100)).unwrap(); let v = rx.recv().unwrap(); - assert_eq!(v, box 100); + assert_eq!(v, Box::new(100)); - tx.send(box 101).unwrap(); - tx.send(box 102).unwrap(); - assert_eq!(rx.recv().unwrap(), box 101); - assert_eq!(rx.recv().unwrap(), box 102); + tx.send(Box::new(101)).unwrap(); + tx.send(Box::new(102)).unwrap(); + assert_eq!(rx.recv().unwrap(), Box::new(101)); + assert_eq!(rx.recv().unwrap(), Box::new(102)); } diff --git a/src/tools/miri/tests/pass/regions-lifetime-nonfree-late-bound.rs b/src/tools/miri/tests/pass/regions-lifetime-nonfree-late-bound.rs index c91ac36ed6b..445dd43febb 100644 --- a/src/tools/miri/tests/pass/regions-lifetime-nonfree-late-bound.rs +++ b/src/tools/miri/tests/pass/regions-lifetime-nonfree-late-bound.rs @@ -12,8 +12,6 @@ // doing region-folding, when really all clients of the region-folding // case only want to see *free* lifetime variables, not bound ones. -#![feature(box_syntax)] - pub fn main() { fn explicit() { fn test<F>(_x: Option<Box<F>>) @@ -21,7 +19,7 @@ pub fn main() { F: FnMut(Box<dyn for<'a> FnMut(&'a isize)>), { } - test(Some(box |_f: Box<dyn for<'a> FnMut(&'a isize)>| {})); + test(Some(Box::new(|_f: Box<dyn for<'a> FnMut(&'a isize)>| {}))); } // The code below is shorthand for the code above (and more likely @@ -32,7 +30,7 @@ pub fn main() { F: FnMut(Box<dyn FnMut(&isize)>), { } - test(Some(box |_f: Box<dyn FnMut(&isize)>| {})); + test(Some(Box::new(|_f: Box<dyn FnMut(&isize)>| {}))); } explicit(); |
