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

Lines changed: 20 additions & 4 deletions
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

Lines changed: 1 addition & 0 deletions
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

Lines changed: 3 additions & 0 deletions
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

Lines changed: 1 addition & 0 deletions
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

Lines changed: 1 addition & 0 deletions
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

Lines changed: 1 addition & 0 deletions
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

Lines changed: 2 additions & 0 deletions
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

Lines changed: 3 additions & 0 deletions
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

Lines changed: 5 additions & 0 deletions
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

Lines changed: 2 additions & 0 deletions
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

0 commit comments

Comments
 (0)