about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorclubby789 <jamie@hill-daniel.co.uk>2023-02-27 13:07:44 +0000
committerclubby789 <jamie@hill-daniel.co.uk>2023-03-12 13:19:46 +0000
commitdd7df04e168324fc002ab4985b6c7513f08ccf49 (patch)
treed20567e06dfccad24f16dabddb42852a498a8c1a /src
parent24c0b81c1fd5de8e00276524896d3352ed91a8cb (diff)
downloadrust-dd7df04e168324fc002ab4985b6c7513f08ccf49.tar.gz
rust-dd7df04e168324fc002ab4985b6c7513f08ccf49.zip
Remove uses of `box_syntax` in rustc and tools
Diffstat (limited to 'src')
-rw-r--r--src/doc/unstable-book/src/the-unstable-book.md23
-rw-r--r--src/tools/clippy/tests/ui/boxed_local.rs35
-rw-r--r--src/tools/clippy/tests/ui/boxed_local.stderr8
-rw-r--r--src/tools/clippy/tests/ui/no_effect.rs3
-rw-r--r--src/tools/clippy/tests/ui/no_effect.stderr38
-rw-r--r--src/tools/clippy/tests/ui/unnecessary_operation.fixed2
-rw-r--r--src/tools/clippy/tests/ui/unnecessary_operation.rs2
-rw-r--r--src/tools/clippy/tests/ui/unnecessary_operation.stderr46
-rw-r--r--src/tools/miri/tests/fail/function_pointers/execute_memory.rs4
-rw-r--r--src/tools/miri/tests/pass/drop_empty_slice.rs4
-rw-r--r--src/tools/miri/tests/pass/dst-struct.rs6
-rw-r--r--src/tools/miri/tests/pass/heap.rs7
-rw-r--r--src/tools/miri/tests/pass/issues/issue-3794.rs4
-rw-r--r--src/tools/miri/tests/pass/move-arg-2-unique.rs4
-rw-r--r--src/tools/miri/tests/pass/move-arg-3-unique.rs4
-rw-r--r--src/tools/miri/tests/pass/mpsc.rs14
-rw-r--r--src/tools/miri/tests/pass/regions-lifetime-nonfree-late-bound.rs6
-rw-r--r--src/tools/rust-analyzer/crates/ide-completion/src/tests/attribute.rs4
-rw-r--r--src/tools/rustfmt/tests/source/expr.rs11
-rw-r--r--src/tools/rustfmt/tests/target/configs/combine_control_expr/false.rs6
-rw-r--r--src/tools/rustfmt/tests/target/configs/combine_control_expr/true.rs6
-rw-r--r--src/tools/rustfmt/tests/target/expr.rs14
22 files changed, 89 insertions, 162 deletions
diff --git a/src/doc/unstable-book/src/the-unstable-book.md b/src/doc/unstable-book/src/the-unstable-book.md
index 554c52c3c9c..9090b134dc6 100644
--- a/src/doc/unstable-book/src/the-unstable-book.md
+++ b/src/doc/unstable-book/src/the-unstable-book.md
@@ -5,16 +5,31 @@ each one organized by a "feature flag." That is, when using an unstable
 feature of Rust, you must use a flag, like this:
 
 ```rust
-#![feature(box_syntax)]
+#![feature(generators, generator_trait)]
+
+use std::ops::{Generator, GeneratorState};
+use std::pin::Pin;
 
 fn main() {
-    let five = box 5;
+    let mut generator = || {
+        yield 1;
+        return "foo"
+    };
+
+    match Pin::new(&mut generator).resume(()) {
+        GeneratorState::Yielded(1) => {}
+        _ => panic!("unexpected value from resume"),
+    }
+    match Pin::new(&mut generator).resume(()) {
+        GeneratorState::Complete("foo") => {}
+        _ => panic!("unexpected value from resume"),
+    }
 }
 ```
 
-The `box_syntax` feature [has a chapter][box] describing how to use it.
+The `generators` feature [has a chapter][generators] describing how to use it.
 
-[box]: language-features/box-syntax.md
+[generators]: language-features/generators.md
 
 Because this documentation relates to unstable features, we make no guarantees
 that what is contained here is accurate or up to date. It's developed on a
