Skip to content

crashes: add latest #127344

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions tests/crashes/126896.rs
Original file line number Diff line number Diff line change
@@ -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 changes: 21 additions & 0 deletions tests/crashes/126939.rs
Original file line number Diff line number Diff line change
@@ -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 changes: 11 additions & 0 deletions tests/crashes/126942.rs
Original file line number Diff line number Diff line change
@@ -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 changes: 38 additions & 0 deletions tests/crashes/126944.rs
Original file line number Diff line number Diff line change
@@ -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 changes: 29 additions & 0 deletions tests/crashes/126966.rs
Original file line number Diff line number Diff line change
@@ -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 changes: 9 additions & 0 deletions tests/crashes/126969.rs
Original file line number Diff line number Diff line change
@@ -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 changes: 18 additions & 0 deletions tests/crashes/126982.rs
Original file line number Diff line number Diff line change
@@ -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 changes: 3 additions & 0 deletions tests/crashes/127222.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
//@ known-bug: rust-lang/rust#127222
#[marker]
trait Foo = PartialEq<i32> + Send;
17 changes: 17 additions & 0 deletions tests/crashes/127266.rs
Original file line number Diff line number Diff line change
@@ -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 changes: 12 additions & 0 deletions tests/crashes/127299.rs
Original file line number Diff line number Diff line change
@@ -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 changes: 20 additions & 0 deletions tests/crashes/127304.rs
Original file line number Diff line number Diff line change
@@ -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 changes: 9 additions & 0 deletions tests/crashes/127332.rs
Original file line number Diff line number Diff line change
@@ -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 };
}
Loading