Skip to content

Commit 373b6ec

Browse files
committed
tests: update for MIR debuginfo.
1 parent ce8d4a2 commit 373b6ec

17 files changed

+48
-72
lines changed

src/compiletest/runtest.rs

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -868,27 +868,11 @@ fn cleanup_debug_info_options(options: &Option<String>) -> Option<String> {
868868
"-g".to_owned(),
869869
"--debuginfo".to_owned()
870870
];
871-
let mut new_options =
871+
let new_options =
872872
split_maybe_args(options).into_iter()
873873
.filter(|x| !options_to_remove.contains(x))
874874
.collect::<Vec<String>>();
875875

876-
let mut i = 0;
877-
while i + 1 < new_options.len() {
878-
if new_options[i] == "-Z" {
879-
// FIXME #31005 MIR missing debuginfo currently.
880-
if new_options[i + 1] == "orbit" {
881-
// Remove "-Z" and "orbit".
882-
new_options.remove(i);
883-
new_options.remove(i);
884-
continue;
885-
}
886-
// Always skip over -Z's argument.
887-
i += 1;
888-
}
889-
i += 1;
890-
}
891-
892876
Some(new_options.join(" "))
893877
}
894878

src/test/compile-fail/bad-intrinsic-monomorphization.rs

Lines changed: 1 addition & 4 deletions
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, rustc_attrs, core_intrinsics)]
11+
#![feature(repr_simd, platform_intrinsics, core_intrinsics)]
1212
#![allow(warnings)]
1313

1414
// Bad monomorphizations could previously cause LLVM asserts even though the
@@ -23,19 +23,16 @@ use std::intrinsics;
2323
#[derive(Copy, Clone)]
2424
struct Foo(i64);
2525

26-
#[rustc_no_mir] // FIXME #27840 MIR doesn't provide precise spans for calls.
2726
unsafe fn test_cttz(v: Foo) -> Foo {
2827
intrinsics::cttz(v)
2928
//~^ ERROR `cttz` intrinsic: expected basic integer type, found `Foo`
3029
}
3130

32-
#[rustc_no_mir] // FIXME #27840 MIR doesn't provide precise spans for calls.
3331
unsafe fn test_fadd_fast(a: Foo, b: Foo) -> Foo {
3432
intrinsics::fadd_fast(a, b)
3533
//~^ ERROR `fadd_fast` intrinsic: expected basic float type, found `Foo`
3634
}
3735

38-
#[rustc_no_mir] // FIXME #27840 MIR doesn't provide precise spans for calls.
3936
unsafe fn test_simd_add(a: Foo, b: Foo) -> Foo {
4037
simd_add(a, b)
4138
//~^ ERROR `simd_add` intrinsic: expected SIMD input type, found non-SIMD `Foo`

src/test/compile-fail/non-interger-atomic.rs

Lines changed: 1 addition & 17 deletions
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(core_intrinsics, rustc_attrs)]
11+
#![feature(core_intrinsics)]
1212
#![allow(warnings)]
1313

1414
use std::intrinsics;
@@ -18,97 +18,81 @@ struct Foo(i64);
1818
type Bar = &'static Fn();
1919
type Quux = [u8; 100];
2020

21-
#[rustc_no_mir] // FIXME #27840 MIR doesn't provide precise spans for calls.
2221
unsafe fn test_bool_load(p: &mut bool, v: bool) {
2322
intrinsics::atomic_load(p);
2423
//~^ ERROR `atomic_load` intrinsic: expected basic integer type, found `bool`
2524
}
2625

27-
#[rustc_no_mir] // FIXME #27840 MIR doesn't provide precise spans for calls.
2826
unsafe fn test_bool_store(p: &mut bool, v: bool) {
2927
intrinsics::atomic_store(p, v);
3028
//~^ ERROR `atomic_store` intrinsic: expected basic integer type, found `bool`
3129
}
3230

33-
#[rustc_no_mir] // FIXME #27840 MIR doesn't provide precise spans for calls.
3431
unsafe fn test_bool_xchg(p: &mut bool, v: bool) {
3532
intrinsics::atomic_xchg(p, v);
3633
//~^ ERROR `atomic_xchg` intrinsic: expected basic integer type, found `bool`
3734
}
3835

