Skip to content

Commit

Permalink
Rollup merge of rust-lang#121531 - saethlin:ignore-less-debug, r=comp…
Browse files Browse the repository at this point in the history
…iler-errors

Ignore less tests in debug builds

Since rust-lang#120594 and rust-lang#120863, nearly all UB-detecting debug assertions get compiled out of code that is monomorphized by a crate built with debug assertions disabled.

Which means that if we default all our codegen tests to `-Cdebug-assertions=no`, most of them work just fine against a sysroot built with debug assertions.

I also tried to explain a bit better why some tests need to be skipped, for those that still need to be skipped.
  • Loading branch information
matthiaskrgr committed Feb 24, 2024
2 parents b87a713 + 2f3c0b9 commit d978a1c
Show file tree
Hide file tree
Showing 59 changed files with 14 additions and 62 deletions.
7 changes: 5 additions & 2 deletions src/tools/compiletest/src/runtest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2503,8 +2503,11 @@ impl<'test> TestCx<'test> {
// overridden by `compile-flags`.
rustc.arg("-Copt-level=2");
}
RunPassValgrind | Pretty | DebugInfo | Codegen | Rustdoc | RustdocJson | RunMake
| CodegenUnits | JsDocTest | Assembly => {
Assembly | Codegen => {
rustc.arg("-Cdebug-assertions=no");
}
RunPassValgrind | Pretty | DebugInfo | Rustdoc | RustdocJson | RunMake
| CodegenUnits | JsDocTest => {
// do not use JSON output
}
}
Expand Down
1 change: 0 additions & 1 deletion tests/assembly/option-nonzero-eq.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
//@ compile-flags: --crate-type=lib -O -C llvm-args=-x86-asm-syntax=intel
//@ only-x86_64
//@ ignore-sgx
//@ ignore-debug

use std::cmp::Ordering;

Expand Down
1 change: 0 additions & 1 deletion tests/assembly/slice-is_ascii.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
//@ compile-flags: --crate-type=lib -O -C llvm-args=-x86-asm-syntax=intel
//@ only-x86_64
//@ ignore-sgx
//@ ignore-debug

#![feature(str_internals)]

Expand Down
1 change: 0 additions & 1 deletion tests/assembly/static-relocation-model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
//@ [A64] needs-llvm-components: aarch64
//@ [ppc64le] compile-flags: --target powerpc64le-unknown-linux-gnu -Crelocation-model=static
//@ [ppc64le] needs-llvm-components: powerpc
//@ ignore-debug: alignment checks insert panics that we don't have a lang item for

#![feature(no_core, lang_items)]
#![no_core]
Expand Down
1 change: 0 additions & 1 deletion tests/codegen/align-offset.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
//@ compile-flags: -O
//@ ignore-debug (debug assertions in `slice::from_raw_parts` block optimizations)

#![crate_type = "lib"]

Expand Down
1 change: 0 additions & 1 deletion tests/codegen/array-map.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
//@ compile-flags: -C opt-level=3 -C target-cpu=x86-64-v3
//@ only-x86_64
//@ ignore-debug (the extra assertions get in the way)

#![crate_type = "lib"]

Expand Down
1 change: 0 additions & 1 deletion tests/codegen/ascii-char.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
//@ compile-flags: -C opt-level=1
//@ ignore-debug (the extra assertions get in the way)

#![crate_type = "lib"]
#![feature(ascii_char)]
Expand Down
1 change: 0 additions & 1 deletion tests/codegen/binary-search-index-no-bound-check.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
//@ compile-flags: -O
//@ ignore-debug: the debug assertions get in the way
#![crate_type = "lib"]

// Make sure no bounds checks are emitted when slicing or indexing
Expand Down
1 change: 0 additions & 1 deletion tests/codegen/infallible-unwrap-in-opt-z.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
//@ compile-flags: -C opt-level=z --edition=2021
//@ ignore-debug

#![crate_type = "lib"]

Expand Down
1 change: 0 additions & 1 deletion tests/codegen/issue-97217.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
//@ compile-flags: -C opt-level=3
//@ ignore-debug: the debug assertions get in the way
//@ min-llvm-version: 17.0.2
#![crate_type = "lib"]

Expand Down
1 change: 0 additions & 1 deletion tests/codegen/issues/issue-101082.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
//@ compile-flags: -O
//@ ignore-debug: the debug assertions get in the way

#![crate_type = "lib"]

Expand Down
1 change: 0 additions & 1 deletion tests/codegen/issues/issue-101814.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
//@ compile-flags: -O
//@ ignore-debug: the debug assertions get in the way

