Skip to content

Commit c09d637

Browse files
committed
Auto merge of rust-lang#88316 - est31:remove_box_tests, r=Mark-Simulacrum
Remove most box syntax uses from the testsuite except for src/test/ui/issues Removes most box syntax uses from the testsuite outside of the src/test/ui/issues directory. The goal was to only change tests where box syntax is an implementation detail instead of the actual feature being tested. So some tests were left out, like the regression test for rust-lang#87935, or tests where the obtained error message changed significantly. Mostly this replaces box syntax with `Box::new`, but there are some minor drive by improvements, like formatting improvements or `assert_eq` instead of `assert!( == )`. Prior PR that removed box syntax from the compiler and tools: rust-lang#87781
2 parents ac8dd1b + 6550021 commit c09d637

File tree

330 files changed

+999
-1193
lines changed

Some content is hidden

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

330 files changed

+999
-1193
lines changed

src/test/debuginfo/borrowed-struct.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@
6363
// lldbr-check:(f64) *unique_val_interior_ref_2 = 26.5
6464

6565
#![allow(unused_variables)]
66-
#![feature(box_syntax)]
6766
#![feature(omit_gdb_pretty_printer_section)]
6867
#![omit_gdb_pretty_printer_section]
6968

@@ -79,7 +78,7 @@ fn main() {
7978
let stack_val_interior_ref_2: &f64 = &stack_val.y;
8079
let ref_to_unnamed: &SomeStruct = &SomeStruct { x: 11, y: 24.5 };
8180

82-
let unique_val: Box<_> = box SomeStruct { x: 13, y: 26.5 };
81+
let unique_val: Box<_> = Box::new(SomeStruct { x: 13, y: 26.5 });
8382
let unique_val_ref: &SomeStruct = &*unique_val;
8483
let unique_val_interior_ref_1: &isize = &unique_val.x;
8584
let unique_val_interior_ref_2: &f64 = &unique_val.y;

src/test/debuginfo/borrowed-tuple.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737

3838

3939
#![allow(unused_variables)]
40-
#![feature(box_syntax)]
4140
#![feature(omit_gdb_pretty_printer_section)]
4241
#![omit_gdb_pretty_printer_section]
4342

@@ -46,7 +45,7 @@ fn main() {
4645
let stack_val_ref: &(i16, f32) = &stack_val;
4746
let ref_to_unnamed: &(i16, f32) = &(-15, -20f32);
4847

49-
let unique_val: Box<(i16, f32)> = box (-17, -22f32);
48+
let unique_val: Box<(i16, f32)> = Box::new((-17, -22f32));
5049
let unique_val_ref: &(i16, f32) = &*unique_val;
5150

5251
zzz(); // #break

src/test/debuginfo/borrowed-unique-basic.rs

+14-15
Original file line numberDiff line numberDiff line change
@@ -116,51 +116,50 @@
116116
// lldbr-check:(f64) *f64_ref = 3.5
117117

118118
#![allow(unused_variables)]
119-
#![feature(box_syntax)]
120119
#![feature(omit_gdb_pretty_printer_section)]
121120
#![omit_gdb_pretty_printer_section]
122121

123122
fn main() {
124-
let bool_box: Box<bool> = box true;
123+
let bool_box: Box<bool> = Box::new(true);
125124
let bool_ref: &bool = &*bool_box;
126125

127-
let int_box: Box<isize> = box -1;
126+
let int_box: Box<isize> = Box::new(-1);
128127
let int_ref: &isize = &*int_box;
129128

130-
let char_box: Box<char> = box 'a';
129+
let char_box: Box<char> = Box::new('a');
131130
let char_ref: &char = &*char_box;
132131

133-
let i8_box: Box<i8> = box 68;
132+
let i8_box: Box<i8> = Box::new(68);
134133
let i8_ref: &i8 = &*i8_box;
135134

136-
let i16_box: Box<i16> = box -16;
135+
let i16_box: Box<i16> = Box::new(-16);
137136
let i16_ref: &i16 = &*i16_box;
138137

139-
let i32_box: Box<i32> = box -32;
138+
let i32_box: Box<i32> = Box::new(-32);
140139
let i32_ref: &i32 = &*i32_box;
141140

142-
let i64_box: Box<i64> = box -64;
141+
let i64_box: Box<i64> = Box::new(-64);
143142
let i64_ref: &i64 = &*i64_box;
144143

145-
let uint_box: Box<usize> = box 1;
144+
let uint_box: Box<usize> = Box::new(1);
146145
let uint_ref: &usize = &*uint_box;
147146

148-
let u8_box: Box<u8> = box 100;
147+
let u8_box: Box<u8> = Box::new(100);
149148
let u8_ref: &u8 = &*u8_box;
150149

151-
let u16_box: Box<u16> = box 16;
150+
let u16_box: Box<u16> = Box::new(16);
152151
let u16_ref: &u16 = &*u16_box;
153152

154-
let u32_box: Box<u32> = box 32;
153+
let u32_box: Box<u32> = Box::new(32);
155154
let u32_ref: &u32 = &*u32_box;
156155

157-
let u64_box: Box<u64> = box 64;
156+
let u64_box: Box<u64> = Box::new(64);
158157
let u64_ref: &u64 = &*u64_box;
159158

160-
let f32_box: Box<f32> = box 2.5;
159+
let f32_box: Box<f32> = Box::new(2.5);
161160
let f32_ref: &f32 = &*f32_box;
162161

163-
let f64_box: Box<f64> = box 3.5;
162+
let f64_box: Box<f64> = Box::new(3.5);
164163
let f64_ref: &f64 = &*f64_box;
165164

166165
zzz(); // #break

src/test/debuginfo/box.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,12 @@
2424
// lldbr-check:((i32, f64)) *b = { 0 = 2 1 = 3.5 }
2525

2626
#![allow(unused_variables)]
27-
#![feature(box_syntax)]
2827
#![feature(omit_gdb_pretty_printer_section)]
2928
#![omit_gdb_pretty_printer_section]
3029

3130
fn main() {
32-
let a = box 1;
33-
let b = box (2, 3.5f64);
31+
let a = Box::new(1);
32+
let b = Box::new((2, 3.5f64));
3433

3534
zzz(); // #break
3635
}

src/test/debuginfo/boxed-struct.rs

+13-4
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
// lldbr-check:(boxed_struct::StructWithDestructor) *boxed_with_dtor = { x = 77 y = 777 z = 7777 w = 77777 }
2929

3030
#![allow(unused_variables)]
31-
#![feature(box_syntax)]
3231
#![feature(omit_gdb_pretty_printer_section)]
3332
#![omit_gdb_pretty_printer_section]
3433

@@ -52,9 +51,19 @@ impl Drop for StructWithDestructor {
5251

5352
fn main() {
5453

55-
let boxed_with_padding: Box<_> = box StructWithSomePadding { x: 99, y: 999, z: 9999, w: 99999 };
56-
57-
let boxed_with_dtor: Box<_> = box StructWithDestructor { x: 77, y: 777, z: 7777, w: 77777 };
54+
let boxed_with_padding: Box<_> = Box::new(StructWithSomePadding {
55+
x: 99,
56+
y: 999,
57+
z: 9999,
58+
w: 99999,
59+
});
60+
61+
let boxed_with_dtor: Box<_> = Box::new(StructWithDestructor {
62+
x: 77,
63+
y: 777,
64+
z: 7777,
65+
w: 77777,
66+
});
5867
zzz(); // #break
5968
}
6069

src/test/debuginfo/closure-in-generic-function.rs

-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939
// lldbr-check:(i32) *y = 110
4040
// lldb-command:continue
4141

42-
#![feature(box_syntax)]
4342
#![feature(omit_gdb_pretty_printer_section)]
4443
#![omit_gdb_pretty_printer_section]
4544

src/test/debuginfo/destructured-fn-argument.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,6 @@
358358

359359
#![allow(unused_variables)]
360360
#![feature(box_patterns)]
361-
#![feature(box_syntax)]
362361
#![feature(omit_gdb_pretty_printer_section)]
363362
#![omit_gdb_pretty_printer_section]
364363

@@ -480,7 +479,7 @@ fn main() {
480479
managed_box(&(34, 35));
481480
borrowed_pointer(&(36, 37));
482481
contained_borrowed_pointer((&38, 39));
483-
unique_pointer(box (40, 41, 42));
482+
unique_pointer(Box::new((40, 41, 42)));
484483
ref_binding((43, 44, 45));
485484
ref_binding_in_tuple((46, (47, 48)));
486485
ref_binding_in_struct(Struct { a: 49, b: 50 });

src/test/debuginfo/destructured-for-loop-variable.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,6 @@
173173

174174
#![allow(unused_variables)]
175175
#![feature(box_patterns)]
176-
#![feature(box_syntax)]
177176
#![feature(omit_gdb_pretty_printer_section)]
178177
#![omit_gdb_pretty_printer_section]
179178

@@ -214,7 +213,7 @@ fn main() {
214213
y: -300001.5,
215214
z: true
216215
},
217-
box 854237.5);
216+
Box::new(854237.5));
218217

219218
for &(v1,
220219
&Struct { x: x1, y: ref y1, z: z1 },

src/test/debuginfo/destructured-local.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,6 @@
285285

286286
#![allow(unused_variables)]
287287
#![feature(box_patterns)]
288-
#![feature(box_syntax)]
289288
#![feature(omit_gdb_pretty_printer_section)]
290289
#![omit_gdb_pretty_printer_section]
291290

@@ -345,7 +344,7 @@ fn main() {
345344
let (&cc, _) = (&38, 39);
346345

347346
// unique pointer
348-
let box dd = box (40, 41, 42);
347+
let box dd = Box::new((40, 41, 42));
349348

350349
// ref binding
351350
let ref ee = (43, 44, 45);

src/test/debuginfo/generic-method-on-generic-struct.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,6 @@
123123
// lldbr-check:(f32) arg2 = -10.5
124124
// lldb-command:continue
125125

126-
#![feature(box_syntax)]
127126
#![feature(omit_gdb_pretty_printer_section)]
128127
#![omit_gdb_pretty_printer_section]
129128

@@ -155,7 +154,7 @@ fn main() {
155154
let _ = stack.self_by_ref(-1, 2_u16);
156155
let _ = stack.self_by_val(-3, -4_i16);
157156

158-
let owned: Box<_> = box Struct { x: 1234.5f64 };
157+
let owned: Box<_> = Box::new(Struct { x: 1234.5f64 });
159158
let _ = owned.self_by_ref(-5, -6_i32);
160159
let _ = owned.self_by_val(-7, -8_i64);
161160
let _ = owned.self_owned(-9, -10.5_f32);

src/test/debuginfo/method-on-enum.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,6 @@
107107
// lldb-check:[...]$14 = -10
108108
// lldb-command:continue
109109

110-
#![feature(box_syntax)]
111110
#![feature(omit_gdb_pretty_printer_section)]
112111
#![omit_gdb_pretty_printer_section]
113112

@@ -140,7 +139,7 @@ fn main() {
140139
let _ = stack.self_by_ref(-1, -2);
141140
let _ = stack.self_by_val(-3, -4);
142141

143-
let owned: Box<_> = box Enum::Variant1{ x: 1799, y: 1799 };
142+
let owned: Box<_> = Box::new(Enum::Variant1{ x: 1799, y: 1799 });
144143
let _ = owned.self_by_ref(-5, -6);
145144
let _ = owned.self_by_val(-7, -8);
146145
let _ = owned.self_owned(-9, -10);

src/test/debuginfo/method-on-generic-struct.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,6 @@
123123
// lldbr-check:(isize) arg2 = -10
124124
// lldb-command:continue
125125

126-
127-
#![feature(box_syntax)]
128126
#![feature(omit_gdb_pretty_printer_section)]
129127
#![omit_gdb_pretty_printer_section]
130128

@@ -156,7 +154,7 @@ fn main() {
156154
let _ = stack.self_by_ref(-1, -2);
157155
let _ = stack.self_by_val(-3, -4);
158156

159-
let owned: Box<_> = box Struct { x: 1234.5f64 };
157+
let owned: Box<_> = Box::new(Struct { x: 1234.5f64 });
160158
let _ = owned.self_by_ref(-5, -6);
161159
let _ = owned.self_by_val(-7, -8);
162160
let _ = owned.self_owned(-9, -10);

src/test/debuginfo/method-on-struct.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,6 @@
121121
// lldbr-check:(isize) arg2 = -10
122122
// lldb-command:continue
123123

124-
125-
#![feature(box_syntax)]
126124
#![feature(omit_gdb_pretty_printer_section)]
127125
#![omit_gdb_pretty_printer_section]
128126

@@ -154,7 +152,7 @@ fn main() {
154152
let _ = stack.self_by_ref(-1, -2);
155153
let _ = stack.self_by_val(-3, -4);
156154

157-
let owned: Box<_> = box Struct { x: 200 };
155+
let owned: Box<_> = Box::new(Struct { x: 200 });
158156
let _ = owned.self_by_ref(-5, -6);
159157
let _ = owned.self_by_val(-7, -8);
160158
let _ = owned.self_owned(-9, -10);

src/test/debuginfo/method-on-trait.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,6 @@
121121
// lldbr-check:(isize) arg2 = -10
122122
// lldb-command:continue
123123

124-
125-
#![feature(box_syntax)]
126124
#![feature(omit_gdb_pretty_printer_section)]
127125
#![omit_gdb_pretty_printer_section]
128126

@@ -160,7 +158,7 @@ fn main() {
160158
let _ = stack.self_by_ref(-1, -2);
161159
let _ = stack.self_by_val(-3, -4);
162160

163-
let owned: Box<_> = box Struct { x: 200 };
161+
let owned: Box<_> = Box::new(Struct { x: 200 });
164162
let _ = owned.self_by_ref(-5, -6);
165163
let _ = owned.self_by_val(-7, -8);
166164
let _ = owned.self_owned(-9, -10);

src/test/debuginfo/method-on-tuple-struct.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,6 @@
121121
// lldbr-check:(isize) arg2 = -10
122122
// lldb-command:continue
123123

124-
125-
#![feature(box_syntax)]
126124
#![feature(omit_gdb_pretty_printer_section)]
127125
#![omit_gdb_pretty_printer_section]
128126

@@ -152,7 +150,7 @@ fn main() {
152150
let _ = stack.self_by_ref(-1, -2);
153151
let _ = stack.self_by_val(-3, -4);
154152

155-
let owned: Box<_> = box TupleStruct(200, -200.5);
153+
let owned: Box<_> = Box::new(TupleStruct(200, -200.5));
156154
let _ = owned.self_by_ref(-5, -6);
157155
let _ = owned.self_by_val(-7, -8);
158156
let _ = owned.self_owned(-9, -10);

0 commit comments

Comments
 (0)