Skip to content

Commit 0a03825

Browse files
committed
Remove even more box syntax uses from src/test
Prior work, notably 6550021 from rust-lang#88316 has removed box syntax from most of the testsuite. However, some tests were left out. This commit removes box_syntax uses from more locations in src/test. Some tests that are very box syntax specific are not being migrated.
1 parent affe0d3 commit 0a03825

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+154
-212
lines changed

src/test/mir-opt/simplify-locals.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// unit-test: SimplifyLocals
22

3-
#![feature(box_syntax)]
3+
44
#![feature(thread_local)]
55

66
#[derive(Copy, Clone)]

src/test/run-make-fulldeps/save-analysis-fail/foo.rs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#![crate_name = "test"]
2-
#![feature(box_syntax)]
32
#![feature(rustc_private)]
43

54
extern crate rustc_graphviz;
@@ -261,9 +260,9 @@ fn hello<X: SomeTrait>((z, a): (u32, String), ex: X) {
261260
let x = 32.0f32;
262261
let _ = (x + ((x * x) + 1.0).sqrt()).ln();
263262

264-
let s: Box<SomeTrait> = box some_fields { field1: 43 };
265-
let s2: Box<some_fields> = box some_fields { field1: 43 };
266-
let s3 = box nofields;
263+
let s: Box<SomeTrait> = Box::new(some_fields { field1: 43 });
264+
let s2: Box<some_fields> = Box::new(some_fields { field1: 43 });
265+
let s3 = Box::new(nofields);
267266

268267
s.Method(43);
269268
s3.Method(43);
@@ -317,7 +316,7 @@ mod macro_use_test {
317316

318317
fn main() {
319318
// foo
320-
let s = box some_fields { field1: 43 };
319+
let s = Box::new(some_fields { field1: 43 });
321320
hello((43, "a".to_string()), *s);
322321
sub::sub2::hello();
323322
sub2::sub3::hello();
@@ -345,17 +344,17 @@ fn main() {
345344
let s4: msalias::nested_struct = sub::sub2::nested_struct { field2: 55 };
346345
let s4: msalias::nested_struct = sub2::nested_struct { field2: 55 };
347346
println(&s2.field1.to_string());
348-
let s5: MyType = box some_fields { field1: 55 };
347+
let s5: MyType = Box::new(some_fields { field1: 55 });
349348
let s = SameDir::SameStruct { name: "Bob".to_string() };
350349
let s = SubDir::SubStruct { name: "Bob".to_string() };
351-
let s6: SomeEnum = SomeEnum::MyTypes(box s2.clone(), s5);
350+
let s6: SomeEnum = SomeEnum::MyTypes(Box::new(s2.clone()), s5);
352351
let s7: SomeEnum = SomeEnum::Strings("one", "two", "three");
353352
matchSomeEnum(s6);
354353
matchSomeEnum(s7);
355354
let s8: SomeOtherEnum = SomeOtherEnum::SomeConst2;
356355
matchSomeOtherEnum(s8);
357356
let s9: SomeStructEnum =
358-
SomeStructEnum::EnumStruct2 { f1: box some_fields { field1: 10 }, f2: box s2 };
357+
SomeStructEnum::EnumStruct2 { f1: Box::new(some_fields { field1: 10 }), f2: Box::new(s2) };
359358
matchSomeStructEnum(s9);
360359

361360
for x in &vec![1, 2, 3] {

src/test/run-make-fulldeps/save-analysis/foo.rs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#![crate_name = "test"]
2-
#![feature(box_syntax)]
32
#![feature(rustc_private)]
43
#![feature(associated_type_defaults)]
54

@@ -255,9 +254,9 @@ fn hello<X: SomeTrait>((z, a): (u32, String), ex: X) {
255254
let x = 32.0f32;
256255
let _ = (x + ((x * x) + 1.0).sqrt()).ln();
257256

258-
let s: Box<SomeTrait> = box some_fields { field1: 43 };
259-
let s2: Box<some_fields> = box some_fields { field1: 43 };
260-
let s3 = box nofields;
257+
let s: Box<SomeTrait> = Box::new(some_fields { field1: 43 });
258+
let s2: Box<some_fields> = Box::new(some_fields { field1: 43 });
259+
let s3 = Box::new(nofields);
261260

262261
s.Method(43);
263262
s3.Method(43);
@@ -311,7 +310,7 @@ mod macro_use_test {
311310

312311
fn main() {
313312
// foo
314-
let s = box some_fields { field1: 43 };
313+
let s = Box::new(some_fields { field1: 43 });
315314
hello((43, "a".to_string()), *s);
316315
sub::sub2::hello();
317316
sub2::sub3::hello();
@@ -339,17 +338,17 @@ fn main() {
339338
let s4: msalias::nested_struct = sub::sub2::nested_struct { field2: 55 };
340339
let s4: msalias::nested_struct = sub2::nested_struct { field2: 55 };
341340
println(&s2.field1.to_string());
342-
let s5: MyType = box some_fields { field1: 55 };
341+
let s5: MyType = Box::new(some_fields { field1: 55 });
343342
let s = SameDir::SameStruct { name: "Bob".to_string() };
344343
let s = SubDir::SubStruct { name: "Bob".to_string() };
345-
let s6: SomeEnum = SomeEnum::MyTypes(box s2.clone(), s5);
344+
let s6: SomeEnum = SomeEnum::MyTypes(Box::new(s2.clone()), s5);
346345
let s7: SomeEnum = SomeEnum::Strings("one", "two", "three");
347346
matchSomeEnum(s6);
348347
matchSomeEnum(s7);
349348
let s8: SomeOtherEnum = SomeOtherEnum::SomeConst2;
350349
matchSomeOtherEnum(s8);
351350
let s9: SomeStructEnum =
352-
SomeStructEnum::EnumStruct2 { f1: box some_fields { field1: 10 }, f2: box s2 };
351+
SomeStructEnum::EnumStruct2 { f1: Box::new(some_fields { field1: 10 }), f2: Box::new(s2) };
353352
matchSomeStructEnum(s9);
354353

355354
for x in &vec![1, 2, 3] {

src/test/run-pass-valgrind/cleanup-auto-borrow-obj.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
// schedule cleanups when auto borrowing trait objects.
33
// This program should be valgrind clean.
44

5-
#![feature(box_syntax)]
6-
75
static mut DROP_RAN: bool = false;
86

97
struct Foo;
@@ -19,7 +17,7 @@ impl Trait for Foo {}
1917

2018
pub fn main() {
2119
{
22-
let _x: &Trait = &*(box Foo as Box<Trait>);
20+
let _x: &Trait = &*(Box::new(Foo) as Box<Trait>);
2321
}
2422
unsafe {
2523
assert!(DROP_RAN);

src/test/run-pass-valgrind/coerce-match.rs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,18 @@
22

33
// pretty-expanded FIXME #23616
44

5-
#![feature(box_syntax)]
6-
75
pub fn main() {
8-
let _: Box<[isize]> =
9-
if true { let b: Box<_> = box [1, 2, 3]; b } else { let b: Box<_> = box [1]; b };
6+
let _: Box<[isize]> = if true {
7+
let b: Box<_> = Box::new([1, 2, 3]);
8+
b
9+
} else {
10+
let b: Box<_> = Box::new([1]);
11+
b
12+
};
1013

1114
let _: Box<[isize]> = match true {
12-
true => { let b: Box<_> = box [1, 2, 3]; b }
13-
false => { let b: Box<_> = box [1]; b }
15+
true => { let b: Box<_> = Box::new([1, 2, 3]); b }
16+
false => { let b: Box<_> = Box::new([1]); b }
1417
};
1518

1619
// Check we don't get over-keen at propagating coercions in the case of casts.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#![feature(box_syntax)]
2-
#![feature(box_syntax)] //~ ERROR
1+
#![feature(rustdoc_internals)]
2+
#![feature(rustdoc_internals)] //~ ERROR
33

44
pub fn foo() {}

src/test/rustdoc-ui/rustc-check-passes.stderr

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
error[E0636]: the feature `box_syntax` has already been declared
1+
error[E0636]: the feature `rustdoc_internals` has already been declared
22
--> $DIR/rustc-check-passes.rs:2:12
33
|
4-
LL | #![feature(box_syntax)]
5-
| ^^^^^^^^^^
4+
LL | #![feature(rustdoc_internals)]
5+
| ^^^^^^^^^^^^^^^^^
66

77
error: aborting due to previous error
88

src/test/ui/closures/issue-10398.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
#![feature(box_syntax)]
2-
31
fn main() {
4-
let x: Box<_> = box 1;
2+
let x: Box<_> = Box::new(1);
53
let f = move|| {
64
let _a = x;
75
drop(x);

src/test/ui/closures/issue-10398.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0382]: use of moved value: `x`
2-
--> $DIR/issue-10398.rs:7:14
2+
--> $DIR/issue-10398.rs:5:14
33
|
44
LL | let _a = x;
55
| - value moved here

src/test/ui/closures/issue-6801.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// transferring ownership of the box before invoking the stack
33
// closure results in a crash.
44

5-
#![feature(box_syntax)]
5+
66

77
fn twice(x: Box<usize>) -> usize {
88
*x * 2
@@ -13,7 +13,7 @@ fn invoke<F>(f: F) where F: FnOnce() -> usize {
1313
}
1414

1515
fn main() {
16-
let x : Box<usize> = box 9;
16+
let x : Box<usize> = Box::new(9);
1717
let sq = || { *x * *x };
1818

1919
twice(x); //~ ERROR: cannot move out of

0 commit comments

Comments
 (0)