#![crate_type = "lib"]

Expand Down
1 change: 0 additions & 1 deletion tests/codegen/issues/issue-106369.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
//@ compile-flags: -O
//@ ignore-debug (the extra assertions get in the way)

#![crate_type = "lib"]

Expand Down
1 change: 0 additions & 1 deletion tests/codegen/issues/issue-116878.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
//@ compile-flags: -O
//@ ignore-debug: the debug assertions get in the way
#![crate_type = "lib"]

/// Make sure no bounds checks are emitted after a `get_unchecked`.
Expand Down
1 change: 0 additions & 1 deletion tests/codegen/issues/issue-37945.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
//@ compile-flags: -O -Zmerge-functions=disabled
//@ ignore-32bit LLVM has a bug with them
//@ ignore-debug

// Check that LLVM understands that `Iter` pointer is not null. Issue #37945.

Expand Down
1 change: 0 additions & 1 deletion tests/codegen/issues/issue-45222.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
//@ compile-flags: -O
//@ ignore-debug: the debug assertions get in the way

#![crate_type = "lib"]

Expand Down
1 change: 0 additions & 1 deletion tests/codegen/issues/issue-45466.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
//@ compile-flags: -O
//@ ignore-debug: the debug assertions get in the way

#![crate_type="rlib"]

Expand Down
1 change: 0 additions & 1 deletion tests/codegen/issues/issue-45964-bounds-check-slice-pos.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// prevent optimizing away bounds checks

//@ compile-flags: -O
//@ ignore-debug: the debug assertions get in the way

#![crate_type="rlib"]

Expand Down
1 change: 0 additions & 1 deletion tests/codegen/issues/issue-69101-bounds-check.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
//@ compile-flags: -O
//@ ignore-debug: the debug assertions get in the way
#![crate_type = "lib"]

// Make sure no bounds checks are emitted in the loop when upfront slicing
Expand Down
1 change: 0 additions & 1 deletion tests/codegen/issues/issue-73258.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
//@ compile-flags: -O
//@ ignore-debug (the extra assertions get in the way)

#![crate_type = "lib"]

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
//@ compile-flags: -O
//@ ignore-debug: the debug assertions get in the way
#![crate_type = "lib"]

// Make sure no bounds checks are emitted when slicing or indexing
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
//@ ignore-debug: The debug assertions get in the way
//@ compile-flags: -O

#![crate_type = "lib"]
Expand Down
1 change: 0 additions & 1 deletion tests/codegen/iter-repeat-n-trivial-drop.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
//@ compile-flags: -O
//@ only-x86_64
//@ ignore-debug: the debug assertions get in the way

#![crate_type = "lib"]
#![feature(iter_repeat_n)]
Expand Down
1 change: 0 additions & 1 deletion tests/codegen/layout-size-checks.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
//@ compile-flags: -O
//@ only-x86_64
//@ ignore-debug: the debug assertions get in the way

#![crate_type = "lib"]

Expand Down
1 change: 0 additions & 1 deletion tests/codegen/lib-optimizations/iter-sum.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
//@ ignore-debug: the debug assertions get in the way
//@ compile-flags: -O
//@ only-x86_64 (vectorization varies between architectures)
#![crate_type = "lib"]
Expand Down
2 changes: 1 addition & 1 deletion tests/codegen/mem-replace-big-type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// known to be `1` after inlining).

//@ compile-flags: -C no-prepopulate-passes -Zinline-mir=no
//@ ignore-debug: the debug assertions get in the way
//@ ignore-debug: precondition checks in ptr::read make them a bad candidate for MIR inlining

#![crate_type = "lib"]

Expand Down
2 changes: 1 addition & 1 deletion tests/codegen/mem-replace-simple-type.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//@ compile-flags: -O -C no-prepopulate-passes
//@ only-x86_64 (to not worry about usize differing)
//@ ignore-debug (the debug assertions get in the way)
//@ ignore-debug: precondition checks make mem::replace not a candidate for MIR inlining

#![crate_type = "lib"]

Expand Down
1 change: 0 additions & 1 deletion tests/codegen/ptr-arithmetic.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
//@ compile-flags: -O -Z merge-functions=disabled
//@ ignore-debug (the extra assertions get in the way)

#![crate_type = "lib"]

Expand Down
1 change: 0 additions & 1 deletion tests/codegen/ptr-read-metadata.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
//@ compile-flags: -O -Z merge-functions=disabled
//@ ignore-debug (the extra assertions get in the way)

#![crate_type = "lib"]

