Skip to content

Commit 0c413a8

Browse files
committed
Add #[rustc_no_mir] to make tests pass with -Z orbit.
1 parent 22b3c70 commit 0c413a8

Some content is hidden

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

44 files changed

+189
-43
lines changed

src/compiletest/runtest.rs

+20-4
Original file line numberDiff line numberDiff line change
@@ -863,12 +863,28 @@ fn cleanup_debug_info_options(options: &Option<String>) -> Option<String> {
863863
"-g".to_owned(),
864864
"--debuginfo".to_owned()
865865
];
866-
let new_options =
866+
let mut new_options =
867867
split_maybe_args(options).into_iter()
868868
.filter(|x| !options_to_remove.contains(x))
869-
.collect::<Vec<String>>()
870-
.join(" ");
871-
Some(new_options)
869+
.collect::<Vec<String>>();
870+
871+
let mut i = 0;
872+
while i + 1 < new_options.len() {
873+
if new_options[i] == "-Z" {
874+
// FIXME #31005 MIR missing debuginfo currently.
875+
if new_options[i + 1] == "orbit" {
876+
// Remove "-Z" and "orbit".
877+
new_options.remove(i);
878+
new_options.remove(i);
879+
continue;
880+
}
881+
// Always skip over -Z's argument.
882+
i += 1;
883+
}
884+
i += 1;
885+
}
886+
887+
Some(new_options.join(" "))
872888
}
873889

