Rollup merge of #129135 - matthiaskrgr:ITKEEPSCRASHINGAAAAAAAAHH, r=compiler-errors

crashes: more tests

r? ````@jieyouxu````
This commit is contained in:
Jubilee 2024-08-15 18:44:19 -07:00 committed by GitHub
commit e463490ecf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 131 additions and 0 deletions

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

@ -0,0 +1,11 @@
//@ known-bug: rust-lang/rust#128695
//@ edition: 2021
use core::pin::{pin, Pin};
fn main() {
let fut = pin!(async {
let async_drop_fut = pin!(core::future::async_drop(async {}));
(async_drop_fut).await;
});
}

25
tests/crashes/128810.rs Normal file
View File

@ -0,0 +1,25 @@
//@ known-bug: rust-lang/rust#128810
#![feature(fn_delegation)]
use std::marker::PhantomData;
pub struct InvariantRef<'a, T: ?Sized>(&'a T, PhantomData<&'a mut &'a T>);
impl<'a> InvariantRef<'a, ()> {
pub const NEW: Self = InvariantRef::new(&());
}
trait Trait {
fn foo(&self) -> u8 { 0 }
fn bar(&self) -> u8 { 1 }
fn meh(&self) -> u8 { 2 }
}
struct Z(u8);
impl Trait for Z {
reuse <u8 as Trait>::{foo, bar, meh} { &const { InvariantRef::<'a>::NEW } }
}
fn main() { }

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

@ -0,0 +1,5 @@
//@ known-bug: rust-lang/rust#128848
fn f<T>(a: T, b: T, c: T) {
f.call_once()
}

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

@ -0,0 +1,18 @@
//@ known-bug: rust-lang/rust#128870
//@ compile-flags: -Zvalidate-mir
#[repr(packed)]
#[repr(u32)]
enum E {
A,
B,
C,
}
fn main() {
union InvalidTag {
int: u32,
e: E,
}
let _invalid_tag = InvalidTag { int: 4 };
}

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

@ -0,0 +1,16 @@
//@ known-bug: rust-lang/rust#129075
//@ compile-flags: -Zvalidate-mir -Zinline-mir=yes
struct Foo<T>([T; 2]);
impl<T: Default + Copy> Default for Foo<T> {
fn default(&mut self) -> Self {
Foo([Default::default(); 2])
}
}
fn field_array() {
let a: i32;
let b;
Foo([a, b]) = Default::default();
}

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

@ -0,0 +1,10 @@
//@ known-bug: rust-lang/rust#129095
//@ compile-flags: -Zmir-opt-level=5 -Zvalidate-mir
pub fn function_with_bytes<const BYTES: &'static [u8; 4]>() -> &'static [u8] {
BYTES
}
pub fn main() {
assert_eq!(function_with_bytes::<b"AAAAb">(), &[0x41, 0x41, 0x41, 0x41]);
}

15
tests/crashes/129099.rs Normal file
View File

@ -0,0 +1,15 @@
//@ known-bug: rust-lang/rust#129099
#![feature(type_alias_impl_trait)]
fn dyn_hoops<T: Sized>() -> dyn for<'a> Iterator<Item = impl Captures<'a>> {
loop {}
}
pub fn main() {
type Opaque = impl Sized;
fn define() -> Opaque {
let x: Opaque = dyn_hoops::<()>(0);
x
}
}

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

@ -0,0 +1,10 @@
//@ known-bug: rust-lang/rust#129109
//@ compile-flags: -Zmir-opt-level=5 -Zvalidate-mir
extern "C" {
pub static mut symbol: [i8];
}
fn main() {
println!("C", unsafe { &symbol });
}

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

@ -0,0 +1,21 @@
//@ known-bug: rust-lang/rust#129127
//@ compile-flags: -Zmir-opt-level=5 -Zvalidate-mir -Zcross-crate-inline-threshold=always
pub struct Rows<'a>();
impl<'a> Iterator for Rows<'a> {
type Item = ();
fn next() -> Option<Self::Item> {
let mut rows = Rows();
rows.map(|row| row).next()
}
}
fn main() {
let mut rows = Rows();
rows.next();
}