Auto merge of #127344 - matthiaskrgr:morecrashes, r=jieyouxu

crashes: add latest

r? `@jieyouxu`
`@bors` rollup=iffy
This commit is contained in:
bors 2024-07-05 06:19:47 +00:00
commit d2e6cf7fa7
12 changed files with 204 additions and 0 deletions

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

@ -0,0 +1,17 @@
//@ known-bug: rust-lang/rust#126896
//@ compile-flags: -Zpolymorphize=on -Zinline-mir=yes
#![feature(type_alias_impl_trait)]
type Two<'a, 'b> = impl std::fmt::Debug;
fn set(x: &mut isize) -> isize {
*x
}
fn d(x: Two) {
let c1 = || set(x);
c1;
}
fn main() {
}

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

@ -0,0 +1,21 @@
//@ known-bug: rust-lang/rust#126939
struct MySlice<T: Copy>(bool, T);
type MySliceBool = MySlice<[bool]>;
use std::mem;
struct P2<T> {
a: T,
b: MySliceBool,
}
macro_rules! check {
($t:ty, $align:expr) => ({
assert_eq!(mem::align_of::<$t>(), $align);
});
}
pub fn main() {
check!(P2<u8>, 1);
}

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

@ -0,0 +1,11 @@
//@ known-bug: rust-lang/rust#126942
struct Thing;
pub trait Every {
type Assoc;
}
impl<T: ?Sized> Every for Thing {
type Assoc = T;
}
static I: <Thing as Every>::Assoc = 3;

38
tests/crashes/126944.rs Normal file
View File

@ -0,0 +1,38 @@
//@ known-bug: rust-lang/rust#126944
// Step 1: Create two names for a single type: `Thing` and `AlsoThing`
struct Thing;
struct Dummy;
pub trait DummyTrait {
type DummyType;
}
impl DummyTrait for Dummy {
type DummyType = Thing;
}
type AlsoThing = <Dummy as DummyTrait>::DummyType;
// Step 2: Create names for a single trait object type: `TraitObject` and `AlsoTraitObject`
pub trait SomeTrait {
type Item;
}
type TraitObject = dyn SomeTrait<Item = AlsoThing>;
type AlsoTraitObject = dyn SomeTrait<Item = Thing>;
// Step 3: Force the compiler to check whether the two names are the same type
pub trait Supertrait {
type Foo;
}
pub trait Subtrait: Supertrait<Foo = TraitObject> {}
pub trait HasOutput<A: ?Sized> {
type Output;
}
fn foo<F>() -> F::Output
where
F: HasOutput<dyn Subtrait<Foo = AlsoTraitObject>>,
{
todo!()
}

29
tests/crashes/126966.rs Normal file
View File

@ -0,0 +1,29 @@
//@ known-bug: rust-lang/rust#126966
mod assert {
use std::mem::{Assume, BikeshedIntrinsicFrom};
pub fn is_transmutable<Src, Dst>()
where
Dst: BikeshedIntrinsicFrom<Src>,
{
}
}
#[repr(u32)]
enum Ox00 {
V = 0x00,
}
#[repr(C, packed(2))]
enum OxFF {
V = 0xFF,
}
fn test() {
union Superset {
a: Ox00,
b: OxFF,
}
assert::is_transmutable::<Superset, Subset>();
}

9
tests/crashes/126969.rs Normal file
View File

@ -0,0 +1,9 @@
//@ known-bug: rust-lang/rust#126969
struct S<T> {
_: union { t: T },
}
fn f(S::<&i8> { .. }: S<&i8>) {}
fn main() {}

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

@ -0,0 +1,18 @@
//@ known-bug: rust-lang/rust#126982
#![feature(coerce_unsized)]
use std::ops::CoerceUnsized;
struct Foo<T: ?Sized> {
a: T,
}
impl<T, U> CoerceUnsized<U> for Foo<T> {}
union U {
a: usize,
}
const C: U = Foo { a: 10 };
fn main() {}

3
tests/crashes/127222.rs Normal file
View File

@ -0,0 +1,3 @@
//@ known-bug: rust-lang/rust#127222
#[marker]
trait Foo = PartialEq<i32> + Send;

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

@ -0,0 +1,17 @@
//@ known-bug: rust-lang/rust#127266
#![feature(const_mut_refs)]
#![feature(const_refs_to_static)]
struct Meh {
x: &'static dyn UnsafeCell,
}
const MUH: Meh = Meh {
x: &mut *(READONLY as *mut _),
};
static READONLY: i32 = 0;
trait UnsafeCell<'a> {}
pub fn main() {}

12
tests/crashes/127299.rs Normal file
View File

@ -0,0 +1,12 @@
//@ known-bug: rust-lang/rust#127299
trait Qux {
fn bar() -> i32;
}
pub struct Lint {
pub desc: &'static Qux,
}
static FOO: &Lint = &Lint { desc: "desc" };
fn main() {}

20
tests/crashes/127304.rs Normal file
View File

@ -0,0 +1,20 @@
//@ known-bug: rust-lang/rust #127304
#![feature(adt_const_params)]
trait Trait<T> {}
impl Trait<u16> for () {}
struct MyStr(str);
impl std::marker::ConstParamTy for MyStr {}
fn function_with_my_str<const S: &'static MyStr>() -> &'static MyStr {
S
}
impl MyStr {
const fn new(s: &Trait str) -> &'static MyStr {}
}
pub fn main() {
let f = function_with_my_str::<{ MyStr::new("hello") }>();
}

9
tests/crashes/127332.rs Normal file
View File

@ -0,0 +1,9 @@
//@ known-bug: rust-lang/rust #127332
async fn fun() {
enum Foo {
A { x: u32 },
}
let orig = Foo::A { x: 5 };
Foo::A { x: 6, ..orig };
}