39-
#[rustc_no_mir] // FIXME #27840 MIR doesn't provide precise spans for calls.
4036
unsafe fn test_bool_cxchg(p: &mut bool, v: bool) {
4137
intrinsics::atomic_cxchg(p, v, v);
4238
//~^ ERROR `atomic_cxchg` intrinsic: expected basic integer type, found `bool`
4339
}
4440

45-
#[rustc_no_mir] // FIXME #27840 MIR doesn't provide precise spans for calls.
4641
unsafe fn test_Foo_load(p: &mut Foo, v: Foo) {
4742
intrinsics::atomic_load(p);
4843
//~^ ERROR `atomic_load` intrinsic: expected basic integer type, found `Foo`
4944
}
5045

51-
#[rustc_no_mir] // FIXME #27840 MIR doesn't provide precise spans for calls.
5246
unsafe fn test_Foo_store(p: &mut Foo, v: Foo) {
5347
intrinsics::atomic_store(p, v);
5448
//~^ ERROR `atomic_store` intrinsic: expected basic integer type, found `Foo`
5549
}
5650

57-
#[rustc_no_mir] // FIXME #27840 MIR doesn't provide precise spans for calls.
5851
unsafe fn test_Foo_xchg(p: &mut Foo, v: Foo) {
5952
intrinsics::atomic_xchg(p, v);
6053
//~^ ERROR `atomic_xchg` intrinsic: expected basic integer type, found `Foo`
6154
}
6255

63-
#[rustc_no_mir] // FIXME #27840 MIR doesn't provide precise spans for calls.
6456
unsafe fn test_Foo_cxchg(p: &mut Foo, v: Foo) {
6557
intrinsics::atomic_cxchg(p, v, v);
6658
//~^ ERROR `atomic_cxchg` intrinsic: expected basic integer type, found `Foo`
6759
}
6860

69-
#[rustc_no_mir] // FIXME #27840 MIR doesn't provide precise spans for calls.
7061
unsafe fn test_Bar_load(p: &mut Bar, v: Bar) {
7162
intrinsics::atomic_load(p);
7263
//~^ ERROR expected basic integer type, found `&'static std::ops::Fn() + 'static`
7364
}
7465

75-
#[rustc_no_mir] // FIXME #27840 MIR doesn't provide precise spans for calls.
7666
unsafe fn test_Bar_store(p: &mut Bar, v: Bar) {
7767
intrinsics::atomic_store(p, v);
7868
//~^ ERROR expected basic integer type, found `&'static std::ops::Fn() + 'static`
7969
}
8070

81-
#[rustc_no_mir] // FIXME #27840 MIR doesn't provide precise spans for calls.
8271
unsafe fn test_Bar_xchg(p: &mut Bar, v: Bar) {
8372
intrinsics::atomic_xchg(p, v);
8473
//~^ ERROR expected basic integer type, found `&'static std::ops::Fn() + 'static`
8574
}
8675

87-
#[rustc_no_mir] // FIXME #27840 MIR doesn't provide precise spans for calls.
8876
unsafe fn test_Bar_cxchg(p: &mut Bar, v: Bar) {
8977
intrinsics::atomic_cxchg(p, v, v);
9078
//~^ ERROR expected basic integer type, found `&'static std::ops::Fn() + 'static`
9179
}
9280

93-
#[rustc_no_mir] // FIXME #27840 MIR doesn't provide precise spans for calls.
9481
unsafe fn test_Quux_load(p: &mut Quux, v: Quux) {
9582
intrinsics::atomic_load(p);
9683
//~^ ERROR `atomic_load` intrinsic: expected basic integer type, found `[u8; 100]`
9784
}
9885

99-
#[rustc_no_mir] // FIXME #27840 MIR doesn't provide precise spans for calls.
10086
unsafe fn test_Quux_store(p: &mut Quux, v: Quux) {
10187
intrinsics::atomic_store(p, v);
10288
//~^ ERROR `atomic_store` intrinsic: expected basic integer type, found `[u8; 100]`
10389
}
10490

105-
#[rustc_no_mir] // FIXME #27840 MIR doesn't provide precise spans for calls.
10691
unsafe fn test_Quux_xchg(p: &mut Quux, v: Quux) {
10792
intrinsics::atomic_xchg(p, v);
10893
//~^ ERROR `atomic_xchg` intrinsic: expected basic integer type, found `[u8; 100]`
10994
}
11095

