Skip to content

Commit 6d9175f

Browse files
committed
crashes: fix ice detection which did not trigger if code compiled without error by accident
1 parent 7d826ae commit 6d9175f

File tree

12 files changed

+22
-9
lines changed

12 files changed

+22
-9
lines changed

src/tools/compiletest/src/runtest.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -364,13 +364,16 @@ impl<'test> TestCx<'test> {
364364
fn run_crash_test(&self) {
365365
let pm = self.pass_mode();
366366
let proc_res = self.compile_test(WillExecute::No, self.should_emit_metadata(pm));
367+
/*
368+
eprintln!("{}", proc_res.status);
369+
eprintln!("{}", proc_res.stdout);
370+
eprintln!("{}", proc_res.stderr);
371+
eprintln!("{}", proc_res.cmdline);
372+
*/
367373

368374
// if a test does not crash, consider it an error
369-
if !proc_res.status.success() {
370-
match proc_res.status.code() {
371-
Some(1 | 0) => self.fatal(&format!("test no longer crashes/triggers ICE! Please annotate it and add it as test to tests/ui or wherever you see fit")),
372-
_ => (),
373-
}
375+
if proc_res.status.success() || matches!(proc_res.status.code(), Some(1 | 0)) {
376+
self.fatal(&format!("test no longer crashes/triggers ICE! Please annotate it and add it as test to tests/ui or wherever you see fit"));
374377
}
375378
}
376379

@@ -2322,9 +2325,6 @@ impl<'test> TestCx<'test> {
23222325
}
23232326

23242327
let (Output { status, stdout, stderr }, truncated) = self.read2_abbreviated(child);
2325-
eprintln!("{:?}", status);
2326-
eprintln!("{}", String::from_utf8_lossy(&stdout).into_owned());
2327-
eprintln!("{}", String::from_utf8_lossy(&stdout).into_owned());
23282328

23292329
let result = ProcRes {
23302330
status,

tests/crashes/101557.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
//@ known-bug: #101557
2+
//@ compile-flags: -Copt-level=0
23
#![feature(generic_const_exprs)]
34
use std::marker::PhantomData;
45

tests/crashes/111699.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
//@ known-bug: #111699
2+
//@ edition:2021
3+
//@ compile-flags: -Copt-level=0
24
#![feature(core_intrinsics)]
35
use std::intrinsics::offset;
46

tests/crashes/115435.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
//@ known-bug: #115435
2+
//@ edition:2021
3+
//@ compile-flags: -Copt-level=0
24
trait MyTrait {
35
type Target: ?Sized;
46
}

tests/crashes/118320.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
//@ known-bug: #118320
2+
//@ edition:2021
23
#![feature(const_trait_impl, effects, const_closures)]
34

45
#[const_trait]

tests/crashes/119692.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
//@ known-bug: #119692
2+
//@ compile-flags: -Copt-level=0
23
#![allow(incomplete_features)]
34
#![feature(adt_const_params)]
45
#![feature(generic_const_exprs)]

tests/crashes/120241-2.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
//@ known-bug: #120241
2+
//@ edition:2021
23
#![feature(object_safe_for_dispatch)]
34
#![feature(unsized_fn_params)]
45

tests/crashes/120241.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
//@ known-bug: #120241
2+
//@ edition:2021
23
#![feature(object_safe_for_dispatch)]
34

45
trait B {

tests/crashes/120482.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
//@ known-bug: #120482
2+
//@ edition:2021
23
#![feature(object_safe_for_dispatch)]
34

45
trait B {

tests/crashes/121444.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
//@ known-bug: #121444
2+
//@ compile-flags: -Copt-level=0
3+
//@ edition:2021
24
#[repr(align(536870912))]
35
pub struct A(i64);
46

tests/crashes/123157.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
//@ known-bug: #123157
2+
//@ edition:2021
23
#![feature(type_alias_impl_trait)]
34

45
#[derive(Copy, Clone)]

tests/crashes/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ the rustc testsuite is more convenient.
44

55
It is imperative that a test in the suite causes an internal compiler error/panic
66
or makes rustc crash in some other way.
7-
Accepted exit codes are: 101 (may be expanded later)
7+
A test will "pass" if rustc exits with something other than 1 or 0.
88

99
When adding crashes from https://github.com/rust-lang/rust/issues, the
1010
issue number should be noted in the file name (12345.rs should suffice)

0 commit comments

Comments
 (0)