Expand Down
1 change: 0 additions & 1 deletion tests/codegen/simd/simd-wide-sum.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
//@ revisions: llvm mir-opt3
//@ compile-flags: -C opt-level=3 -Z merge-functions=disabled --edition=2021
//@ only-x86_64
//@ ignore-debug: the debug assertions get in the way
//@ [mir-opt3]compile-flags: -Zmir-opt-level=3
//@ [mir-opt3]build-pass

Expand Down
1 change: 0 additions & 1 deletion tests/codegen/simd/swap-simd-types.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
//@ compile-flags: -O -C target-feature=+avx
//@ only-x86_64
//@ ignore-debug: the debug assertions get in the way

#![crate_type = "lib"]

Expand Down
1 change: 0 additions & 1 deletion tests/codegen/slice-as_chunks.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
//@ compile-flags: -O
//@ only-64bit (because the LLVM type of i64 for usize shows up)
//@ ignore-debug: the debug assertions get in the way

#![crate_type = "lib"]
#![feature(slice_as_chunks)]
Expand Down
1 change: 0 additions & 1 deletion tests/codegen/slice-indexing.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
//@ compile-flags: -O
//@ only-64bit (because the LLVM type of i64 for usize shows up)
//@ ignore-debug: the debug assertions get in the way

#![crate_type = "lib"]

Expand Down
1 change: 0 additions & 1 deletion tests/codegen/slice-iter-fold.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
//@ ignore-debug: the debug assertions get in the way
//@ compile-flags: -O
#![crate_type = "lib"]

Expand Down
1 change: 0 additions & 1 deletion tests/codegen/slice-iter-len-eq-zero.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
//@ compile-flags: -O
//@ ignore-debug: the debug assertions add extra comparisons
#![crate_type = "lib"]

type Demo = [u8; 3];
Expand Down
1 change: 0 additions & 1 deletion tests/codegen/slice-iter-nonnull.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
//@ compile-flags: -O
//@ ignore-debug (these add extra checks that make it hard to verify)
#![crate_type = "lib"]
#![feature(exact_size_is_empty)]

Expand Down
1 change: 0 additions & 1 deletion tests/codegen/slice-ref-equality.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
//@ compile-flags: -O -Zmerge-functions=disabled
//@ ignore-debug (the extra assertions get in the way)

#![crate_type = "lib"]

Expand Down
2 changes: 1 addition & 1 deletion tests/codegen/slice-reverse.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//@ compile-flags: -O
//@ only-x86_64
//@ ignore-debug: the debug assertions in from_raw_parts get in the way
//@ ignore-debug: debug assertions prevent generating shufflevector

#![crate_type = "lib"]

Expand Down
1 change: 0 additions & 1 deletion tests/codegen/slice_as_from_ptr_range.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
//@ compile-flags: -O
//@ only-64bit (because we're using [ui]size)
//@ ignore-debug (because the assertions get in the way)

#![crate_type = "lib"]
#![feature(slice_from_ptr_range)]
Expand Down
1 change: 0 additions & 1 deletion tests/codegen/swap-large-types.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
//@ compile-flags: -O
//@ only-x86_64
//@ ignore-debug: the debug assertions get in the way

#![crate_type = "lib"]

Expand Down
1 change: 0 additions & 1 deletion tests/codegen/swap-small-types.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
//@ compile-flags: -O -Z merge-functions=disabled
//@ only-x86_64
//@ ignore-debug: the debug assertions get in the way

#![crate_type = "lib"]

Expand Down
1 change: 0 additions & 1 deletion tests/codegen/transmute-optimized.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
//@ compile-flags: -O -Z merge-functions=disabled
//@ ignore-debug

#![crate_type = "lib"]

Expand Down
1 change: 0 additions & 1 deletion tests/codegen/unchecked_shifts.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
//@ compile-flags: -O
//@ ignore-debug (because unchecked is checked in debug)

#![crate_type = "lib"]
#![feature(unchecked_shifts)]
Expand Down
1 change: 0 additions & 1 deletion tests/codegen/unwind-landingpad-inline.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
//@ min-llvm-version: 17.0.2
//@ compile-flags: -Copt-level=3
//@ ignore-debug: the debug assertions get in the way
#![crate_type = "lib"]

// This test checks that we can inline drop_in_place in
Expand Down
1 change: 0 additions & 1 deletion tests/codegen/vec-calloc.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
//@ compile-flags: -O -Z merge-functions=disabled
//@ only-x86_64
//@ ignore-debug

#![crate_type = "lib"]