111-
#[rustc_no_mir] // FIXME #27840 MIR doesn't provide precise spans for calls.
11296
unsafe fn test_Quux_cxchg(p: &mut Quux, v: Quux) {
11397
intrinsics::atomic_cxchg(p, v, v);
11498
//~^ ERROR `atomic_cxchg` intrinsic: expected basic integer type, found `[u8; 100]`

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

Lines changed: 1 addition & 2 deletions
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, rustc_attrs)]
11+
#![feature(repr_simd, platform_intrinsics)]
1212
#![allow(non_camel_case_types)]
1313
#[repr(simd)]
1414
#[derive(Copy, Clone)]
@@ -34,7 +34,6 @@ 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.
3837
fn main() {
3938
let x = i32x4(0, 0, 0, 0);
4039
let y = u32x4(0, 0, 0, 0);

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

Lines changed: 1 addition & 2 deletions
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, rustc_attrs)]
11+
#![feature(repr_simd, platform_intrinsics)]
1212

1313
#[repr(simd)]
1414
#[derive(Copy, Clone)]
@@ -35,7 +35,6 @@ 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.
3938
fn main() {
4039
let x = i32x4(0, 0, 0, 0);
4140

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

Lines changed: 1 addition & 2 deletions
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, rustc_attrs)]
11+
#![feature(repr_simd, platform_intrinsics)]
1212

