Rollup merge of #128036 - matthiaskrgr:ccrashes, r=jieyouxu

add more tests

r? `@jieyouxu`
This commit is contained in:
Trevor Gross 2024-07-22 11:40:22 -05:00 committed by GitHub
commit 526b4c9070
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
11 changed files with 144 additions and 0 deletions

17
tests/crashes/127351.rs Normal file
View File

@ -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() {}

18
tests/crashes/127353.rs Normal file
View File

@ -0,0 +1,18 @@
//@ known-bug: #127353
#![feature(type_alias_impl_trait)]
trait Trait<T> {}
type Alias<'a, U> = impl Trait<U>;
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() {}

14
tests/crashes/127628.rs Normal file
View File

@ -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 }
}
}

18
tests/crashes/127643.rs Normal file
View File

@ -0,0 +1,18 @@
//@ known-bug: #127643
#![feature(associated_const_equality)]
fn user() -> impl Owner<dyn Sized, C = 0> {}
trait Owner<K> {
const C: K;
}
impl<K: ConstDefault> Owner<K> for () {
const C: K = K::DEFAULT;
}
trait ConstDefault {
const DEFAULT: Self;
}
fn main() {}

8
tests/crashes/127676.rs Normal file
View File

@ -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() {}

21
tests/crashes/127737.rs Normal file
View File

@ -0,0 +1,21 @@
//@ known-bug: #127737
//@ compile-flags: -Zmir-opt-level=5 --crate-type lib
pub trait TestTrait {
type MyType;
fn func() -> Option<Self>
where
Self: Sized;
}
impl<T> dyn TestTrait<MyType = T>
where
Self: Sized,
{
pub fn other_func() -> Option<Self> {
match Self::func() {
Some(me) => Some(me),
None => None,
}
}
}

11
tests/crashes/127742.rs Normal file
View File

@ -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 };

5
tests/crashes/127880.rs Normal file
View File

@ -0,0 +1,5 @@
//@ known-bug: #127880
//@ compile-flags: -Cinstrument-coverage
#[coverage]
fn main() {}

16
tests/crashes/127916.rs Normal file
View File

@ -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 }
}

6
tests/crashes/127972.rs Normal file
View File

@ -0,0 +1,6 @@
//@ known-bug: #127962
#![feature(generic_const_exprs)]
fn zero_init<const usize: usize>() -> Substs1<{ (N) }> {
Substs1([0; { (usize) }])
}

10
tests/crashes/128016.rs Normal file
View File

@ -0,0 +1,10 @@
//@ known-bug: #128016
macro_rules! len {
() => {
target
};
}
fn main() {
let val: [str; len!()] = [];
}