diff --git a/src/tools/clippy/tests/ui/boxed_local.rs b/src/tools/clippy/tests/ui/boxed_local.rs
index 4639f00a8d8..79b6d33fc77 100644
--- a/src/tools/clippy/tests/ui/boxed_local.rs
+++ b/src/tools/clippy/tests/ui/boxed_local.rs
@@ -1,4 +1,3 @@
-#![feature(box_syntax)]
 #![feature(lint_reasons)]
 #![allow(
     clippy::borrowed_box,
@@ -34,7 +33,7 @@ fn ok_box_trait(boxed_trait: &Box<dyn Z>) {
 }
 
 fn warn_call() {
-    let x = box A;
+    let x = Box::new(A);
     x.foo();
 }
 
@@ -43,41 +42,41 @@ fn warn_arg(x: Box<A>) {
 }
 
 fn nowarn_closure_arg() {
-    let x = Some(box A);
+    let x = Some(Box::new(A));
     x.map_or((), |x| take_ref(&x));
 }
 
 fn warn_rename_call() {
-    let x = box A;
+    let x = Box::new(A);
 
     let y = x;
     y.foo(); // via autoderef
 }
 
 fn warn_notuse() {
-    let bz = box A;
+    let bz = Box::new(A);
 }
 
 fn warn_pass() {
-    let bz = box A;
+    let bz = Box::new(A);
     take_ref(&bz); // via deref coercion
 }
 
 fn nowarn_return() -> Box<A> {
-    box A // moved out, "escapes"
+    Box::new(A) // moved out, "escapes"
 }
 
 fn nowarn_move() {
-    let bx = box A;
+    let bx = Box::new(A);
     drop(bx) // moved in, "escapes"
 }
 fn nowarn_call() {
-    let bx = box A;
+    let bx = Box::new(A);
     bx.clone(); // method only available to Box, not via autoderef
 }
 
 fn nowarn_pass() {
-    let bx = box A;
+    let bx = Box::new(A);
     take_box(&bx); // fn needs &Box
 }
 
