Skip to content

Commit

Permalink
Rollup merge of rust-lang#129135 - matthiaskrgr:ITKEEPSCRASHINGAAAAAA…
Browse files Browse the repository at this point in the history
…AAHH, r=compiler-errors

crashes: more tests

r? ````@jieyouxu````
  • Loading branch information
workingjubilee authored Aug 16, 2024
2 parents 051eba0 + 7d99549 commit e463490
Show file tree
Hide file tree
Showing 9 changed files with 131 additions and 0 deletions.
11 changes: 11 additions & 0 deletions tests/crashes/128695.rs
Original file line number Diff line number Diff line change
@@ -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 changes: 25 additions & 0 deletions tests/crashes/128810.rs
Original file line number Diff line number Diff line change
@@ -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 changes: 5 additions & 0 deletions tests/crashes/128848.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
//@ known-bug: rust-lang/rust#128848

fn f<T>(a: T, b: T, c: T) {
f.call_once()
}
18 changes: 18 additions & 0 deletions tests/crashes/128870.rs
Original file line number Diff line number Diff line change
@@ -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 changes: 16 additions & 0 deletions tests/crashes/129075.rs
Original file line number Diff line number Diff line change
@@ -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 changes: 10 additions & 0 deletions tests/crashes/129095.rs
Original file line number Diff line number Diff line change
@@ -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 changes: 15 additions & 0 deletions tests/crashes/129099.rs
Original file line number Diff line number Diff line change
@@ -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 changes: 10 additions & 0 deletions tests/crashes/129109.rs
Original file line number Diff line number Diff line change
@@ -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 changes: 21 additions & 0 deletions tests/crashes/129127.rs
Original file line number Diff line number Diff line change
@@ -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();
}

0 comments on commit e463490

Please sign in to comment.