Skip to content

Commit 8e892b1

Browse files
committed
Auto merge of #133131 - jieyouxu:exp-rustc-debug-assertions, r=<try>
[DO NOT LOOK] jieyouxu's CI adventures: crashes tests and rustc debug assertions Why do you not crash r? `@ghost` try-job: x86_64-gnu
2 parents ee4a56e + 642db0d commit 8e892b1

File tree

13 files changed

+177
-13
lines changed

13 files changed

+177
-13
lines changed

src/ci/docker/host-x86_64/x86_64-gnu/Dockerfile

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,14 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
2424
COPY scripts/sccache.sh /scripts/
2525
RUN sh /scripts/sccache.sh
2626

27+
ENV COMPILETEST_VERBOSE_CRASHES 1
2728
ENV RUST_CONFIGURE_ARGS \
28-
--build=x86_64-unknown-linux-gnu \
29-
--enable-sanitizers \
30-
--enable-profiler \
31-
--enable-compiler-docs \
32-
--set llvm.libzstd=true
33-
ENV SCRIPT python3 ../x.py --stage 2 test
29+
--build=x86_64-unknown-linux-gnu \
30+
--enable-sanitizers \
31+
--enable-profiler \
32+
--enable-compiler-docs \
33+
--set llvm.libzstd=true \
34+
# HACK(jieyouxu): do not download-rustc!
35+
--set rust.download-rustc=false
36+
# HACK(jieyouxu): faster feedback
37+
ENV SCRIPT python3 ../x.py --stage 1 test tests/crashes

src/tools/compiletest/src/runtest/crashes.rs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,16 @@ impl TestCx<'_> {
55
let pm = self.pass_mode();
66
let proc_res = self.compile_test(WillExecute::No, self.should_emit_metadata(pm));
77