@@ -86,30 +85,20 @@ fn take_ref(x: &A) {}
 
 fn nowarn_ref_take() {
     // false positive, should actually warn
-    let x = box A;
+    let x = Box::new(A);
     let y = &x;
     take_box(y);
 }
 
 fn nowarn_match() {
-    let x = box A; // moved into a match
+    let x = Box::new(A); // moved into a match
     match x {
         y => drop(y),
     }
 }
 
 fn warn_match() {
-    let x = box A;
-    match &x {
-        // not moved
-        y => (),
-    }
-}
-
-fn nowarn_large_array() {
-    // should not warn, is large array
-    // and should not be on stack
-    let x = box [1; 10000];
+    let x = Box::new(A);
     match &x {
         // not moved
         y => (),
diff --git a/src/tools/clippy/tests/ui/boxed_local.stderr b/src/tools/clippy/tests/ui/boxed_local.stderr
index 9036529f39c..10d78fbc0ab 100644
--- a/src/tools/clippy/tests/ui/boxed_local.stderr
+++ b/src/tools/clippy/tests/ui/boxed_local.stderr
@@ -1,5 +1,5 @@
 error: local variable doesn't need to be boxed here
-  --> $DIR/boxed_local.rs:41:13
+  --> $DIR/boxed_local.rs:40:13
    |
 LL | fn warn_arg(x: Box<A>) {
    |             ^
@@ -7,19 +7,19 @@ LL | fn warn_arg(x: Box<A>) {
    = note: `-D clippy::boxed-local` implied by `-D warnings`
 
 error: local variable doesn't need to be boxed here
-  --> $DIR/boxed_local.rs:132:12
+  --> $DIR/boxed_local.rs:121:12
    |
 LL | pub fn new(_needs_name: Box<PeekableSeekable<&()>>) -> () {}
    |            ^^^^^^^^^^^
 
 error: local variable doesn't need to be boxed here
-  --> $DIR/boxed_local.rs:196:44
+  --> $DIR/boxed_local.rs:185:44
    |
 LL |         fn default_impl_x(self: Box<Self>, x: Box<u32>) -> u32 {
    |                                            ^
 
 error: local variable doesn't need to be boxed here
-  --> $DIR/boxed_local.rs:203:16
+  --> $DIR/boxed_local.rs:192:16
    |
 LL |         fn foo(x: Box<u32>) {}
    |                ^
diff --git a/src/tools/clippy/tests/ui/no_effect.rs b/src/tools/clippy/tests/ui/no_effect.rs
index f08eb092e6b..ec8a5aa28c5 100644
--- a/src/tools/clippy/tests/ui/no_effect.rs
+++ b/src/tools/clippy/tests/ui/no_effect.rs
@@ -1,4 +1,4 @@
-#![feature(box_syntax, fn_traits, unboxed_closures)]
+#![feature(fn_traits, unboxed_closures)]
 #![warn(clippy::no_effect_underscore_binding)]
 #![allow(dead_code, path_statements)]
 #![allow(clippy::deref_addrof, clippy::redundant_field_names, clippy::uninlined_format_args)]
@@ -102,7 +102,6 @@ fn main() {
     *&42;
     &6;
     (5, 6, 7);
-    box 42;
     ..;
     5..;
     ..5;
diff --git a/src/tools/clippy/tests/ui/no_effect.stderr b/src/tools/clippy/tests/ui/no_effect.stderr
index 6a1e636f9a6..92f6dbfbdba 100644
--- a/src/tools/clippy/tests/ui/no_effect.stderr
+++ b/src/tools/clippy/tests/ui/no_effect.stderr
@@ -81,83 +81,77 @@ LL |     (5, 6, 7);
 error: statement with no effect
   --> $DIR/no_effect.rs:105:5
    |
-LL |     box 42;
-   |     ^^^^^^^
-
-error: statement with no effect
-  --> $DIR/no_effect.rs:106:5
-   |
 LL |     ..;
    |     ^^^
 
 error: statement with no effect
-  --> $DIR/no_effect.rs:107:5
+  --> $DIR/no_effect.rs:106:5
    |
 LL |     5..;
    |     ^^^^
 
 error: statement with no effect
-  --> $DIR/no_effect.rs:108:5
+  --> $DIR/no_effect.rs:107:5
    |
 LL |     ..5;
    |     ^^^^
 
 error: statement with no effect
-  --> $DIR/no_effect.rs:109:5
+  --> $DIR/no_effect.rs:108:5
    |
 LL |     5..6;
    |     ^^^^^
 
 error: statement with no effect
-  --> $DIR/no_effect.rs:110:5
+  --> $DIR/no_effect.rs:109:5
    |
 LL |     5..=6;
    |     ^^^^^^
 
 error: statement with no effect
-  --> $DIR/no_effect.rs:111:5
+  --> $DIR/no_effect.rs:110:5
    |
 LL |     [42, 55];
    |     ^^^^^^^^^
 
 error: statement with no effect
-  --> $DIR/no_effect.rs:112:5
+  --> $DIR/no_effect.rs:111:5
    |
 LL |     [42, 55][1];
    |     ^^^^^^^^^^^^
 
 error: statement with no effect
-  --> $DIR/no_effect.rs:113:5
+  --> $DIR/no_effect.rs:112:5
    |
 LL |     (42, 55).1;
    |     ^^^^^^^^^^^
 
 error: statement with no effect
-  --> $DIR/no_effect.rs:114:5
+  --> $DIR/no_effect.rs:113:5
    |
 LL |     [42; 55];
    |     ^^^^^^^^^
 
 error: statement with no effect
-  --> $DIR/no_effect.rs:115:5
+  --> $DIR/no_effect.rs:114:5
    |
 LL |     [42; 55][13];
    |     ^^^^^^^^^^^^^
 
 error: statement with no effect
-  --> $DIR/no_effect.rs:117:5
+  --> $DIR/no_effect.rs:116:5
    |
 LL |     || x += 5;
    |     ^^^^^^^^^^
 
 error: statement with no effect
-  --> $DIR/no_effect.rs:119:5
+  --> $DIR/no_effect.rs:118:5
    |
 LL |     FooString { s: s };
    |     ^^^^^^^^^^^^^^^^^^^
 
 error: binding to `_` prefixed variable with no side-effect
-  --> $DIR/no_effect.rs:120:5
+  --> $DIR/no_effect.rs:119:5
    |
 LL |     let _unused = 1;
    |     ^^^^^^^^^^^^^^^^
@@ -165,22 +159,22 @@ LL |     let _unused = 1;
    = note: `-D clippy::no-effect-underscore-binding` implied by `-D warnings`
 
 error: binding to `_` prefixed variable with no side-effect
-  --> $DIR/no_effect.rs:121:5
+  --> $DIR/no_effect.rs:120:5
    |
 LL |     let _penguin = || println!("Some helpful closure");
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error: binding to `_` prefixed variable with no side-effect
-  --> $DIR/no_effect.rs:122:5
+  --> $DIR/no_effect.rs:121:5
    |
 LL |     let _duck = Struct { field: 0 };
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error: binding to `_` prefixed variable with no side-effect
-  --> $DIR/no_effect.rs:123:5
+  --> $DIR/no_effect.rs:122:5
    |
 LL |     let _cat = [2, 4, 6, 8][2];
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
-error: aborting due to 30 previous errors
+error: aborting due to 29 previous errors
 
diff --git a/src/tools/clippy/tests/ui/unnecessary_operation.fixed b/src/tools/clippy/tests/ui/unnecessary_operation.fixed
index d37163570ab..65d9c910b82 100644
--- a/src/tools/clippy/tests/ui/unnecessary_operation.fixed
+++ b/src/tools/clippy/tests/ui/unnecessary_operation.fixed
@@ -1,6 +1,5 @@
 // run-rustfix
 
-#![feature(box_syntax)]
 #![allow(clippy::deref_addrof, dead_code, unused, clippy::no_effect)]
 #![warn(clippy::unnecessary_operation)]
 
@@ -59,7 +58,6 @@ fn main() {
     5;6;get_number();
     get_number();
     get_number();
-    get_number();
     5;get_number();
     42;get_number();
     assert!([42, 55].len() > get_usize());
diff --git a/src/tools/clippy/tests/ui/unnecessary_operation.rs b/src/tools/clippy/tests/ui/unnecessary_operation.rs
index a14fd4bca0e..4e2acd59f04 100644
--- a/src/tools/clippy/tests/ui/unnecessary_operation.rs
+++ b/src/tools/clippy/tests/ui/unnecessary_operation.rs
@@ -1,6 +1,5 @@
 // run-rustfix
 
-#![feature(box_syntax)]
 #![allow(clippy::deref_addrof, dead_code, unused, clippy::no_effect)]
 #![warn(clippy::unnecessary_operation)]
 
@@ -57,7 +56,6 @@ fn main() {
     *&get_number();
     &get_number();
     (5, 6, get_number());
-    box get_number();
     get_number()..;
     ..get_number();
     5..get_number();
diff --git a/src/tools/clippy/tests/ui/unnecessary_operation.stderr b/src/tools/clippy/tests/ui/unnecessary_operation.stderr
index f66d08ecb82..44cf2e01ff7 100644
--- a/src/tools/clippy/tests/ui/unnecessary_operation.stderr
+++ b/src/tools/clippy/tests/ui/unnecessary_operation.stderr
@@ -1,5 +1,5 @@
 error: unnecessary operation
-  --> $DIR/unnecessary_operation.rs:51:5
+  --> $DIR/unnecessary_operation.rs:50:5
    |
 LL |     Tuple(get_number());
    |     ^^^^^^^^^^^^^^^^^^^^ help: statement can be reduced to: `get_number();`
@@ -7,109 +7,103 @@ LL |     Tuple(get_number());
    = note: `-D clippy::unnecessary-operation` implied by `-D warnings`
 
 error: unnecessary operation
-  --> $DIR/unnecessary_operation.rs:52:5
+  --> $DIR/unnecessary_operation.rs:51:5
    |
 LL |     Struct { field: get_number() };
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: statement can be reduced to: `get_number();`
 
 error: unnecessary operation
-  --> $DIR/unnecessary_operation.rs:53:5
+  --> $DIR/unnecessary_operation.rs:52:5
    |
 LL |     Struct { ..get_struct() };
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: statement can be reduced to: `get_struct();`
 
 error: unnecessary operation
-  --> $DIR/unnecessary_operation.rs:54:5
+  --> $DIR/unnecessary_operation.rs:53:5
    |
 LL |     Enum::Tuple(get_number());
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: statement can be reduced to: `get_number();`
 
 error: unnecessary operation
-  --> $DIR/unnecessary_operation.rs:55:5
+  --> $DIR/unnecessary_operation.rs:54:5
    |
 LL |     Enum::Struct { field: get_number() };
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: statement can be reduced to: `get_number();`
 
 error: unnecessary operation
-  --> $DIR/unnecessary_operation.rs:56:5
+  --> $DIR/unnecessary_operation.rs:55:5
    |
 LL |     5 + get_number();
    |     ^^^^^^^^^^^^^^^^^ help: statement can be reduced to: `5;get_number();`
 
 error: unnecessary operation
-  --> $DIR/unnecessary_operation.rs:57:5
+  --> $DIR/unnecessary_operation.rs:56:5
    |
 LL |     *&get_number();
    |     ^^^^^^^^^^^^^^^ help: statement can be reduced to: `get_number();`
 
 error: unnecessary operation
-  --> $DIR/unnecessary_operation.rs:58:5
+  --> $DIR/unnecessary_operation.rs:57:5
    |
 LL |     &get_number();
    |     ^^^^^^^^^^^^^^ help: statement can be reduced to: `get_number();`
 
 error: unnecessary operation
-  --> $DIR/unnecessary_operation.rs:59:5
+  --> $DIR/unnecessary_operation.rs:58:5
    |
 LL |     (5, 6, get_number());
    |     ^^^^^^^^^^^^^^^^^^^^^ help: statement can be reduced to: `5;6;get_number();`
 
 error: unnecessary operation
-  --> $DIR/unnecessary_operation.rs:60:5
-   |
-LL |     box get_number();
-   |     ^^^^^^^^^^^^^^^^^ help: statement can be reduced to: `get_number();`
-
-error: unnecessary operation
-  --> $DIR/unnecessary_operation.rs:61:5
+  --> $DIR/unnecessary_operation.rs:59:5
    |
 LL |     get_number()..;
    |     ^^^^^^^^^^^^^^^ help: statement can be reduced to: `get_number();`
 
 error: unnecessary operation
-  --> $DIR/unnecessary_operation.rs:62:5
+  --> $DIR/unnecessary_operation.rs:60:5
    |
 LL |     ..get_number();
    |     ^^^^^^^^^^^^^^^ help: statement can be reduced to: `get_number();`
 
 error: unnecessary operation
-  --> $DIR/unnecessary_operation.rs:63:5
+  --> $DIR/unnecessary_operation.rs:61:5
    |
 LL |     5..get_number();
    |     ^^^^^^^^^^^^^^^^ help: statement can be reduced to: `5;get_number();`
 
 error: unnecessary operation
-  --> $DIR/unnecessary_operation.rs:64:5
+  --> $DIR/unnecessary_operation.rs:62:5
    |
 LL |     [42, get_number()];
    |     ^^^^^^^^^^^^^^^^^^^ help: statement can be reduced to: `42;get_number();`
 
 error: unnecessary operation
-  --> $DIR/unnecessary_operation.rs:65:5
+  --> $DIR/unnecessary_operation.rs:63:5
    |
 LL |     [42, 55][get_usize()];
    |     ^^^^^^^^^^^^^^^^^^^^^^ help: statement can be written as: `assert!([42, 55].len() > get_usize());`
 
 error: unnecessary operation
-  --> $DIR/unnecessary_operation.rs:66:5
+  --> $DIR/unnecessary_operation.rs:64:5
    |
 LL |     (42, get_number()).1;
    |     ^^^^^^^^^^^^^^^^^^^^^ help: statement can be reduced to: `42;get_number();`
 
 error: unnecessary operation
-  --> $DIR/unnecessary_operation.rs:67:5
+  --> $DIR/unnecessary_operation.rs:65:5
    |
 LL |     [get_number(); 55];
    |     ^^^^^^^^^^^^^^^^^^^ help: statement can be reduced to: `get_number();`
 
 error: unnecessary operation
-  --> $DIR/unnecessary_operation.rs:68:5
+  --> $DIR/unnecessary_operation.rs:66:5
    |
 LL |     [42; 55][get_usize()];
    |     ^^^^^^^^^^^^^^^^^^^^^^ help: statement can be written as: `assert!([42; 55].len() > get_usize());`
 
 error: unnecessary operation
-  --> $DIR/unnecessary_operation.rs:69:5
+  --> $DIR/unnecessary_operation.rs:67:5
    |
 LL | /     {
 LL | |         get_number()
@@ -117,12 +111,12 @@ LL | |     };
    | |______^ help: statement can be reduced to: `get_number();`
 
 error: unnecessary operation
-  --> $DIR/unnecessary_operation.rs:72:5
+  --> $DIR/unnecessary_operation.rs:70:5
    |
 LL | /     FooString {
 LL | |         s: String::from("blah"),
 LL | |     };
    | |______^ help: statement can be reduced to: `String::from("blah");`
 
-error: aborting due to 20 previous errors
+error: aborting due to 19 previous errors
 
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();
diff --git a/src/tools/rust-analyzer/crates/ide-completion/src/tests/attribute.rs b/src/tools/rust-analyzer/crates/ide-completion/src/tests/attribute.rs
index 4e60820dd6d..c97144b61b6 100644
--- a/src/tools/rust-analyzer/crates/ide-completion/src/tests/attribute.rs
+++ b/src/tools/rust-analyzer/crates/ide-completion/src/tests/attribute.rs
@@ -857,9 +857,9 @@ mod lint {
     #[test]
     fn lint_feature() {
         check_edit(
-            "box_syntax",
+            "box_patterns",
             r#"#[feature(box_$0)] struct Test;"#,
-            r#"#[feature(box_syntax)] struct Test;"#,
+            r#"#[feature(box_patterns)] struct Test;"#,
         )
     }
 
diff --git a/src/tools/rustfmt/tests/source/expr.rs b/src/tools/rustfmt/tests/source/expr.rs
index 21f8a4a4366..879c551ea49 100644
--- a/src/tools/rustfmt/tests/source/expr.rs
+++ b/src/tools/rustfmt/tests/source/expr.rs
@@ -3,7 +3,6 @@
 // Test expressions
 
 fn foo() -> bool {
-    let boxed: Box<i32> = box   5;
     let referenced = &5 ;
 
     let very_long_variable_name = ( a +  first +   simple + test   );
@@ -132,12 +131,6 @@ fn qux() {
     }
 }
 
-fn issue227() {
-    {
-        let handler = box DocumentProgressHandler::new(addr, DocumentProgressTask::DOMContentLoaded);
-    }
-}
-
 fn issue184(source: &str) {
     for c in source.chars() {
         if index < 'a' {
@@ -413,10 +406,6 @@ fn issue2704() {
                                 .concat(&requires1)
                                 .concat(&requires2)
                                 .distinct_total());
-    let requires = requires.set(box requires0
-                                .concat(&requires1)
-                                .concat(&requires2)
-                                .distinct_total());
     let requires = requires.set(requires0
                                 .concat(&requires1)
                                 .concat(&requires2)
diff --git a/src/tools/rustfmt/tests/target/configs/combine_control_expr/false.rs b/src/tools/rustfmt/tests/target/configs/combine_control_expr/false.rs
index 5ada9b1dd14..0ab82024937 100644
--- a/src/tools/rustfmt/tests/target/configs/combine_control_expr/false.rs
+++ b/src/tools/rustfmt/tests/target/configs/combine_control_expr/false.rs
@@ -108,12 +108,6 @@ fn main() {
         bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb,
     ));
 
-    // Box
-    foo(box Bar {
-        aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,
-        bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb,
-    });
-
     // Unary
     foo(!bar(
         aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,
diff --git a/src/tools/rustfmt/tests/target/configs/combine_control_expr/true.rs b/src/tools/rustfmt/tests/target/configs/combine_control_expr/true.rs
index 52acd26492a..aa41e021fb7 100644
--- a/src/tools/rustfmt/tests/target/configs/combine_control_expr/true.rs
+++ b/src/tools/rustfmt/tests/target/configs/combine_control_expr/true.rs
@@ -96,12 +96,6 @@ fn main() {
         bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb,
     ));
 
-    // Box
-    foo(box Bar {
-        aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,
-        bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb,
-    });
-
     // Unary
     foo(!bar(
         aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,
diff --git a/src/tools/rustfmt/tests/target/expr.rs b/src/tools/rustfmt/tests/target/expr.rs
index 84df802bc70..187a1dc976a 100644
--- a/src/tools/rustfmt/tests/target/expr.rs
+++ b/src/tools/rustfmt/tests/target/expr.rs
@@ -3,7 +3,6 @@
 // Test expressions
 
 fn foo() -> bool {
-    let boxed: Box<i32> = box 5;
     let referenced = &5;
 
     let very_long_variable_name = (a + first + simple + test);
@@ -179,13 +178,6 @@ fn qux() {
     }
 }
 
-fn issue227() {
-    {
-        let handler =
-            box DocumentProgressHandler::new(addr, DocumentProgressTask::DOMContentLoaded);
-    }
-}
-
 fn issue184(source: &str) {
     for c in source.chars() {
         if index < 'a' {
@@ -455,12 +447,6 @@ fn issue2704() {
             .distinct_total(),
     );
     let requires = requires.set(
-        box requires0
-            .concat(&requires1)
-            .concat(&requires2)
-            .distinct_total(),
-    );
-    let requires = requires.set(
         requires0
             .concat(&requires1)
             .concat(&requires2)