Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add recovery for use of removed
box
syntax
- Loading branch information
Showing
5 changed files
with
105 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// run-rustfix | ||
|
||
fn main() { | ||
#[allow(dead_code)] | ||
struct T { | ||
a: u8, | ||
b: u8, | ||
} | ||
let _ = Box::new(()); //~ ERROR `box_syntax` has been removed | ||
let _ = Box::new(1); //~ ERROR `box_syntax` has been removed | ||
let _ = Box::new(T { a: 12, b: 18 }); //~ ERROR `box_syntax` has been removed | ||
let _ = Box::new([5; 30]); //~ ERROR `box_syntax` has been removed | ||
let _: Box<()> = Box::new(()); //~ ERROR `box_syntax` has been removed | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,14 @@ | ||
// run-rustfix | ||
|
||
fn main() { | ||
#[allow(dead_code)] | ||
struct T { | ||
a: u8, | ||
b: u8, | ||
} | ||
let _ = box () //~ ERROR expected expression, found reserved keyword `box` | ||
let _ = box 1; | ||
let _ = box T { a: 12, b: 18 }; | ||
let _ = box [5; 30]; | ||
let _ = box (); //~ ERROR `box_syntax` has been removed | ||
let _ = box 1; //~ ERROR `box_syntax` has been removed | ||
let _ = box T { a: 12, b: 18 }; //~ ERROR `box_syntax` has been removed | ||
let _ = box [5; 30]; //~ ERROR `box_syntax` has been removed | ||
let _: Box<()> = box (); //~ ERROR `box_syntax` has been removed | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,57 @@ | ||
error: expected expression, found reserved keyword `box` | ||
--> $DIR/removed-syntax-box.rs:6:13 | ||
error: `box_syntax` has been removed | ||
--> $DIR/removed-syntax-box.rs:9:13 | ||
| | ||
LL | let _ = box () | ||
| ^^^ expected expression | ||
LL | let _ = box (); | ||
| ^^^^^^ | ||
| | ||
help: use `Box::new()` instead | ||
| | ||
LL | let _ = Box::new(()); | ||
| ~~~~~~~~~~~~ | ||
|
||
error: `box_syntax` has been removed | ||
--> $DIR/removed-syntax-box.rs:10:13 | ||
| | ||
LL | let _ = box 1; | ||
| ^^^^^ | ||
| | ||
help: use `Box::new()` instead | ||
| | ||
LL | let _ = Box::new(1); | ||
| ~~~~~~~~~~~ | ||
|
||
error: `box_syntax` has been removed | ||
--> $DIR/removed-syntax-box.rs:11:13 | ||
| | ||
LL | let _ = box T { a: 12, b: 18 }; | ||
| ^^^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
help: use `Box::new()` instead | ||
| | ||
LL | let _ = Box::new(T { a: 12, b: 18 }); | ||
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
error: `box_syntax` has been removed | ||
--> $DIR/removed-syntax-box.rs:12:13 | ||
| | ||
LL | let _ = box [5; 30]; | ||
| ^^^^^^^^^^^ | ||
| | ||
help: use `Box::new()` instead | ||
| | ||
LL | let _ = Box::new([5; 30]); | ||
| ~~~~~~~~~~~~~~~~~ | ||
|
||
error: `box_syntax` has been removed | ||
--> $DIR/removed-syntax-box.rs:13:22 | ||
| | ||
LL | let _: Box<()> = box (); | ||
| ^^^^^^ | ||
| | ||
help: use `Box::new()` instead | ||
| | ||
LL | let _: Box<()> = Box::new(()); | ||
| ~~~~~~~~~~~~ | ||
|
||
error: aborting due to previous error | ||
error: aborting due to 5 previous errors | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,5 +10,5 @@ extern crate std; | |
fn main() { | ||
let _ = | ||
#[rustc_box] | ||
Box::new (1); | ||
Box::new(1); | ||
} |