8-
if std::env::var("COMPILETEST_VERBOSE_CRASHES").is_ok() {
9-
eprintln!("{}", proc_res.status);
10-
eprintln!("{}", proc_res.stdout);
11-
eprintln!("{}", proc_res.stderr);
12-
eprintln!("{}", proc_res.cmdline);
13-
}
14-
158
// if a test does not crash, consider it an error
169
if proc_res.status.success() || matches!(proc_res.status.code(), Some(1 | 0)) {
10+
// HACK(jieyouxu): flip it so it verbose if the test *fails* to crash.
11+
if std::env::var("COMPILETEST_VERBOSE_CRASHES").is_ok() {
12+
eprintln!("{}", proc_res.status);
13+
eprintln!("{}", proc_res.stdout);
14+
eprintln!("{}", proc_res.stderr);
15+
eprintln!("{}", proc_res.cmdline);
16+
}
17+
1718
self.fatal(&format!(
1819
"crashtest no longer crashes/triggers ICE, horray! Please give it a meaningful \
1920
name, add a doc-comment to the start of the test explaining why it exists and \

tests/crashes/116979.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
//@ known-bug: #116979
2+
//@ compile-flags: -Csymbol-mangling-version=v0
3+
//@ needs-rustc-debug-assertions
4+
5+
#![feature(dyn_star)]
6+
#![allow(incomplete_features)]
7+
8+
use std::fmt::Display;
9+
10+
pub fn require_dyn_star_display(_: dyn* Display) {}
11+
12+
fn main() {
13+
require_dyn_star_display(1usize);
14+
}

tests/crashes/117808.rs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
//@ known-bug: #117808
2+
//@ edition:2021
3+
//@ needs-rustc-debug-assertions
4+
5+
use std::future::Future;
6+
7+
fn hrc<R, F: for<'a> AsyncClosure<'a, (), R>>(f: F) -> F {
8+
f
9+
}
10+
11+
fn main() {
12+
hrc(|x| async {});
13+
}
14+
15+
trait AsyncClosure<'a, I, R>
16+
where
17+
I: 'a,
18+
{
19+
}
20+
21+
impl<'a, I, R, Fut, F> AsyncClosure<'a, I, R> for F
22+
where
23+
I: 'a,
24+
F: Fn(&'a I) -> Fut,
25+
Fut: Future<Output = R> + Send + 'a,
26+
{
27+
}

tests/crashes/117877.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
//@ known-bug: #117877
2+
//@ edition:2021
3+
//@ needs-rustc-debug-assertions
4+
//@ only-x86_64
5+
#![feature(asm_const)]
6+
7+
use std::arch::asm;
8+
9+
async unsafe fn foo<'a>() {
10+
asm!("/* {0} */", const N);
11+
}
12+
13+
fn main() {}

tests/crashes/118778.rs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
//@ known-bug: #118778
2+
//@ edition:2021
3+
//@ needs-rustc-debug-assertions
4+
5+
#![feature(generic_const_exprs)]
6+
#![allow(incomplete_features)]
7+
8+
trait Owner {
9+
type T<const N: u16>;
10+
}
11+
12+
impl Owner for () {
13+
type T<const N: u32> = U32<{ N + 1 }>
14+
where
15+
U32<{ N + 1 }>:;
16+
}
17+
18+
struct U32<const N: u32>;
19+
20+
fn take1(_: impl Owner<T<1> = U32<1>>) {}
21+
22+
fn main() {
23+
take1(());
24+
}

tests/crashes/118784.rs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
//@ known-bug: #118784
2+
//@ needs-rustc-debug-assertions
3+
4+
use std::collections::HashMap;
5+
6+
macro_rules! all_sync_send {
7+
($ctor:expr, $($iter:expr),+) => ({
8+
$(
9+
let mut x = $ctor;
10+
is_sync(x.$iter());
11+
let mut y = $ctor;
12+
is_send(y.$iter());
13+
)+
14+
})
15+
}
16+
17+
fn main() {
18+
all_sync_send!(HashMap, HashMap);
19+
}

tests/crashes/120175.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
//@ known-bug: #120175
2+
//@ needs-rustc-debug-assertions
3+
4+
#![feature(extern_types)]
5+
6+
#[link(name = "bar", import_name_type = "decorated", kind = "raw-dylib")]
7+
extern "C" {
8+
pub type CrossCrate;
9+
}
10+
11+
fn main() {}

tests/crashes/121176.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
//@ known-bug: #121176
2+
//@ needs-rustc-debug-assertions
3+
use std::fmt::Debug;
4+
5+
static STATIC_1: dyn Debug + Sync = *();
6+
7+
fn main() {
8+
println!("{:?}", &STATIC_1);
9+
}

tests/crashes/123861.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
//@ known-bug: #123861
2+
//@ needs-rustc-debug-assertions
3+
4+
struct _;
5+
fn mainIterator<_ = _> {}

tests/crashes/123862.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
//@ known-bug: #123862
2+
//@ needs-rustc-debug-assertions
3+
4+
macro_rules! pos {
5+
() => {
6+
(file![$($pos,)* pos!()], line!())
7+
};
8+
}
9+
10+
fn outer() {
11+
inner_inlined(main_pos, pos!());
12+
}
13+
14+
fn inner_inlined() {}

tests/crashes/130395.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
//@ known-bug: #130395
2+
//@ needs-rustc-debug-assertions
3+
4+
enum U {
5+
B(isize, usize),
6+
}
7+
8+
fn main() {
9+
let x = T::A(U::C);
10+
}

tests/crashes/132055.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
//@ known-bug: #132055
2+
//@ needs-rustc-debug-assertions
3+
//@ compile-flags: -Zmir-opt-level=5 -Zvalidate-mir
4+
5+
#![feature(non_lifetime_binders)]
6+
7+
trait Trait<T: ?Sized> {
8+
type Assoc<'a> = i32;
9+
}
10+
11+
fn produce() -> impl for<T> Trait<(), Assoc = impl Trait<T>> {
12+
16
13+
}

0 commit comments

Comments
 (0)