From 08138c13f245a06ff38dacf87bb4675133ef28fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Kr=C3=BCger?= Date: Sat, 18 Oct 2025 21:34:22 +0200 Subject: [PATCH] crashes: more tests --- tests/crashes/141293.rs | 7 ++++++ tests/crashes/141380.rs | 11 +++++++++ tests/crashes/141850.rs | 24 +++++++++++++++++++ tests/crashes/141911.rs | 15 ++++++++++++ tests/crashes/141916.rs | 18 ++++++++++++++ tests/crashes/142155.rs | 13 ++++++++++ tests/crashes/142209.rs | 11 +++++++++ tests/crashes/142229.rs | 7 ++++++ tests/crashes/142382.rs | 10 ++++++++ tests/crashes/142529.rs | 4 ++++ tests/crashes/142559.rs | 14 +++++++++++ tests/crashes/142560.rs | 24 +++++++++++++++++++ tests/crashes/142717.rs | 11 +++++++++ tests/crashes/142773.rs | 11 +++++++++ tests/crashes/142866.rs | 25 +++++++++++++++++++ tests/crashes/142913.rs | 7 ++++++ tests/crashes/143094.rs | 42 ++++++++++++++++++++++++++++++++ tests/crashes/143117.rs | 8 +++++++ tests/crashes/143174.rs | 6 +++++ tests/crashes/143205.rs | 8 +++++++ tests/crashes/143358.rs | 4 ++++ tests/crashes/143498.rs | 21 ++++++++++++++++ tests/crashes/143506.rs | 10 ++++++++ tests/crashes/143787.rs | 5 ++++ tests/crashes/143806.rs | 17 +++++++++++++ tests/crashes/143872.rs | 16 +++++++++++++ tests/crashes/143896.rs | 9 +++++++ tests/crashes/144033.rs | 16 +++++++++++++ tests/crashes/144241.rs | 3 +++ tests/crashes/144501.rs | 13 ++++++++++ tests/crashes/144547.rs | 25 +++++++++++++++++++ tests/crashes/144564.rs | 14 +++++++++++ tests/crashes/144594.rs | 7 ++++++ tests/crashes/144719.rs | 11 +++++++++ tests/crashes/144832.rs | 21 ++++++++++++++++ tests/crashes/144833.rs | 21 ++++++++++++++++ tests/crashes/144888.rs | 16 +++++++++++++ tests/crashes/145217.rs | 6 +++++ tests/crashes/146084.rs | 2 ++ tests/crashes/146353.rs | 7 ++++++ tests/crashes/146371.rs | 20 ++++++++++++++++ tests/crashes/146384.rs | 6 +++++ tests/crashes/146514.rs | 53 +++++++++++++++++++++++++++++++++++++++++ tests/crashes/146754.rs | 5 ++++ tests/crashes/146755.rs | 10 ++++++++ tests/crashes/146834.rs | 7 ++++++ tests/crashes/146903.rs | 5 ++++ tests/crashes/146906.rs | 7 ++++++ tests/crashes/146908.rs | 20 ++++++++++++++++ tests/crashes/146985.rs | 25 +++++++++++++++++++ tests/crashes/147208.rs | 8 +++++++ tests/crashes/147339.rs | 11 +++++++++ tests/crashes/147415.rs | 6 +++++ 53 files changed, 703 insertions(+) create mode 100644 tests/crashes/141293.rs create mode 100644 tests/crashes/141380.rs create mode 100644 tests/crashes/141850.rs create mode 100644 tests/crashes/141911.rs create mode 100644 tests/crashes/141916.rs create mode 100644 tests/crashes/142155.rs create mode 100644 tests/crashes/142209.rs create mode 100644 tests/crashes/142229.rs create mode 100644 tests/crashes/142382.rs create mode 100644 tests/crashes/142529.rs create mode 100644 tests/crashes/142559.rs create mode 100644 tests/crashes/142560.rs create mode 100644 tests/crashes/142717.rs create mode 100644 tests/crashes/142773.rs create mode 100644 tests/crashes/142866.rs create mode 100644 tests/crashes/142913.rs create mode 100644 tests/crashes/143094.rs create mode 100644 tests/crashes/143117.rs create mode 100644 tests/crashes/143174.rs create mode 100644 tests/crashes/143205.rs create mode 100644 tests/crashes/143358.rs create mode 100644 tests/crashes/143498.rs create mode 100644 tests/crashes/143506.rs create mode 100644 tests/crashes/143787.rs create mode 100644 tests/crashes/143806.rs create mode 100644 tests/crashes/143872.rs create mode 100644 tests/crashes/143896.rs create mode 100644 tests/crashes/144033.rs create mode 100644 tests/crashes/144241.rs create mode 100644 tests/crashes/144501.rs create mode 100644 tests/crashes/144547.rs create mode 100644 tests/crashes/144564.rs create mode 100644 tests/crashes/144594.rs create mode 100644 tests/crashes/144719.rs create mode 100644 tests/crashes/144832.rs create mode 100644 tests/crashes/144833.rs create mode 100644 tests/crashes/144888.rs create mode 100644 tests/crashes/145217.rs create mode 100644 tests/crashes/146084.rs create mode 100644 tests/crashes/146353.rs create mode 100644 tests/crashes/146371.rs create mode 100644 tests/crashes/146384.rs create mode 100644 tests/crashes/146514.rs create mode 100644 tests/crashes/146754.rs create mode 100644 tests/crashes/146755.rs create mode 100644 tests/crashes/146834.rs create mode 100644 tests/crashes/146903.rs create mode 100644 tests/crashes/146906.rs create mode 100644 tests/crashes/146908.rs create mode 100644 tests/crashes/146985.rs create mode 100644 tests/crashes/147208.rs create mode 100644 tests/crashes/147339.rs create mode 100644 tests/crashes/147415.rs diff --git a/tests/crashes/141293.rs b/tests/crashes/141293.rs new file mode 100644 index 0000000000000..4530d5f2c5603 --- /dev/null +++ b/tests/crashes/141293.rs @@ -0,0 +1,7 @@ +//@ known-bug: rust-lang/rust#141293 +#![feature(unsafe_binders)] +type X = unsafe (); + +type Y = unsafe (); + +pub fn main() {} diff --git a/tests/crashes/141380.rs b/tests/crashes/141380.rs new file mode 100644 index 0000000000000..f516db92c2297 --- /dev/null +++ b/tests/crashes/141380.rs @@ -0,0 +1,11 @@ +//@ known-bug: rust-lang/rust#141380 +trait Trait {} +type Alias = impl Trait; + +pub enum UninhabitedVariants { + Tuple(Alias), +} + +fn uwu(x: UninhabitedVariants) { + match x {} +} diff --git a/tests/crashes/141850.rs b/tests/crashes/141850.rs new file mode 100644 index 0000000000000..50f357f75389d --- /dev/null +++ b/tests/crashes/141850.rs @@ -0,0 +1,24 @@ +//@ known-bug: rust-lang/rust#141850 +//@edition: 2024 +//@ compile-flags: -Copt-level=0 +#![feature(pin_ergonomics)] +async fn a() { + wrapper_call(handler).await; +} +async fn wrapper_call(_: F) -> F::Output +where + F: Handler, +{ + todo!() +} +async fn handler(); +trait Handler { + type Output; +} +impl Handler for Func +where + Func: Fn() -> Fut, + Fut: Future, +{ + type Output = Fut; +} diff --git a/tests/crashes/141911.rs b/tests/crashes/141911.rs new file mode 100644 index 0000000000000..20e0ffe4e4bee --- /dev/null +++ b/tests/crashes/141911.rs @@ -0,0 +1,15 @@ +//@ known-bug: rust-lang/rust#141911 +trait MyTrait { + fn virtualize(&self); +} +struct VirtualWrapper(T, T); + +impl MyTrait for T { + fn virtualize(&self) { + const { std::ptr::null::>() as *const dyn MyTrait }; + } +} + +fn main() { + 0u8.virtualize(); +} diff --git a/tests/crashes/141916.rs b/tests/crashes/141916.rs new file mode 100644 index 0000000000000..abde83a0e7915 --- /dev/null +++ b/tests/crashes/141916.rs @@ -0,0 +1,18 @@ +//@ known-bug: rust-lang/rust#141916 +//@ edition: 2024 +#![allow(incomplete_features)] +#![feature(ergonomic_clones)] + +use std::clone::UseCloned; + +#[derive(Clone)] +struct Foo; + +impl UseCloned for Foo {} + +fn do_not_move_test(x: Foo) -> Foo { async { + let s = x.use; + x +} } + +fn main() {} diff --git a/tests/crashes/142155.rs b/tests/crashes/142155.rs new file mode 100644 index 0000000000000..c584a88c0415f --- /dev/null +++ b/tests/crashes/142155.rs @@ -0,0 +1,13 @@ +//@ known-bug: rust-lang/rust#142155 +//@ needs-rustc-debug-assertions +//@ edition:2021 + +#![warn(tail_expr_drop_order)] +use core::future::Future; +use core::pin::Pin; + +fn wrapped_fn<'a>() -> Pin, String>> + Send + 'static)>> { + Box::pin(async { Err("nope".into()) }) +} + +pub fn main() {} diff --git a/tests/crashes/142209.rs b/tests/crashes/142209.rs new file mode 100644 index 0000000000000..cdcf6cc094119 --- /dev/null +++ b/tests/crashes/142209.rs @@ -0,0 +1,11 @@ +//@ known-bug: rust-lang/rust#142209 +#![feature(generic_const_exprs)] + +struct Bar; +const FRAC_LHS: usize = 0; + +trait Foo {} + +impl PartialEq> for Bar {} + +pub fn main() {} diff --git a/tests/crashes/142229.rs b/tests/crashes/142229.rs new file mode 100644 index 0000000000000..75ccbf3cf80ed --- /dev/null +++ b/tests/crashes/142229.rs @@ -0,0 +1,7 @@ +//@ known-bug: rust-lang/rust#142229 +#![feature(super_let)] + +const _: *const i32 = { + super let x = 1; + &raw const x +}; diff --git a/tests/crashes/142382.rs b/tests/crashes/142382.rs new file mode 100644 index 0000000000000..0ab32cbb52ecf --- /dev/null +++ b/tests/crashes/142382.rs @@ -0,0 +1,10 @@ +//@ known-bug: rust-lang/rust#142382 + +#![feature(generic_const_parameter_types)] +#![feature(adt_const_params)] +#![feature(unsized_const_params)] + +struct Bar<'a, const N: &'a u32>; +fn foo(&self) -> Bar<0> { todo!(); } + +pub fn main() {} diff --git a/tests/crashes/142529.rs b/tests/crashes/142529.rs new file mode 100644 index 0000000000000..df250b0c2fcfb --- /dev/null +++ b/tests/crashes/142529.rs @@ -0,0 +1,4 @@ +//@ known-bug: rust-lang/rust#142529 +#![feature(min_generic_const_args)] +struct Foo]>(T, U); +fn main() {} diff --git a/tests/crashes/142559.rs b/tests/crashes/142559.rs new file mode 100644 index 0000000000000..724437fb8329c --- /dev/null +++ b/tests/crashes/142559.rs @@ -0,0 +1,14 @@ +//@ known-bug: rust-lang/rust#142559 +//@ edition: 2024 +//@ compile-flags: -Copt-level=0 -Clink-dead-code=true + +#![feature(async_drop)] +async fn test(operation: impl Fn() -> Fut) { + operation().await; +} + +pub async fn orchestrate_simple_crud() { + test(async || async {}.await).await; +} + +fn main() {} diff --git a/tests/crashes/142560.rs b/tests/crashes/142560.rs new file mode 100644 index 0000000000000..37a3037b093c6 --- /dev/null +++ b/tests/crashes/142560.rs @@ -0,0 +1,24 @@ +//@ known-bug: rust-lang/rust#142560 +//@ edition:2021 +//@ compile-flags: -Zlint-mir +#![feature(async_drop)] +use std::{future::AsyncDrop, pin::Pin}; +struct Foo { + my_resource_handle: usize, +} +impl Foo { + fn new(my_resource_handle: usize) -> Self { + let out = Foo { my_resource_handle }; + out + } +} +impl Drop for Foo { + fn drop(&mut self) {} +} +impl AsyncDrop for Foo { + async fn drop(self: Pin<&mut Self>) {} +} +fn main() {} +async fn bar() { + [Foo::new(3)]; +} diff --git a/tests/crashes/142717.rs b/tests/crashes/142717.rs new file mode 100644 index 0000000000000..be58e2d043c71 --- /dev/null +++ b/tests/crashes/142717.rs @@ -0,0 +1,11 @@ +//@ known-bug: rust-lang/rust#142717 +#![feature(inherent_associated_types)] +struct Foo(T); + +impl<'a> Foo { + type Assoc = &mut Peekable; +} + +fn bar(_: for<'a> fn(Foo::Assoc)>::Assoc)) {} + +pub fn main() {} diff --git a/tests/crashes/142773.rs b/tests/crashes/142773.rs new file mode 100644 index 0000000000000..819fea4462ce1 --- /dev/null +++ b/tests/crashes/142773.rs @@ -0,0 +1,11 @@ +//@ known-bug: rust-lang/rust#142773 +//@compile-flags: --crate-type=lib +#![feature(min_generic_const_args)] +#![feature(inherent_associated_types)] +pub struct EntriesBuffer(Box<[[u8; HashesEntry::LEN]; 5]>); + +pub struct HashesEntry<'a>(&'a [u8]); + +impl HashesEntry<'_> { + pub const LEN: usize = 1; +} diff --git a/tests/crashes/142866.rs b/tests/crashes/142866.rs new file mode 100644 index 0000000000000..6d16f8597434c --- /dev/null +++ b/tests/crashes/142866.rs @@ -0,0 +1,25 @@ +//@ known-bug: rust-lang/rust#142866 +//@ compile-flags: -Znext-solver=globally +trait Trait {} +struct A(T); +struct B(T); + +trait IncompleteGuidance {} + +impl Trait<()> for A +where + T: IncompleteGuidance, +{ +} + +impl Trait<()> for B +where + A: Trait, +{ +} + +fn impls_trait>() {} + +fn main() { + impls_trait::>(); +} diff --git a/tests/crashes/142913.rs b/tests/crashes/142913.rs new file mode 100644 index 0000000000000..ecf2d3ac42b4a --- /dev/null +++ b/tests/crashes/142913.rs @@ -0,0 +1,7 @@ +//@ known-bug: rust-lang/rust#142913 +#![feature(generic_const_parameter_types)] +struct Variant; + +fn foo<'a, const N: &'a Variant = {}>() {} + +fn main() {} diff --git a/tests/crashes/143094.rs b/tests/crashes/143094.rs new file mode 100644 index 0000000000000..344a3dce5b87c --- /dev/null +++ b/tests/crashes/143094.rs @@ -0,0 +1,42 @@ +//@ known-bug: rust-lang/rust#143094 +fn main() { + #[cold] + 5 +} + +fn TokenStream() { + #[rustc_align(16)] + 1u32 +} + +fn a() { + #[macro_use] + 1 +} + +fn b() { + #[loop_match] + 5 +} + +pub fn c() { + #[crate_name = "xcrate_issue_61711_b"] + 0 +} + +pub fn d() { + fn k() {} + #[inline(always)] + || -> fn() { k } +} + +fn e() { + #[inline] + 0 +} + +pub fn f() { + #[proc_macro_derive(Bleh)] + 0 +} +// etc.. diff --git a/tests/crashes/143117.rs b/tests/crashes/143117.rs new file mode 100644 index 0000000000000..c2ba31906f8f6 --- /dev/null +++ b/tests/crashes/143117.rs @@ -0,0 +1,8 @@ +//@ known-bug: rust-lang/rust#143117 +#![feature(generic_const_exprs)] +#![feature(generic_const_parameter_types)] +#![feature(adt_const_params)] +#[derive(Clone)] +struct Foo; + +pub fn main() {} diff --git a/tests/crashes/143174.rs b/tests/crashes/143174.rs new file mode 100644 index 0000000000000..83c4d131dab6b --- /dev/null +++ b/tests/crashes/143174.rs @@ -0,0 +1,6 @@ +//@ known-bug: rust-lang/rust#143174 +static FOO: &(u8, ) = &(BAR, ); + +unsafe extern "C" { + static BAR: u8; +} diff --git a/tests/crashes/143205.rs b/tests/crashes/143205.rs new file mode 100644 index 0000000000000..4a9cb2660dab1 --- /dev/null +++ b/tests/crashes/143205.rs @@ -0,0 +1,8 @@ +//@ known-bug: rust-lang/rust#143205 +#![feature(generic_const_exprs)] + +struct Bug { + a: Bug, +} + +pub fn main() {} diff --git a/tests/crashes/143358.rs b/tests/crashes/143358.rs new file mode 100644 index 0000000000000..66d790f08f0e7 --- /dev/null +++ b/tests/crashes/143358.rs @@ -0,0 +1,4 @@ +//@ known-bug: rust-lang/rust#143358 +#![feature(generic_const_exprs)] +#![feature(min_generic_const_args)] +fn identity }>() }>>(); diff --git a/tests/crashes/143498.rs b/tests/crashes/143498.rs new file mode 100644 index 0000000000000..21e2a34cc297d --- /dev/null +++ b/tests/crashes/143498.rs @@ -0,0 +1,21 @@ +//@ known-bug: rust-lang/rust#143498 +#![feature(fn_delegation)] +#![feature(iter_advance_by)] +#![feature(iter_array_chunks)] +#![feature(iterator_try_collect)] +#![feature(iterator_try_reduce)] +#![feature(iter_collect_into)] +#![feature(iter_intersperse)] +#![feature(iter_is_partitioned)] +#![feature(iter_map_windows)] +#![feature(iter_next_chunk)] +#![feature(iter_order_by)] +#![feature(iter_partition_in_place)] +#![feature(trusted_random_access)] +#![feature(try_find)] +#![allow(incomplete_features)] +impl X { + reuse< std::fmt::Debug as Iterator >::*; +} + +pub fn main() {} diff --git a/tests/crashes/143506.rs b/tests/crashes/143506.rs new file mode 100644 index 0000000000000..70bbc1ed675f2 --- /dev/null +++ b/tests/crashes/143506.rs @@ -0,0 +1,10 @@ +//@ known-bug: rust-lang/rust#143506 +#![feature(generic_const_exprs)] +#![feature(min_generic_const_args)] +fn foo(a: [(); N as usize]) {} + +const C: f32 = 1.0; + +fn main() { + foo::(); +} diff --git a/tests/crashes/143787.rs b/tests/crashes/143787.rs new file mode 100644 index 0000000000000..cc3bba8dacc65 --- /dev/null +++ b/tests/crashes/143787.rs @@ -0,0 +1,5 @@ +//@ known-bug: rust-lang/rust#143787 +#![feature(stmt_expr_attributes)] +fn main() { + let _: fn(isize) -> usize = #[repr()] std::string::String::new(); +} diff --git a/tests/crashes/143806.rs b/tests/crashes/143806.rs new file mode 100644 index 0000000000000..d747a5413c225 --- /dev/null +++ b/tests/crashes/143806.rs @@ -0,0 +1,17 @@ +//@ known-bug: rust-lang/rust#143806 +//@compile-flags: -Zlint-mir +#![feature(loop_match)] + +fn main() {} + +fn helper() -> u8 { + let mut state = 0u8; + #[loop_match] + 'a: loop { + state = 'blk: { + match state { + _ => break 'blk state, + } + } + } +} diff --git a/tests/crashes/143872.rs b/tests/crashes/143872.rs new file mode 100644 index 0000000000000..a2e017c493b51 --- /dev/null +++ b/tests/crashes/143872.rs @@ -0,0 +1,16 @@ +//@ known-bug: rust-lang/rust#143872 +//@ needs-rustc-debug-assertions +trait Project { + type Ty; +} +impl Project for &'_ &'static () { + type Ty = (); +} +trait Trait { + fn get<'s>(s: &'s str, _: ()) -> &'_ str; +} +impl Trait for () { + fn get<'s>(s: &'s str, _: <&&'s () as Project>::Ty) -> &'static str { + s + } +} diff --git a/tests/crashes/143896.rs b/tests/crashes/143896.rs new file mode 100644 index 0000000000000..b1f15ce2e5a5c --- /dev/null +++ b/tests/crashes/143896.rs @@ -0,0 +1,9 @@ +//@ known-bug: rust-lang/rust#143896 +#![feature(associated_const_equality)] +trait TraitA<'a> { + const K: usize = 0; +} +impl TraitA<'_> for () {} +impl dyn TraitA<'_> where (): TraitA<'a,K = 0> {} + +pub fn main() {} diff --git a/tests/crashes/144033.rs b/tests/crashes/144033.rs new file mode 100644 index 0000000000000..c4601088e77a7 --- /dev/null +++ b/tests/crashes/144033.rs @@ -0,0 +1,16 @@ +//@ known-bug: rust-lang/rust#144033 +trait FooMut { + fn bar(self, _: I) + where + for<'b> &'b I: Iterator; +} + +impl FooMut for () { + fn bar(self, _: I) + where + for<'b> &'b I: Iterator, + { + let collection = std::iter::empty::<()>().map(|_| &()); + self.bar(collection) + } +} diff --git a/tests/crashes/144241.rs b/tests/crashes/144241.rs new file mode 100644 index 0000000000000..b1d6ce8ebb40d --- /dev/null +++ b/tests/crashes/144241.rs @@ -0,0 +1,3 @@ +//@ known-bug: rust-lang/rust#144241 +//@ edition:2024 +type _0 = dyn !Sized; diff --git a/tests/crashes/144501.rs b/tests/crashes/144501.rs new file mode 100644 index 0000000000000..9a5a05302973f --- /dev/null +++ b/tests/crashes/144501.rs @@ -0,0 +1,13 @@ +//@ known-bug: rust-lang/rust#144501 +//@ needs-rustc-debug-assertions +enum E { + S0 { + s: String, + }, + Bar = { + let x = 1; + 3 + }, +} + +static C: E = E::S1 { u: 23 }; diff --git a/tests/crashes/144547.rs b/tests/crashes/144547.rs new file mode 100644 index 0000000000000..4f554fc96c122 --- /dev/null +++ b/tests/crashes/144547.rs @@ -0,0 +1,25 @@ +//@ known-bug: rust-lang/rust#144547 +trait UnderlyingImpl { + type InfoType: LevelInfo; + type SupportedArray; +} + +trait LevelInfo { + const SUPPORTED_SLOTS: usize; +} + +struct Info; + +impl LevelInfo for Info { + const SUPPORTED_SLOTS: usize = 1; +} + +struct SomeImpl; + +impl UnderlyingImpl for SomeImpl { + type InfoType = Info; + // This line makes compiler panic + type SupportedArray = [T; ::SUPPORTED_SLOTS]; + // But this works + //type SupportedArray = [T; ::SUPPORTED_SLOTS]; +} diff --git a/tests/crashes/144564.rs b/tests/crashes/144564.rs new file mode 100644 index 0000000000000..9b31714f20eac --- /dev/null +++ b/tests/crashes/144564.rs @@ -0,0 +1,14 @@ +//@ known-bug: rust-lang/rust#144564 +//@ needs-rustc-debug-assertions + +trait Trait<'a> { + type Out; +} + +fn weird_bound() -> X +where + for<'a> X: Trait<'a>, + >::Out: Copy, +{ + todo!() +} diff --git a/tests/crashes/144594.rs b/tests/crashes/144594.rs new file mode 100644 index 0000000000000..073cfc4533840 --- /dev/null +++ b/tests/crashes/144594.rs @@ -0,0 +1,7 @@ +//@ known-bug: rust-lang/rust#144594 +reuse a as b { + || { + use std::ops::Add; + x.add + } +} diff --git a/tests/crashes/144719.rs b/tests/crashes/144719.rs new file mode 100644 index 0000000000000..e0b6169c46b3f --- /dev/null +++ b/tests/crashes/144719.rs @@ -0,0 +1,11 @@ +//@ known-bug: rust-lang/rust#144719 +#[derive(PartialEq)] +struct Thing(&'static Thing); + +static X: Thing = Thing(&X); + +const Y: &Thing = &X; + +fn main() { + if let Y = Y {} +} diff --git a/tests/crashes/144832.rs b/tests/crashes/144832.rs new file mode 100644 index 0000000000000..b591549b50589 --- /dev/null +++ b/tests/crashes/144832.rs @@ -0,0 +1,21 @@ +//@ known-bug: rust-lang/rust#144832 +//@ edition:2021 +//@ compile-flags: -Copt-level=0 +#![feature(type_alias_impl_trait)] + +type Opaque = impl Sized; + +trait Trait { + fn foo(); +} + +impl Trait for Opaque { + #[define_opaque(Opaque)] + fn foo() { + let _: Opaque = || {}; + } +} + +fn main() { + Opaque::foo(); +} diff --git a/tests/crashes/144833.rs b/tests/crashes/144833.rs new file mode 100644 index 0000000000000..11a5c132bdf0c --- /dev/null +++ b/tests/crashes/144833.rs @@ -0,0 +1,21 @@ +//@ known-bug: rust-lang/rust#144833 +#![feature(type_alias_impl_trait)] +#![allow(incomplete_features)] + +type Opaque = impl Sized; + +trait Trait { + fn foo(); +} + +impl Trait for Opaque { + #[define_opaque(Opaque)] + fn foo() { + let _: Opaque = || {}; + Opaque::foo(); + } +} + +fn main() { + Opaque::foo(); +} diff --git a/tests/crashes/144888.rs b/tests/crashes/144888.rs new file mode 100644 index 0000000000000..1a2653b30becf --- /dev/null +++ b/tests/crashes/144888.rs @@ -0,0 +1,16 @@ +//@ known-bug: rust-lang/rust#144888 +trait Super { + type Assoc; +} +impl dyn Foo<()> {} +trait Foo: Super +where + ::Assoc: Clone, +{ + fn transmute(&self) {} +} + +trait Mirror { + type Assoc; +} +impl> Mirror for T {} diff --git a/tests/crashes/145217.rs b/tests/crashes/145217.rs new file mode 100644 index 0000000000000..6581669c5e289 --- /dev/null +++ b/tests/crashes/145217.rs @@ -0,0 +1,6 @@ +//@ known-bug: rust-lang/rust#145217 +//@compile-flags: -Zlint-mir +#![feature(super_let)] +fn main() { + super let Some(1) = Some(2) else { return }; +} diff --git a/tests/crashes/146084.rs b/tests/crashes/146084.rs new file mode 100644 index 0000000000000..1dec96da72531 --- /dev/null +++ b/tests/crashes/146084.rs @@ -0,0 +1,2 @@ +//@ known-bug: rust-lang/rust#146084 +struct S; diff --git a/tests/crashes/146353.rs b/tests/crashes/146353.rs new file mode 100644 index 0000000000000..edebefece49b9 --- /dev/null +++ b/tests/crashes/146353.rs @@ -0,0 +1,7 @@ +//@ known-bug: rust-lang/rust#146353 +#![feature(trait_alias)] + +use std::mem::{MaybeUninit}; +const BIG_CHAIN = MaybeUninit::uninit(); + +pub trait NeverSend = !Send; diff --git a/tests/crashes/146371.rs b/tests/crashes/146371.rs new file mode 100644 index 0000000000000..518621cb21588 --- /dev/null +++ b/tests/crashes/146371.rs @@ -0,0 +1,20 @@ +//@ known-bug: rust-lang/rust#146371 +pub trait Trait { + type Assoc: Copy + 'static; +} + +const fn conjure() -> T { + panic!() +} + +const fn get_assoc() -> impl Copy { + conjure::<::Assoc>() +} + +pub fn foo + Trait>() { + const { + get_assoc::(); + } +} + +pub fn main() {} diff --git a/tests/crashes/146384.rs b/tests/crashes/146384.rs new file mode 100644 index 0000000000000..f55e4d542136c --- /dev/null +++ b/tests/crashes/146384.rs @@ -0,0 +1,6 @@ +//@ known-bug: rust-lang/rust#146384 +#![feature(generic_const_exprs)] + +const fn make_tuple() -> (u8::N) { +} +type TupleConst = typeof(make_tuple::()); diff --git a/tests/crashes/146514.rs b/tests/crashes/146514.rs new file mode 100644 index 0000000000000..66b24fa94967e --- /dev/null +++ b/tests/crashes/146514.rs @@ -0,0 +1,53 @@ +//@ known-bug: rust-lang/rust#146514 +//@ edition: 2021 +//@ compile-flags: --crate-type=lib -Copt-level=0 + +#![feature(impl_trait_in_assoc_type)] + +use core::marker::PhantomData; + +struct Emp { + phantom: PhantomData<(*const T, F)>, +} + +impl Emp { + fn from_fn(_: F) -> Emp { + loop {} + } + + fn unsize(self) -> Emp { + Emp::from_fn(|| ()) + } +} + +trait IntoEmplacable { + type Closure; + + fn into_emplacable(self) -> Emp; +} + +impl IntoEmplacable for Emp { + type Closure = impl Sized; + + fn into_emplacable(self) -> Emp { + self.unsize() + } +} + +impl Into as IntoEmplacable>::Closure>> for Emp { + fn into(self) -> Emp as IntoEmplacable>::Closure> { + self.into_emplacable() + } +} + +fn box_new_with(_: Emp) {} + +pub struct Arr; +pub struct Slice; + +pub fn foo() { + let e: Emp = Emp { + phantom: PhantomData, + }; + box_new_with(e.into()); +} diff --git a/tests/crashes/146754.rs b/tests/crashes/146754.rs new file mode 100644 index 0000000000000..5d2bd96aa12ed --- /dev/null +++ b/tests/crashes/146754.rs @@ -0,0 +1,5 @@ +//@ known-bug: rust-lang/rust#146754 +//@ edition:2021 +unsafe extern "C" { + async fn function() -> [(); || {}]; +} diff --git a/tests/crashes/146755.rs b/tests/crashes/146755.rs new file mode 100644 index 0000000000000..fccf290866454 --- /dev/null +++ b/tests/crashes/146755.rs @@ -0,0 +1,10 @@ +//@ known-bug: rust-lang/rust#146577 +trait Trait { + type Assoc; +} + +fn foo(f: impl Fn(<() as Trait>::Assoc)) { + (|x| f(x))() +} + +fn main() {} diff --git a/tests/crashes/146834.rs b/tests/crashes/146834.rs new file mode 100644 index 0000000000000..d03b7f4794a3f --- /dev/null +++ b/tests/crashes/146834.rs @@ -0,0 +1,7 @@ +//@ known-bug: rust-lang/rust#146834 +//@compile-flags: -Wsingle-use-lifetimes +#![core::contracts::ensures] + +fn f4_<'a, 'b>(a: &'a i32, b: &'b i32) -> (&i32, &i32) { + loop {} +} diff --git a/tests/crashes/146903.rs b/tests/crashes/146903.rs new file mode 100644 index 0000000000000..b6a15203c8f0e --- /dev/null +++ b/tests/crashes/146903.rs @@ -0,0 +1,5 @@ +//@ known-bug: rust-lang/rust#146903 +#![feature(generic_const_exprs)] +#![feature(lazy_type_alias)] +type FooArg<'a, 'bb> = [u8; x]; +type _TaWhere1 = Box; diff --git a/tests/crashes/146906.rs b/tests/crashes/146906.rs new file mode 100644 index 0000000000000..c028ec8664676 --- /dev/null +++ b/tests/crashes/146906.rs @@ -0,0 +1,7 @@ +//@ known-bug: rust-lang/rust#146906 +#![feature(min_generic_const_args)] +trait Trait {} +impl Trait for [(); N] {} + +fn N(f: impl FnOnce(f64) -> f64 + Trait) {} +pub fn main() {} diff --git a/tests/crashes/146908.rs b/tests/crashes/146908.rs new file mode 100644 index 0000000000000..5d7d5218b664b --- /dev/null +++ b/tests/crashes/146908.rs @@ -0,0 +1,20 @@ +//@ known-bug: rust-lang/rust#146908 +#![feature(generic_const_exprs)] + +fn can_double(x: [(); N]) +where + [(); N * 2]:, +{ + x[0]; +} + +fn foo() +where + [(); (N + 1) * 2]:, +{ + can_double([(); { N + 1 }]); +} + +fn main() { + foo::<1>(); +} diff --git a/tests/crashes/146985.rs b/tests/crashes/146985.rs new file mode 100644 index 0000000000000..c639366f72405 --- /dev/null +++ b/tests/crashes/146985.rs @@ -0,0 +1,25 @@ +//@ known-bug: rust-lang/rust#146985 +//@edition: 2024 + +fn invalid_future() -> impl Future { + create_complex_future() +} + +fn create_complex_future() -> impl Future { + async { &|| async { invalid_future().await } } +} + +fn coerce_impl_trait() -> impl Future { + create_complex_future() +} + +trait ReturnsSend {} + +impl ReturnsSend for F +where + F: Fn() -> R, + R: Send, +{ +} + +fn main() {} diff --git a/tests/crashes/147208.rs b/tests/crashes/147208.rs new file mode 100644 index 0000000000000..df55baf3411d7 --- /dev/null +++ b/tests/crashes/147208.rs @@ -0,0 +1,8 @@ +//@ known-bug: rust-lang/rust#147208 +//@ edition: 2021 +use bar::foo; +use foo::bar; +fn main() { + mod bar; + use bar::foo; +} diff --git a/tests/crashes/147339.rs b/tests/crashes/147339.rs new file mode 100644 index 0000000000000..271f9c78b8d19 --- /dev/null +++ b/tests/crashes/147339.rs @@ -0,0 +1,11 @@ +//@ known-bug: rust-lang/rust#147339 +//@ compile-flags: --crate-type lib -Cinstrument-coverage +//@ needs-rustc-debug-assertions +macro_rules !foo { + ($($m : ident $($f : ident $v : tt) +) *) => { + $($(macro_rules !f{() =>{$v}}) + + macro_rules !$m{() =>{$(fn f()->i32{$v}) + }}) * + } +} +foo !(n c 3); +n!(); diff --git a/tests/crashes/147415.rs b/tests/crashes/147415.rs new file mode 100644 index 0000000000000..2bf01dc44c8d9 --- /dev/null +++ b/tests/crashes/147415.rs @@ -0,0 +1,6 @@ +//@ known-bug: rust-lang/rust#147415 +#![feature(min_generic_const_args)] + +fn foo() { + [0; size_of::<*mut T>()] +}