Skip to content

Commit eb19e81

Browse files
committed
crashes: add latest
1 parent 8a9cccb commit eb19e81

12 files changed

+204
-0
lines changed

Diff for: tests/crashes/126896.rs

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
//@ known-bug: rust-lang/rust#126896
2+
//@ compile-flags: -Zpolymorphize=on -Zinline-mir=yes
3+
4+
#![feature(type_alias_impl_trait)]
5+
type Two<'a, 'b> = impl std::fmt::Debug;
6+
7+
fn set(x: &mut isize) -> isize {
8+
*x
9+
}
10+
11+
fn d(x: Two) {
12+
let c1 = || set(x);
13+
c1;
14+
}
15+
16+
fn main() {
17+
}

Diff for: tests/crashes/126939.rs

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
//@ known-bug: rust-lang/rust#126939
2+
3+
struct MySlice<T: Copy>(bool, T);
4+
type MySliceBool = MySlice<[bool]>;
5+
6+
use std::mem;
7+
8+
struct P2<T> {
9+
a: T,
10+
b: MySliceBool,
11+
}
12+
13+
macro_rules! check {
14+
($t:ty, $align:expr) => ({
15+
assert_eq!(mem::align_of::<$t>(), $align);
16+
});
17+
}
18+
19+
pub fn main() {
20+
check!(P2<u8>, 1);
21+
}

Diff for: tests/crashes/126942.rs

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
//@ known-bug: rust-lang/rust#126942
2+
struct Thing;
3+
4+
pub trait Every {
5+
type Assoc;
6+
}
7+
impl<T: ?Sized> Every for Thing {
8+
type Assoc = T;
9+
}
10+
11+
static I: <Thing as Every>::Assoc = 3;

Diff for: tests/crashes/126944.rs

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
//@ known-bug: rust-lang/rust#126944
2+
// Step 1: Create two names for a single type: `Thing` and `AlsoThing`
3+
4+
struct Thing;
5+
struct Dummy;
6+
pub trait DummyTrait {
7+
type DummyType;
8+
}
9+
impl DummyTrait for Dummy {
10+
type DummyType = Thing;
11+
}
12+
type AlsoThing = <Dummy as DummyTrait>::DummyType;
13+
14+
// Step 2: Create names for a single trait object type: `TraitObject` and `AlsoTraitObject`
15+
16+
pub trait SomeTrait {
17+
type Item;
18+
}
19+
type TraitObject = dyn SomeTrait<Item = AlsoThing>;
20+
type AlsoTraitObject = dyn SomeTrait<Item = Thing>;
21+
22+
// Step 3: Force the compiler to check whether the two names are the same type
23+
24+
pub trait Supertrait {
25+
type Foo;
26+
}
27+
pub trait Subtrait: Supertrait<Foo = TraitObject> {}
28+
29+
pub trait HasOutput<A: ?Sized> {
30+
type Output;
31+
}
32+
33+
fn foo<F>() -> F::Output
34+
where
35+
F: HasOutput<dyn Subtrait<Foo = AlsoTraitObject>>,
36+
{
37+
todo!()
38+
}

Diff for: tests/crashes/126966.rs

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
//@ known-bug: rust-lang/rust#126966
2+
mod assert {
3+
use std::mem::{Assume, BikeshedIntrinsicFrom};
4+
5+
pub fn is_transmutable<Src, Dst>()
6+
where
7+
Dst: BikeshedIntrinsicFrom<Src>,
8+
{
9+
}
10+
}
11+
12+
#[repr(u32)]
13+
enum Ox00 {
14+
V = 0x00,
15+
}
16+
17+
#[repr(C, packed(2))]
18+
enum OxFF {
19+
V = 0xFF,
20+
}
21+
22+
fn test() {
23+
union Superset {
24+
a: Ox00,
25+
b: OxFF,
26+
}
27+
28+
assert::is_transmutable::<Superset, Subset>();
29+
}

Diff for: tests/crashes/126969.rs

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
//@ known-bug: rust-lang/rust#126969
2+
3+
struct S<T> {
4+
_: union { t: T },
5+
}
6+
7+
fn f(S::<&i8> { .. }: S<&i8>) {}
8+
9+
fn main() {}

Diff for: tests/crashes/126982.rs

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
//@ known-bug: rust-lang/rust#126982
2+
3+
#![feature(coerce_unsized)]
4+
use std::ops::CoerceUnsized;
5+
6+
struct Foo<T: ?Sized> {
7+
a: T,
8+
}
9+
10+
impl<T, U> CoerceUnsized<U> for Foo<T> {}
11+
12+
union U {
13+
a: usize,
14+
}
15+
16+
const C: U = Foo { a: 10 };
17+
18+
fn main() {}

Diff for: tests/crashes/127222.rs

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

Diff for: tests/crashes/127266.rs

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
//@ known-bug: rust-lang/rust#127266
2+
#![feature(const_mut_refs)]
3+
#![feature(const_refs_to_static)]
4+
5+
struct Meh {
6+
x: &'static dyn UnsafeCell,
7+
}
8+
9+
const MUH: Meh = Meh {
10+
x: &mut *(READONLY as *mut _),
11+
};
12+
13+
static READONLY: i32 = 0;
14+
15+
trait UnsafeCell<'a> {}
16+
17+
pub fn main() {}

Diff for: tests/crashes/127299.rs

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
//@ known-bug: rust-lang/rust#127299
2+
trait Qux {
3+
fn bar() -> i32;
4+
}
5+
6+
pub struct Lint {
7+
pub desc: &'static Qux,
8+
}
9+
10+
static FOO: &Lint = &Lint { desc: "desc" };
11+
12+
fn main() {}

Diff for: tests/crashes/127304.rs

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
//@ known-bug: rust-lang/rust #127304
2+
#![feature(adt_const_params)]
3+
4+
trait Trait<T> {}
5+
impl Trait<u16> for () {}
6+
7+
struct MyStr(str);
8+
impl std::marker::ConstParamTy for MyStr {}
9+
10+
fn function_with_my_str<const S: &'static MyStr>() -> &'static MyStr {
11+
S
12+
}
13+
14+
impl MyStr {
15+
const fn new(s: &Trait str) -> &'static MyStr {}
16+
}
17+
18+
pub fn main() {
19+
let f = function_with_my_str::<{ MyStr::new("hello") }>();
20+
}

Diff for: tests/crashes/127332.rs

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
//@ known-bug: rust-lang/rust #127332
2+
3+
async fn fun() {
4+
enum Foo {
5+
A { x: u32 },
6+
}
7+
let orig = Foo::A { x: 5 };
8+
Foo::A { x: 6, ..orig };
9+
}

0 commit comments

Comments
 (0)