Expand Down
2 changes: 1 addition & 1 deletion tests/codegen/vec-in-place.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//@ ignore-debug: the debug assertions get in the way
//@ ignore-debug: FIXME: checks for call detect scoped noalias metadata
//@ compile-flags: -O -Z merge-functions=disabled
#![crate_type = "lib"]

Expand Down
1 change: 0 additions & 1 deletion tests/codegen/vec-iter-collect-len.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
//@ ignore-debug: the debug assertions get in the way
//@ compile-flags: -O
#![crate_type="lib"]

Expand Down
1 change: 0 additions & 1 deletion tests/codegen/vec-iter.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
//@ ignore-debug: the debug assertions get in the way
//@ compile-flags: -O
#![crate_type = "lib"]
#![feature(exact_size_is_empty)]
Expand Down
1 change: 0 additions & 1 deletion tests/codegen/vec-optimizes-away.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
//@ ignore-debug: the debug assertions get in the way
//@ compile-flags: -O
#![crate_type = "lib"]

Expand Down
2 changes: 0 additions & 2 deletions tests/codegen/vec-reserve-extend.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
//@ compile-flags: -O
//@ ignore-debug
// (with debug assertions turned on, `assert_unchecked` generates a real assertion)

#![crate_type = "lib"]

Expand Down
2 changes: 1 addition & 1 deletion tests/codegen/vec-shrink-panik.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
//@ [old]ignore-llvm-version: 17 - 99
//@ [new]min-llvm-version: 17
//@ compile-flags: -O
//@ ignore-debug: the debug assertions get in the way
//@ ignore-debug: plain old debug assertions
//@ needs-unwind
#![crate_type = "lib"]
#![feature(shrink_to)]
Expand Down
2 changes: 0 additions & 2 deletions tests/codegen/vec_pop_push_noop.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
//@ compile-flags: -O
//@ ignore-debug
// (with debug assertions turned on, `assert_unchecked` generates a real assertion)

#![crate_type = "lib"]

Expand Down
2 changes: 1 addition & 1 deletion tests/codegen/vecdeque-drain.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Check that draining at the front or back doesn't copy memory.

//@ compile-flags: -O
//@ ignore-debug: the debug assertions get in the way
//@ ignore-debug: FIXME: checks for call detect scoped noalias metadata

#![crate_type = "lib"]

Expand Down
1 change: 0 additions & 1 deletion tests/codegen/vecdeque-nonempty-get-no-panic.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Guards against regression for optimization discussed in issue #80836

//@ compile-flags: -O
//@ ignore-debug: the debug assertions get in the way

#![crate_type = "lib"]

Expand Down
2 changes: 1 addition & 1 deletion tests/codegen/vecdeque_no_panic.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// This test checks that `VecDeque::front[_mut]()` and `VecDeque::back[_mut]()` can't panic.

//@ compile-flags: -O
//@ ignore-debug: the debug assertions get in the way
//@ ignore-debug: plain old debug assertions

#![crate_type = "lib"]

Expand Down
1 change: 0 additions & 1 deletion tests/codegen/virtual-function-elimination.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
//@ compile-flags: -Zvirtual-function-elimination -Clto -O -Csymbol-mangling-version=v0
//@ ignore-32bit
//@ ignore-debug

// CHECK: @vtable.0 = {{.*}}, !type ![[TYPE0:[0-9]+]], !vcall_visibility ![[VCALL_VIS0:[0-9]+]]
// CHECK: @vtable.1 = {{.*}}, !type ![[TYPE1:[0-9]+]], !vcall_visibility ![[VCALL_VIS0:[0-9]+]]
Expand Down
1 change: 0 additions & 1 deletion tests/mir-opt/pre-codegen/slice_filter.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// skip-filecheck
//@ compile-flags: -O -Zmir-opt-level=2 -Cdebuginfo=2
//@ ignore-debug: standard library debug assertions add a panic that breaks this optimization

#![crate_type = "lib"]

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// MIR for `variant_a::{closure#0}` after PreCodegen

fn variant_a::{closure#0}(_1: &mut {closure@$DIR/slice_filter.rs:8:25: 8:39}, _2: &&(usize, usize, usize, usize)) -> bool {
fn variant_a::{closure#0}(_1: &mut {closure@$DIR/slice_filter.rs:7:25: 7:39}, _2: &&(usize, usize, usize, usize)) -> bool {
let mut _0: bool;
let mut _3: &(usize, usize, usize, usize);
let _4: &usize;
Expand Down
Loading

0 comments on commit d978a1c

Please sign in to comment.