From 716d99c3ffa83eac948497ad88e586cb3b556032 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Kr=C3=BCger?= Date: Fri, 8 Nov 2024 21:32:40 +0100 Subject: [PATCH] add some debug-assertion crash tests --- tests/crashes/116979.rs | 14 ++++++++++++++ tests/crashes/117808.rs | 27 +++++++++++++++++++++++++++ tests/crashes/117877.rs | 13 +++++++++++++ tests/crashes/118778.rs | 24 ++++++++++++++++++++++++ tests/crashes/118784.rs | 19 +++++++++++++++++++ tests/crashes/120175.rs | 11 +++++++++++ tests/crashes/121176.rs | 9 +++++++++ tests/crashes/123861.rs | 5 +++++ tests/crashes/123862.rs | 14 ++++++++++++++ tests/crashes/130395.rs | 10 ++++++++++ 10 files changed, 146 insertions(+) create mode 100644 tests/crashes/116979.rs create mode 100644 tests/crashes/117808.rs create mode 100644 tests/crashes/117877.rs create mode 100644 tests/crashes/118778.rs create mode 100644 tests/crashes/118784.rs create mode 100644 tests/crashes/120175.rs create mode 100644 tests/crashes/121176.rs create mode 100644 tests/crashes/123861.rs create mode 100644 tests/crashes/123862.rs create mode 100644 tests/crashes/130395.rs diff --git a/tests/crashes/116979.rs b/tests/crashes/116979.rs new file mode 100644 index 0000000000000..28bbc972ea340 --- /dev/null +++ b/tests/crashes/116979.rs @@ -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); +} diff --git a/tests/crashes/117808.rs b/tests/crashes/117808.rs new file mode 100644 index 0000000000000..2c727986dd07f --- /dev/null +++ b/tests/crashes/117808.rs @@ -0,0 +1,27 @@ +//@ known-bug: #117808 +//@ edition:2021 +//@ needs-rustc-debug-assertions + +use std::future::Future; + +fn hrc 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 + Send + 'a, +{ +} diff --git a/tests/crashes/117877.rs b/tests/crashes/117877.rs new file mode 100644 index 0000000000000..b1effc0cbcb1a --- /dev/null +++ b/tests/crashes/117877.rs @@ -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() {} diff --git a/tests/crashes/118778.rs b/tests/crashes/118778.rs new file mode 100644 index 0000000000000..9914e76022d76 --- /dev/null +++ b/tests/crashes/118778.rs @@ -0,0 +1,24 @@ +//@ known-bug: #118778 +//@ edition:2021 +//@ needs-rustc-debug-assertions + +#![feature(generic_const_exprs)] +#![allow(incomplete_features)] + +trait Owner { + type T; +} + +impl Owner for () { + type T = U32<{ N + 1 }> + where + U32<{ N + 1 }>:; +} + +struct U32; + +fn take1(_: impl Owner = U32<1>>) {} + +fn main() { + take1(()); +} diff --git a/tests/crashes/118784.rs b/tests/crashes/118784.rs new file mode 100644 index 0000000000000..7bf943c8177c1 --- /dev/null +++ b/tests/crashes/118784.rs @@ -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); +} diff --git a/tests/crashes/120175.rs b/tests/crashes/120175.rs new file mode 100644 index 0000000000000..c6e7203ff9882 --- /dev/null +++ b/tests/crashes/120175.rs @@ -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() {} diff --git a/tests/crashes/121176.rs b/tests/crashes/121176.rs new file mode 100644 index 0000000000000..4d82e51de8f80 --- /dev/null +++ b/tests/crashes/121176.rs @@ -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); +} diff --git a/tests/crashes/123861.rs b/tests/crashes/123861.rs new file mode 100644 index 0000000000000..60245960af0d6 --- /dev/null +++ b/tests/crashes/123861.rs @@ -0,0 +1,5 @@ +//@ known-bug: #123861 +//@ needs-rustc-debug-assertions + +struct _; +fn mainIterator<_ = _> {} diff --git a/tests/crashes/123862.rs b/tests/crashes/123862.rs new file mode 100644 index 0000000000000..075e0e6fc8fc8 --- /dev/null +++ b/tests/crashes/123862.rs @@ -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() {} diff --git a/tests/crashes/130395.rs b/tests/crashes/130395.rs new file mode 100644 index 0000000000000..c1d189c79badb --- /dev/null +++ b/tests/crashes/130395.rs @@ -0,0 +1,10 @@ +//@ known-bug: #130395 +//@ needs-rustc-debug-assertions + +enum U { + B(isize, usize), +} + +fn main() { + let x = T::A(U::C); +}