Skip to content

Commit a94fce9

Browse files
committed
Auto merge of #132789 - matthiaskrgr:debug_tests, r=jieyouxu
add some debug-assertion crash tests r? ghost try-job: x86_64-gnu
2 parents 8e37e15 + 716d99c commit a94fce9

10 files changed

+146
-0
lines changed

tests/crashes/116979.rs

+14
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

+27
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

+13
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

+24
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

+19
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

+11
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

+9
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

+5
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

+14
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

+10
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+
}

0 commit comments

Comments
 (0)