Skip to content

[DO NOT LOOK] jieyouxu's CI adventures: crashes tests and rustc debug assertions #133131

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions src/ci/docker/host-x86_64/x86_64-gnu/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,14 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
COPY scripts/sccache.sh /scripts/
RUN sh /scripts/sccache.sh

ENV COMPILETEST_VERBOSE_CRASHES 1
ENV RUST_CONFIGURE_ARGS \
--build=x86_64-unknown-linux-gnu \
--enable-sanitizers \
--enable-profiler \
--enable-compiler-docs \
--set llvm.libzstd=true
ENV SCRIPT python3 ../x.py --stage 2 test
--build=x86_64-unknown-linux-gnu \
--enable-sanitizers \
--enable-profiler \
--enable-compiler-docs \
--set llvm.libzstd=true \
# HACK(jieyouxu): do not download-rustc!
--set rust.download-rustc=false
# HACK(jieyouxu): faster feedback
ENV SCRIPT python3 ../x.py --stage 1 test tests/crashes
15 changes: 8 additions & 7 deletions src/tools/compiletest/src/runtest/crashes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,16 @@ impl TestCx<'_> {
let pm = self.pass_mode();
let proc_res = self.compile_test(WillExecute::No, self.should_emit_metadata(pm));

if std::env::var("COMPILETEST_VERBOSE_CRASHES").is_ok() {
eprintln!("{}", proc_res.status);
eprintln!("{}", proc_res.stdout);
eprintln!("{}", proc_res.stderr);
eprintln!("{}", proc_res.cmdline);
}

// if a test does not crash, consider it an error
if proc_res.status.success() || matches!(proc_res.status.code(), Some(1 | 0)) {
// HACK(jieyouxu): flip it so it verbose if the test *fails* to crash.
if std::env::var("COMPILETEST_VERBOSE_CRASHES").is_ok() {
eprintln!("{}", proc_res.status);
eprintln!("{}", proc_res.stdout);
eprintln!("{}", proc_res.stderr);
eprintln!("{}", proc_res.cmdline);
}

self.fatal(&format!(
"crashtest no longer crashes/triggers ICE, horray! Please give it a meaningful \
name, add a doc-comment to the start of the test explaining why it exists and \
Expand Down
14 changes: 14 additions & 0 deletions tests/crashes/116979.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
//@ known-bug: #116979
//@ compile-flags: -Csymbol-mangling-version=v0
//@ needs-rustc-debug-assertions

#![feature(dyn_star)]
#![allow(incomplete_features)]

use std::fmt::Display;

pub fn require_dyn_star_display(_: dyn* Display) {}

fn main() {
require_dyn_star_display(1usize);
}
27 changes: 27 additions & 0 deletions tests/crashes/117808.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
//@ known-bug: #117808
//@ edition:2021
//@ needs-rustc-debug-assertions

use std::future::Future;

fn hrc<R, F: for<'a> AsyncClosure<'a, (), R>>(f: F) -> F {
f
}

fn main() {
hrc(|x| async {});
}

trait AsyncClosure<'a, I, R>
where
I: 'a,
{
}

impl<'a, I, R, Fut, F> AsyncClosure<'a, I, R> for F
where
I: 'a,
F: Fn(&'a I) -> Fut,
Fut: Future<Output = R> + Send + 'a,
{
}
13 changes: 13 additions & 0 deletions tests/crashes/117877.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//@ known-bug: #117877
//@ edition:2021
//@ needs-rustc-debug-assertions
//@ only-x86_64
#![feature(asm_const)]

use std::arch::asm;

async unsafe fn foo<'a>() {
asm!("/* {0} */", const N);
}

fn main() {}
24 changes: 24 additions & 0 deletions tests/crashes/118778.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
//@ known-bug: #118778
//@ edition:2021
//@ needs-rustc-debug-assertions

#![feature(generic_const_exprs)]
#![allow(incomplete_features)]

trait Owner {
type T<const N: u16>;
}

impl Owner for () {
type T<const N: u32> = U32<{ N + 1 }>
where
U32<{ N + 1 }>:;
}

struct U32<const N: u32>;

fn take1(_: impl Owner<T<1> = U32<1>>) {}

fn main() {
take1(());
}
19 changes: 19 additions & 0 deletions tests/crashes/118784.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
//@ known-bug: #118784
//@ needs-rustc-debug-assertions

use std::collections::HashMap;

macro_rules! all_sync_send {
($ctor:expr, $($iter:expr),+) => ({
$(
let mut x = $ctor;
is_sync(x.$iter());
let mut y = $ctor;
is_send(y.$iter());
)+
})
}

fn main() {
all_sync_send!(HashMap, HashMap);
}
11 changes: 11 additions & 0 deletions tests/crashes/120175.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
//@ known-bug: #120175
//@ needs-rustc-debug-assertions

#![feature(extern_types)]

#[link(name = "bar", import_name_type = "decorated", kind = "raw-dylib")]
extern "C" {
pub type CrossCrate;
}

fn main() {}
9 changes: 9 additions & 0 deletions tests/crashes/121176.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
//@ known-bug: #121176
//@ needs-rustc-debug-assertions
use std::fmt::Debug;

static STATIC_1: dyn Debug + Sync = *();

fn main() {
println!("{:?}", &STATIC_1);
}
5 changes: 5 additions & 0 deletions tests/crashes/123861.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
//@ known-bug: #123861
//@ needs-rustc-debug-assertions

struct _;
fn mainIterator<_ = _> {}
14 changes: 14 additions & 0 deletions tests/crashes/123862.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
//@ known-bug: #123862
//@ needs-rustc-debug-assertions

macro_rules! pos {
() => {
(file![$($pos,)* pos!()], line!())
};
}

fn outer() {
inner_inlined(main_pos, pos!());
}

fn inner_inlined() {}
10 changes: 10 additions & 0 deletions tests/crashes/130395.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
//@ known-bug: #130395
//@ needs-rustc-debug-assertions

enum U {
B(isize, usize),
}

fn main() {
let x = T::A(U::C);
}
13 changes: 13 additions & 0 deletions tests/crashes/132055.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//@ known-bug: #132055
//@ needs-rustc-debug-assertions
//@ compile-flags: -Zmir-opt-level=5 -Zvalidate-mir

#![feature(non_lifetime_binders)]

trait Trait<T: ?Sized> {
type Assoc<'a> = i32;
}

fn produce() -> impl for<T> Trait<(), Assoc = impl Trait<T>> {
16
}
Loading