874890
fn check_debugger_output(debugger_run_result: &ProcRes, check_lines: &[String]) {

src/libcore/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@
7272
#![feature(reflect)]
7373
#![feature(unwind_attributes)]
7474
#![feature(repr_simd, platform_intrinsics)]
75+
#![feature(rustc_attrs)]
7576
#![feature(staged_api)]
7677
#![feature(unboxed_closures)]
7778

src/libcore/num/mod.rs

+3
Original file line numberDiff line numberDiff line change
@@ -1008,6 +1008,7 @@ macro_rules! int_impl {
10081008
/// ```
10091009
#[stable(feature = "rust1", since = "1.0.0")]
10101010
#[inline]
1011+
#[cfg_attr(not(stage0), rustc_no_mir)] // FIXME #29769 MIR overflow checking is TBD.
10111012
pub fn pow(self, mut exp: u32) -> Self {
10121013
let mut base = self;
10131014
let mut acc = Self::one();
@@ -1049,6 +1050,7 @@ macro_rules! int_impl {
10491050
/// ```
10501051
#[stable(feature = "rust1", since = "1.0.0")]
10511052
#[inline]
1053+
#[cfg_attr(not(stage0), rustc_no_mir)] // FIXME #29769 MIR overflow checking is TBD.
10521054
pub fn abs(self) -> Self {
10531055
if self.is_negative() {
10541056
// Note that the #[inline] above means that the overflow
@@ -2013,6 +2015,7 @@ macro_rules! uint_impl {
20132015
/// ```
20142016
#[stable(feature = "rust1", since = "1.0.0")]
20152017
#[inline]
2018+
#[cfg_attr(not(stage0), rustc_no_mir)] // FIXME #29769 MIR overflow checking is TBD.
20162019
pub fn pow(self, mut exp: u32) -> Self {
20172020
let mut base = self;
20182021
let mut acc = Self::one();

src/libstd/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,7 @@
250250
#![feature(raw)]
251251
#![feature(repr_simd)]
252252
#![feature(reflect_marker)]
253+
#![feature(rustc_attrs)]
253254
#![feature(shared)]
254255
#![feature(slice_bytes)]
255256
#![feature(slice_concat_ext)]

src/libstd/num/f32.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1371,6 +1371,7 @@ mod tests {
13711371
}
13721372

13731373
#[test]
1374+
#[rustc_no_mir] // FIXME #27840 MIR NAN ends up negative.
13741375
fn test_integer_decode() {
13751376
assert_eq!(3.14159265359f32.integer_decode(), (13176795, -22, 1));
13761377
assert_eq!((-8573.5918555f32).integer_decode(), (8779358, -10, -1));

src/libstd/num/f64.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1264,6 +1264,7 @@ mod tests {
12641264
}
12651265

12661266
#[test]
1267+
#[rustc_no_mir] // FIXME #27840 MIR NAN ends up negative.
12671268
fn test_integer_decode() {
12681269
assert_eq!(3.14159265359f64.integer_decode(), (7074237752028906, -51, 1));
12691270
assert_eq!((-8573.5918555f64).integer_decode(), (4713381968463931, -39, -1));

src/test/codegen/adjustments.rs

+2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
// compile-flags: -C no-prepopulate-passes
1212

1313
#![crate_type = "lib"]
14+
#![feature(rustc_attrs)]
1415

1516
// Hack to get the correct size for the length part in slices
1617
// CHECK: @helper([[USIZE:i[0-9]+]])
@@ -20,6 +21,7 @@ fn helper(_: usize) {
2021

2122
// CHECK-LABEL: @no_op_slice_adjustment
2223
#[no_mangle]
24+
#[rustc_no_mir] // FIXME #27840 MIR has different codegen.
2325
pub fn no_op_slice_adjustment(x: &[u8]) -> &[u8] {
2426
// We used to generate an extra alloca and memcpy for the block's trailing expression value, so
2527
// check that we copy directly to the return value slot

src/test/codegen/coercions.rs

+3
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,22 @@
1111
// compile-flags: -C no-prepopulate-passes
1212

1313
#![crate_type = "lib"]
14+
#![feature(rustc_attrs)]
1415

1516
static X: i32 = 5;
1617

1718
// CHECK-LABEL: @raw_ptr_to_raw_ptr_noop
1819
// CHECK-NOT: alloca
1920
#[no_mangle]
21+
#[rustc_no_mir] // FIXME #27840 MIR has different codegen.
2022
pub fn raw_ptr_to_raw_ptr_noop() -> *const i32{
2123
&X as *const i32
2224
}
2325

2426
// CHECK-LABEL: @reference_to_raw_ptr_noop
2527
// CHECK-NOT: alloca
2628
#[no_mangle]
29+
#[rustc_no_mir] // FIXME #27840 MIR has different codegen.
2730
pub fn reference_to_raw_ptr_noop() -> *const i32 {
2831
&X
2932
}

src/test/codegen/consts.rs

+5
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
// compile-flags: -C no-prepopulate-passes
1212

1313
#![crate_type = "lib"]
14+
#![feature(rustc_attrs)]
1415

1516
// Below, these constants are defined as enum variants that by itself would
1617
// have a lower alignment than the enum type. Ensure that we mark them
@@ -39,18 +40,21 @@ pub static STATIC: E<i16, i32> = E::A(0);
3940

4041
// CHECK-LABEL: @static_enum_const
4142
#[no_mangle]
43+
#[rustc_no_mir] // FIXME #27840 MIR has different codegen.
4244
pub fn static_enum_const() -> E<i16, i32> {
4345
STATIC
4446
}
4547

4648
// CHECK-LABEL: @inline_enum_const
4749
#[no_mangle]
50+
#[rustc_no_mir] // FIXME #27840 MIR has different codegen.
4851
pub fn inline_enum_const() -> E<i8, i16> {
4952
E::A(0)
5053
}
5154

5255
// CHECK-LABEL: @low_align_const
5356
#[no_mangle]
57+
#[rustc_no_mir] // FIXME #27840 MIR has different codegen.
5458
pub fn low_align_const() -> E<i16, [i16; 3]> {
5559
// Check that low_align_const and high_align_const use the same constant
5660
// CHECK: call void @llvm.memcpy.{{.*}}(i8* %{{[0-9]+}}, i8* {{.*}} [[LOW_HIGH:@const[0-9]+]]
@@ -59,6 +63,7 @@ pub fn low_align_const() -> E<i16, [i16; 3]> {
5963

6064
// CHECK-LABEL: @high_align_const
6165
#[no_mangle]
66+
#[rustc_no_mir] // FIXME #27840 MIR has different codegen.
6267
pub fn high_align_const() -> E<i16, i32> {
6368
// Check that low_align_const and high_align_const use the same constant
6469
// CHECK: call void @llvm.memcpy.{{.*}}(i8* %{{[0-9]}}, i8* {{.*}} [[LOW_HIGH]]

src/test/codegen/drop.rs

+2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
// compile-flags: -C no-prepopulate-passes
1212

1313
#![crate_type = "lib"]
14+
#![feature(rustc_attrs)]
1415

1516
struct SomeUniqueName;
1617

@@ -24,6 +25,7 @@ pub fn possibly_unwinding() {
2425

2526
// CHECK-LABEL: @droppy
2627
#[no_mangle]
28+
#[rustc_no_mir] // FIXME #27840 MIR has different codegen.
2729
pub fn droppy() {
2830
// Check that there are exactly 6 drop calls. The cleanups for the unwinding should be reused, so
2931
// that's one new drop call per call to possibly_unwinding(), and finally 3 drop calls for the

src/test/codegen/refs.rs

+2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
// compile-flags: -C no-prepopulate-passes
1212

1313
#![crate_type = "lib"]
14+
#![feature(rustc_attrs)]
1415

1516
// Hack to get the correct size for the length part in slices
1617
// CHECK: @helper([[USIZE:i[0-9]+]])
@@ -20,6 +21,7 @@ fn helper(_: usize) {
2021

2122
// CHECK-LABEL: @ref_dst
2223
#[no_mangle]
24+
#[rustc_no_mir] // FIXME #27840 MIR has different codegen.
2325
pub fn ref_dst(s: &[u8]) {
2426
// We used to generate an extra alloca and memcpy to ref the dst, so check that we copy
2527
// directly to the alloca for "x"

src/test/codegen/stores.rs

+3
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
// compile-flags: -C no-prepopulate-passes
1212

1313
#![crate_type = "lib"]
14+
#![feature(rustc_attrs)]
1415

1516
pub struct Bytes {
1617
a: u8,
@@ -23,6 +24,7 @@ pub struct Bytes {
2324
// The array is stored as i32, but its alignment is lower, go with 1 byte to avoid target
2425
// dependent alignment
2526
#[no_mangle]
27+
#[rustc_no_mir] // FIXME #27840 MIR has different codegen.
2628
pub fn small_array_alignment(x: &mut [i8; 4], y: [i8; 4]) {
2729
// CHECK: [[VAR:%[0-9]+]] = bitcast [4 x i8]* %y to i32*
2830
// CHECK: store i32 %{{.*}}, i32* [[VAR]], align 1
@@ -33,6 +35,7 @@ pub fn small_array_alignment(x: &mut [i8; 4], y: [i8; 4]) {
3335
// The struct is stored as i32, but its alignment is lower, go with 1 byte to avoid target
3436
// dependent alignment
3537
#[no_mangle]
38+
#[rustc_no_mir] // FIXME #27840 MIR has different codegen.
3639
pub fn small_struct_alignment(x: &mut Bytes, y: Bytes) {
3740
// CHECK: [[VAR:%[0-9]+]] = bitcast %Bytes* %y to i32*
3841
// CHECK: store i32 %{{.*}}, i32* [[VAR]], align 1

src/test/compile-fail/const-err.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
#[allow(exceeding_bitshifts)]
12-
#[deny(const_err)]
11+
#![feature(rustc_attrs)]
12+
#![allow(exceeding_bitshifts)]
13+
#![deny(const_err)]
1314

1415
fn black_box<T>(_: T) {
1516
unimplemented!()
@@ -18,6 +19,7 @@ fn black_box<T>(_: T) {
1819
const BLA: u8 = 200u8 + 200u8;
1920
//~^ ERROR attempted to add with overflow
2021

22+
#[rustc_no_mir] // FIXME #29769 MIR overflow checking is TBD.
2123
fn main() {
2224
let a = -std::i8::MIN;
2325
//~^ WARN attempted to negate with overflow

src/test/compile-fail/const-eval-overflow.rs

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
#![feature(rustc_attrs)]
1112
#![allow(unused_imports)]
1213

1314
// Note: the relevant lint pass here runs before some of the constant
@@ -103,6 +104,7 @@ const VALS_U64: (u64, u64, u64, u64) =
103104
//~^ ERROR attempted to mul with overflow
104105
);
105106

107+
#[rustc_no_mir] // FIXME #29769 MIR overflow checking is TBD.
106108
fn main() {
107109
foo(VALS_I8);
108110
foo(VALS_I16);

src/test/compile-fail/intrinsic-return-address.rs

+4-9
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,10 @@ extern "rust-intrinsic" {
1515
fn return_address() -> *const u8;
1616
}
1717

18-
unsafe fn f() {
19-
let _ = return_address();
20-
//~^ ERROR invalid use of `return_address` intrinsic: function does not use out pointer
21-
}
18+
unsafe fn f() { let _ = return_address(); }
19+
//~^ ERROR invalid use of `return_address` intrinsic: function does not use out pointer
2220

23-
unsafe fn g() -> isize {
24-
let _ = return_address();
25-
//~^ ERROR invalid use of `return_address` intrinsic: function does not use out pointer
26-
0
27-
}
21+
unsafe fn g() -> isize { let _ = return_address(); 0 }
22+
//~^ ERROR invalid use of `return_address` intrinsic: function does not use out pointer
2823

2924
fn main() {}

src/test/compile-fail/simd-intrinsic-generic-arithmetic.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
#![feature(repr_simd, platform_intrinsics)]
11+
#![feature(repr_simd, platform_intrinsics, rustc_attrs)]
1212
#![allow(non_camel_case_types)]
1313
#[repr(simd)]
1414
#[derive(Copy, Clone)]
@@ -34,6 +34,7 @@ extern "platform-intrinsic" {
3434
fn simd_xor<T>(x: T, y: T) -> T;
3535
}
3636

37+
#[rustc_no_mir] // FIXME #27840 MIR doesn't provide precise spans for calls.
3738
fn main() {
3839
let x = i32x4(0, 0, 0, 0);
3940
let y = u32x4(0, 0, 0, 0);

src/test/compile-fail/simd-intrinsic-generic-cast.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
#![feature(repr_simd, platform_intrinsics)]
11+
#![feature(repr_simd, platform_intrinsics, rustc_attrs)]
1212

1313
#[repr(simd)]
1414
#[derive(Copy, Clone)]
@@ -35,6 +35,7 @@ extern "platform-intrinsic" {
3535
fn simd_cast<T, U>(x: T) -> U;
3636
}
3737

38+
#[rustc_no_mir] // FIXME #27840 MIR doesn't provide precise spans for calls.
3839
fn main() {
3940
let x = i32x4(0, 0, 0, 0);
4041

src/test/compile-fail/simd-intrinsic-generic-comparison.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
#![feature(repr_simd, platform_intrinsics)]
11+
#![feature(repr_simd, platform_intrinsics, rustc_attrs)]
1212

1313
#[repr(simd)]
1414
#[derive(Copy, Clone)]
@@ -29,6 +29,7 @@ extern "platform-intrinsic" {
2929
fn simd_ge<T, U>(x: T, y: T) -> U;
3030
}
3131

32+
#[rustc_no_mir] // FIXME #27840 MIR doesn't provide precise spans for calls.
3233
fn main() {
3334
let x = i32x4(0, 0, 0, 0);
3435

src/test/compile-fail/simd-intrinsic-generic-elements.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
#![feature(repr_simd, platform_intrinsics)]
11+
#![feature(repr_simd, platform_intrinsics, rustc_attrs)]
1212

1313
#[repr(simd)]
1414
#[derive(Copy, Clone)]
@@ -56,6 +56,7 @@ extern "platform-intrinsic" {
5656
fn simd_shuffle8<T, U>(x: T, y: T, idx: [u32; 8]) -> U;
5757
}
5858

59+
#[rustc_no_mir] // FIXME #27840 MIR doesn't provide precise spans for calls.
5960
fn main() {
6061
let x = i32x4(0, 0, 0, 0);
6162

src/test/run-fail/divide-by-zero.rs

+5
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,12 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
// ignore-pretty : (#23623) problems when ending with // comments
12+
1113
// error-pattern:attempted to divide by zero
14+
15+
#![feature(rustc_attrs)]
16+
#[rustc_no_mir] // FIXME #29769 MIR overflow checking is TBD.
1217
fn main() {
1318
let y = 0;
1419
let _z = 1 / y;

src/test/run-fail/mod-zero.rs

+5
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,12 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
// ignore-pretty : (#23623) problems when ending with // comments
12+
1113
// error-pattern:attempted remainder with a divisor of zero
14+
15+
#![feature(rustc_attrs)]
16+
#[rustc_no_mir] // FIXME #29769 MIR overflow checking is TBD.
1217
fn main() {
1318
let y = 0;
1419
let _z = 1 % y;

src/test/run-fail/overflowing-add.rs

+4
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,14 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
// ignore-pretty : (#23623) problems when ending with // comments
12+
1113
// error-pattern:thread '<main>' panicked at 'arithmetic operation overflowed'
1214
// compile-flags: -C debug-assertions
1315

1416

17+
#![feature(rustc_attrs)]
18+
#[rustc_no_mir] // FIXME #29769 MIR overflow checking is TBD.
1519
fn main() {
1620
let _x = 200u8 + 200u8 + 200u8;
1721
}

0 commit comments

Comments
 (0)