Skip to content

Commit

Permalink
tests: update for MIR debuginfo.
Browse files Browse the repository at this point in the history
  • Loading branch information
eddyb committed Apr 11, 2016
1 parent ce8d4a2 commit 373b6ec
Show file tree
Hide file tree
Showing 17 changed files with 48 additions and 72 deletions.
18 changes: 1 addition & 17 deletions src/compiletest/runtest.rs
Expand Up @@ -868,27 +868,11 @@ fn cleanup_debug_info_options(options: &Option<String>) -> Option<String> {
"-g".to_owned(),
"--debuginfo".to_owned()
];
let mut new_options =
let new_options =
split_maybe_args(options).into_iter()
.filter(|x| !options_to_remove.contains(x))
.collect::<Vec<String>>();

let mut i = 0;
while i + 1 < new_options.len() {
if new_options[i] == "-Z" {
// FIXME #31005 MIR missing debuginfo currently.
if new_options[i + 1] == "orbit" {
// Remove "-Z" and "orbit".
new_options.remove(i);
new_options.remove(i);
continue;
}
// Always skip over -Z's argument.
i += 1;
}
i += 1;
}

Some(new_options.join(" "))
}

Expand Down
5 changes: 1 addition & 4 deletions src/test/compile-fail/bad-intrinsic-monomorphization.rs
Expand Up @@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#![feature(repr_simd, platform_intrinsics, rustc_attrs, core_intrinsics)]
#![feature(repr_simd, platform_intrinsics, core_intrinsics)]
#![allow(warnings)]

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

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

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

#[rustc_no_mir] // FIXME #27840 MIR doesn't provide precise spans for calls.
unsafe fn test_simd_add(a: Foo, b: Foo) -> Foo {
simd_add(a, b)
//~^ ERROR `simd_add` intrinsic: expected SIMD input type, found non-SIMD `Foo`
Expand Down
18 changes: 1 addition & 17 deletions src/test/compile-fail/non-interger-atomic.rs
Expand Up @@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#![feature(core_intrinsics, rustc_attrs)]
#![feature(core_intrinsics)]
#![allow(warnings)]

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

#[rustc_no_mir] // FIXME #27840 MIR doesn't provide precise spans for calls.
unsafe fn test_Quux_cxchg(p: &mut Quux, v: Quux) {
intrinsics::atomic_cxchg(p, v, v);
//~^ ERROR `atomic_cxchg` intrinsic: expected basic integer type, found `[u8; 100]`
Expand Down
3 changes: 1 addition & 2 deletions src/test/compile-fail/simd-intrinsic-generic-arithmetic.rs
Expand Up @@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

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

#[rustc_no_mir] // FIXME #27840 MIR doesn't provide precise spans for calls.
fn main() {
let x = i32x4(0, 0, 0, 0);
let y = u32x4(0, 0, 0, 0);
Expand Down
3 changes: 1 addition & 2 deletions src/test/compile-fail/simd-intrinsic-generic-cast.rs
Expand Up @@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#![feature(repr_simd, platform_intrinsics, rustc_attrs)]
#![feature(repr_simd, platform_intrinsics)]

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

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

Expand Down
3 changes: 1 addition & 2 deletions src/test/compile-fail/simd-intrinsic-generic-comparison.rs
Expand Up @@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#![feature(repr_simd, platform_intrinsics, rustc_attrs)]
#![feature(repr_simd, platform_intrinsics)]

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

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

Expand Down
1 change: 0 additions & 1 deletion src/test/compile-fail/simd-intrinsic-generic-elements.rs
Expand Up @@ -56,7 +56,6 @@ extern "platform-intrinsic" {
fn simd_shuffle8<T, U>(x: T, y: T, idx: [u32; 8]) -> U;
}

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

Expand Down
3 changes: 2 additions & 1 deletion src/test/debuginfo/associated-types.rs
Expand Up @@ -80,7 +80,7 @@

#![allow(unused_variables)]
#![allow(dead_code)]
#![feature(omit_gdb_pretty_printer_section)]
#![feature(omit_gdb_pretty_printer_section, rustc_attrs)]
#![omit_gdb_pretty_printer_section]

trait TraitWithAssocType {
Expand Down Expand Up @@ -127,6 +127,7 @@ fn assoc_tuple<T: TraitWithAssocType>(arg: (T, T::Type)) {
zzz(); // #break
}

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

match arg {
Expand Down
3 changes: 2 additions & 1 deletion src/test/debuginfo/c-style-enum.rs
Expand Up @@ -157,7 +157,8 @@ fn main() {

zzz(); // #break

let a = SINGLE_VARIANT;
// Borrow to avoid an eager load of the constant value in the static.
let a = &SINGLE_VARIANT;
let a = unsafe { AUTO_ONE };
let a = unsafe { MANUAL_ONE };
}
Expand Down
13 changes: 12 additions & 1 deletion src/test/debuginfo/function-prologue-stepping-no-stack-check.rs
Expand Up @@ -247,10 +247,11 @@
// lldb-command:continue

#![allow(dead_code, unused_assignments, unused_variables)]
#![feature(omit_gdb_pretty_printer_section)]
#![feature(omit_gdb_pretty_printer_section, rustc_attrs)]
#![omit_gdb_pretty_printer_section]

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

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

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

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

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

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

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

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

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

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

#[no_stack_check]
#[rustc_no_mir] // FIXME(#31005) MIR debuginfo is missing argument names.
fn loop_expr(mut x: u64, y: u64, z: u64) -> u64 {
loop {
x += z;
Expand Down
3 changes: 2 additions & 1 deletion src/test/debuginfo/no-debug-attribute.rs
Expand Up @@ -23,10 +23,11 @@
// gdb-command:continue

#![allow(unused_variables)]
#![feature(no_debug)]
#![feature(no_debug, rustc_attrs)]
#![feature(omit_gdb_pretty_printer_section)]
#![omit_gdb_pretty_printer_section]

#[rustc_no_mir] // FIXME(#31005) MIR debuginfo is inaccurate for returns.
fn function_with_debuginfo() {
let abc = 10_usize;
return (); // #break
Expand Down
11 changes: 8 additions & 3 deletions src/test/debuginfo/var-captured-in-nested-closure.rs
Expand Up @@ -78,7 +78,7 @@
// lldb-command:continue

#![allow(unused_variables)]
#![feature(box_syntax)]
#![feature(box_syntax, rustc_attrs, stmt_expr_attributes)]
#![feature(omit_gdb_pretty_printer_section)]
#![omit_gdb_pretty_printer_section]

Expand All @@ -88,6 +88,7 @@ struct Struct {
c: usize
}

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

let mut closure = || {
let mut closure =
#[rustc_no_mir] // FIXME(#31005) MIR debuginfo is missing captures.
|| {
let closure_local = 8;

let mut nested_closure = || {
let mut nested_closure =
#[rustc_no_mir] // FIXME(#31005) MIR debuginfo is missing captures.
|| {
zzz(); // #break
variable = constant + a_struct.a + struct_ref.a + *owned + closure_local;
};
Expand Down

0 comments on commit 373b6ec

Please sign in to comment.