1313
#[repr(simd)]
1414
#[derive(Copy, Clone)]
@@ -29,7 +29,6 @@ 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.
3332
fn main() {
3433
let x = i32x4(0, 0, 0, 0);
3534

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ 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.
6059
fn main() {
6160
let x = i32x4(0, 0, 0, 0);
6261

src/test/debuginfo/associated-types.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080

8181
#![allow(unused_variables)]
8282
#![allow(dead_code)]
83-
#![feature(omit_gdb_pretty_printer_section)]
83+
#![feature(omit_gdb_pretty_printer_section, rustc_attrs)]
8484
#![omit_gdb_pretty_printer_section]
8585

8686
trait TraitWithAssocType {
@@ -127,6 +127,7 @@ fn assoc_tuple<T: TraitWithAssocType>(arg: (T, T::Type)) {
127127
zzz(); // #break
128128
}
129129

130+
#[rustc_no_mir] // FIXME(#32790) MIR reuses scopes for match arms.
130131
fn assoc_enum<T: TraitWithAssocType>(arg: Enum<T>) {
131132

132133
match arg {

src/test/debuginfo/c-style-enum.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,8 @@ fn main() {
157157

158158
zzz(); // #break
159159

160-
let a = SINGLE_VARIANT;
160+
// Borrow to avoid an eager load of the constant value in the static.
161+
let a = &SINGLE_VARIANT;
161162
let a = unsafe { AUTO_ONE };
162163
let a = unsafe { MANUAL_ONE };
163164
}

src/test/debuginfo/function-prologue-stepping-no-stack-check.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,10 +247,11 @@
247247
// lldb-command:continue
248248

249249
#![allow(dead_code, unused_assignments, unused_variables)]
250-
#![feature(omit_gdb_pretty_printer_section)]
250+
#![feature(omit_gdb_pretty_printer_section, rustc_attrs)]
251251
#![omit_gdb_pretty_printer_section]
252252

253253
#[no_stack_check]
254+
#[rustc_no_mir] // FIXME(#31005) MIR debuginfo is missing argument names.
254255
fn immediate_args(a: isize, b: bool, c: f64) {
255256
println!("");
256257
}
@@ -267,43 +268,51 @@ struct BigStruct {
267268
}
268269

269270
#[no_stack_check]
271+
#[rustc_no_mir] // FIXME(#31005) MIR debuginfo is missing argument names.
270272
fn non_immediate_args(a: BigStruct, b: BigStruct) {
271273
println!("");
272274
}
273275

274276
#[no_stack_check]
277+
#[rustc_no_mir] // FIXME(#31005) MIR debuginfo is missing argument names.
275278
fn binding(a: i64, b: u64, c: f64) {
276279
let x = 0;
277280
println!("");
278281
}
279282

280283
#[no_stack_check]
284+
#[rustc_no_mir] // FIXME(#31005) MIR debuginfo is missing argument names.
281285
fn assignment(mut a: u64, b: u64, c: f64) {
282286
a = b;
283287
println!("");
284288
}
285289

286290
#[no_stack_check]
291+
#[rustc_no_mir] // FIXME(#31005) MIR debuginfo is missing argument names.
287292
fn function_call(x: u64, y: u64, z: f64) {
288293
println!("Hi!")
289294
}
290295

291296
#[no_stack_check]
297+
#[rustc_no_mir] // FIXME(#31005) MIR debuginfo is missing argument names.
292298
fn identifier(x: u64, y: u64, z: f64) -> u64 {
293299
x
294300
}
295301

296302
#[no_stack_check]
303+
#[rustc_no_mir] // FIXME(#31005) MIR debuginfo is missing argument names.
297304
fn return_expr(x: u64, y: u64, z: f64) -> u64 {
298305
return x;
299306
}
300307

301308
#[no_stack_check]
309+
#[rustc_no_mir] // FIXME(#31005) MIR debuginfo is missing argument names.
302310
fn arithmetic_expr(x: u64, y: u64, z: f64) -> u64 {
303311
x + y
304312
}
305313

306314
#[no_stack_check]
315+
#[rustc_no_mir] // FIXME(#31005) MIR debuginfo is missing argument names.
307316
fn if_expr(x: u64, y: u64, z: f64) -> u64 {
308317
if x + y < 1000 {
309318
x
@@ -313,6 +322,7 @@ fn if_expr(x: u64, y: u64, z: f64) -> u64 {
313322
}
314323

315324
#[no_stack_check]
325+
#[rustc_no_mir] // FIXME(#31005) MIR debuginfo is missing argument names.
316326
fn while_expr(mut x: u64, y: u64, z: u64) -> u64 {
317327
while x + y < 1000 {
318328
x += z
@@ -321,6 +331,7 @@ fn while_expr(mut x: u64, y: u64, z: u64) -> u64 {
321331
}
322332

323333
#[no_stack_check]
334+
#[rustc_no_mir] // FIXME(#31005) MIR debuginfo is missing argument names.
324335
fn loop_expr(mut x: u64, y: u64, z: u64) -> u64 {
325336
loop {
326337
x += z;

src/test/debuginfo/no-debug-attribute.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,11 @@
2323
// gdb-command:continue
2424

2525
#![allow(unused_variables)]
26-
#![feature(no_debug)]
26+
#![feature(no_debug, rustc_attrs)]
2727
#![feature(omit_gdb_pretty_printer_section)]
2828
#![omit_gdb_pretty_printer_section]
2929

30+
#[rustc_no_mir] // FIXME(#31005) MIR debuginfo is inaccurate for returns.
3031
fn function_with_debuginfo() {
3132
let abc = 10_usize;
3233
return (); // #break

src/test/debuginfo/var-captured-in-nested-closure.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@
7878
// lldb-command:continue
7979

8080
#![allow(unused_variables)]
81-
#![feature(box_syntax)]
81+
#![feature(box_syntax, rustc_attrs, stmt_expr_attributes)]
8282
#![feature(omit_gdb_pretty_printer_section)]
8383
#![omit_gdb_pretty_printer_section]
8484

@@ -88,6 +88,7 @@ struct Struct {
8888
c: usize
8989
}
9090

91+
#[rustc_no_mir] // FIXME(#31005) MIR debuginfo is missing captures.
9192
fn main() {
9293
let mut variable = 1;
9394
let constant = 2;
@@ -101,10 +102,14 @@ fn main() {
101102
let struct_ref = &a_struct;
102103
let owned: Box<_> = box 6;
103104

104-
let mut closure = || {
105+
let mut closure =
106+
#[rustc_no_mir] // FIXME(#31005) MIR debuginfo is missing captures.
107+
|| {
105108
let closure_local = 8;
106109

107-
let mut nested_closure = || {
110+
let mut nested_closure =
111+
#[rustc_no_mir] // FIXME(#31005) MIR debuginfo is missing captures.
112+
|| {
108113
zzz(); // #break
109114
variable = constant + a_struct.a + struct_ref.a + *owned + closure_local;
110115
};

0 commit comments

Comments
 (0)