From 5ab2e4029417219484ee37f009731cfb799740e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Kr=C3=BCger?= Date: Sun, 21 Jul 2024 17:50:57 +0200 Subject: [PATCH] add more tests --- tests/crashes/127351.rs | 17 +++++++++++++++++ tests/crashes/127353.rs | 18 ++++++++++++++++++ tests/crashes/127628.rs | 14 ++++++++++++++ tests/crashes/127643.rs | 18 ++++++++++++++++++ tests/crashes/127676.rs | 8 ++++++++ tests/crashes/127737.rs | 21 +++++++++++++++++++++ tests/crashes/127742.rs | 11 +++++++++++ tests/crashes/127880.rs | 5 +++++ tests/crashes/127916.rs | 16 ++++++++++++++++ tests/crashes/127972.rs | 6 ++++++ tests/crashes/128016.rs | 10 ++++++++++ 11 files changed, 144 insertions(+) create mode 100644 tests/crashes/127351.rs create mode 100644 tests/crashes/127353.rs create mode 100644 tests/crashes/127628.rs create mode 100644 tests/crashes/127643.rs create mode 100644 tests/crashes/127676.rs create mode 100644 tests/crashes/127737.rs create mode 100644 tests/crashes/127742.rs create mode 100644 tests/crashes/127880.rs create mode 100644 tests/crashes/127916.rs create mode 100644 tests/crashes/127972.rs create mode 100644 tests/crashes/128016.rs diff --git a/tests/crashes/127351.rs b/tests/crashes/127351.rs new file mode 100644 index 00000000000..e3f41594885 --- /dev/null +++ b/tests/crashes/127351.rs @@ -0,0 +1,17 @@ +//@ known-bug: #127351 +#![feature(lazy_type_alias)] +#![allow(incomplete_features)] + +struct Outer0<'a, T>(ExplicitTypeOutlives<'a, T>); +type ExplicitTypeOutlives<'a, T: 'a> = (&'a (), T); + +pub struct Warns { + _significant_drop: ExplicitTypeOutlives, + field: String, +} + +pub fn test(w: Warns) { + _ = || drop(w.field); +} + +fn main() {} diff --git a/tests/crashes/127353.rs b/tests/crashes/127353.rs new file mode 100644 index 00000000000..9bcb90b5c57 --- /dev/null +++ b/tests/crashes/127353.rs @@ -0,0 +1,18 @@ +//@ known-bug: #127353 +#![feature(type_alias_impl_trait)] +trait Trait {} +type Alias<'a, U> = impl Trait; + +fn f<'a>() -> Alias<'a, ()> {} + +pub enum UninhabitedVariants { + Tuple(Alias), +} + +struct A; + +fn cannot_empty_match_on_enum_with_empty_variants_struct_to_anything(x: UninhabitedVariants) -> A { + match x {} +} + +fn main() {} diff --git a/tests/crashes/127628.rs b/tests/crashes/127628.rs new file mode 100644 index 00000000000..f11ab3f7e8d --- /dev/null +++ b/tests/crashes/127628.rs @@ -0,0 +1,14 @@ +//@ known-bug: #127628 +//@ compile-flags: -Zpolonius=next + +use std::io::{self, Read}; + +pub struct Container<'a> { + reader: &'a mut dyn Read, +} + +impl<'a> Container { + pub fn wrap<'s>(reader: &'s mut dyn io::Read) -> Container<'s> { + Container { reader: reader } + } +} diff --git a/tests/crashes/127643.rs b/tests/crashes/127643.rs new file mode 100644 index 00000000000..a4db9397bde --- /dev/null +++ b/tests/crashes/127643.rs @@ -0,0 +1,18 @@ +//@ known-bug: #127643 + +#![feature(associated_const_equality)] + +fn user() -> impl Owner {} + +trait Owner { + const C: K; +} +impl Owner for () { + const C: K = K::DEFAULT; +} + +trait ConstDefault { + const DEFAULT: Self; +} + +fn main() {} diff --git a/tests/crashes/127676.rs b/tests/crashes/127676.rs new file mode 100644 index 00000000000..81149c2ef84 --- /dev/null +++ b/tests/crashes/127676.rs @@ -0,0 +1,8 @@ +//@ known-bug: #127676 +//@ edition:2018 + +#![feature(dyn_star,const_async_blocks)] + +static S: dyn* Send + Sync = async { 42 }; + +pub fn main() {} diff --git a/tests/crashes/127737.rs b/tests/crashes/127737.rs new file mode 100644 index 00000000000..2ee8c769858 --- /dev/null +++ b/tests/crashes/127737.rs @@ -0,0 +1,21 @@ +//@ known-bug: #127737 +//@ compile-flags: -Zmir-opt-level=5 --crate-type lib + +pub trait TestTrait { + type MyType; + fn func() -> Option + where + Self: Sized; +} + +impl dyn TestTrait +where + Self: Sized, +{ + pub fn other_func() -> Option { + match Self::func() { + Some(me) => Some(me), + None => None, + } + } +} diff --git a/tests/crashes/127742.rs b/tests/crashes/127742.rs new file mode 100644 index 00000000000..24add454135 --- /dev/null +++ b/tests/crashes/127742.rs @@ -0,0 +1,11 @@ +//@ known-bug: #127742 +struct Vtable(dyn Cap); // missing lifetime + +trait Cap<'a> {} + +union Transmute { + t: u64, // ICEs with u64, u128, or usize. Correctly errors with u32. + u: &'static Vtable, +} + +const G: &'static Vtable = unsafe { Transmute { t: 1 }.u }; diff --git a/tests/crashes/127880.rs b/tests/crashes/127880.rs new file mode 100644 index 00000000000..6c625eac691 --- /dev/null +++ b/tests/crashes/127880.rs @@ -0,0 +1,5 @@ +//@ known-bug: #127880 +//@ compile-flags: -Cinstrument-coverage + +#[coverage] +fn main() {} diff --git a/tests/crashes/127916.rs b/tests/crashes/127916.rs new file mode 100644 index 00000000000..295c88df857 --- /dev/null +++ b/tests/crashes/127916.rs @@ -0,0 +1,16 @@ +//@ known-bug: #127916 + +trait Trait { + fn foo(&self) -> u32 { 0 } +} + +struct F; +struct S; + +mod to_reuse { + pub fn foo(&self) -> u32 {} +} + +impl Trait S { + reuse to_reuse::foo { self } +} diff --git a/tests/crashes/127972.rs b/tests/crashes/127972.rs new file mode 100644 index 00000000000..d0764f875db --- /dev/null +++ b/tests/crashes/127972.rs @@ -0,0 +1,6 @@ +//@ known-bug: #127962 +#![feature(generic_const_exprs)] + +fn zero_init() -> Substs1<{ (N) }> { + Substs1([0; { (usize) }]) +} diff --git a/tests/crashes/128016.rs b/tests/crashes/128016.rs new file mode 100644 index 00000000000..d23721ae14e --- /dev/null +++ b/tests/crashes/128016.rs @@ -0,0 +1,10 @@ +//@ known-bug: #128016 +macro_rules! len { + () => { + target + }; +} + +fn main() { + let val: [str; len!()] = []; +}