diff --git a/tests/crashes/126896.rs b/tests/crashes/126896.rs new file mode 100644 index 00000000000..35bf9d5207a --- /dev/null +++ b/tests/crashes/126896.rs @@ -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() { +} diff --git a/tests/crashes/126939.rs b/tests/crashes/126939.rs new file mode 100644 index 00000000000..1edf7484606 --- /dev/null +++ b/tests/crashes/126939.rs @@ -0,0 +1,21 @@ +//@ known-bug: rust-lang/rust#126939 + +struct MySlice(bool, T); +type MySliceBool = MySlice<[bool]>; + +use std::mem; + +struct P2 { + a: T, + b: MySliceBool, +} + +macro_rules! check { + ($t:ty, $align:expr) => ({ + assert_eq!(mem::align_of::<$t>(), $align); + }); +} + +pub fn main() { + check!(P2, 1); +} diff --git a/tests/crashes/126942.rs b/tests/crashes/126942.rs new file mode 100644 index 00000000000..e4adc8fab28 --- /dev/null +++ b/tests/crashes/126942.rs @@ -0,0 +1,11 @@ +//@ known-bug: rust-lang/rust#126942 +struct Thing; + +pub trait Every { + type Assoc; +} +impl Every for Thing { + type Assoc = T; +} + +static I: ::Assoc = 3; diff --git a/tests/crashes/126944.rs b/tests/crashes/126944.rs new file mode 100644 index 00000000000..c0c5622e260 --- /dev/null +++ b/tests/crashes/126944.rs @@ -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 = ::DummyType; + +// Step 2: Create names for a single trait object type: `TraitObject` and `AlsoTraitObject` + +pub trait SomeTrait { + type Item; +} +type TraitObject = dyn SomeTrait; +type AlsoTraitObject = dyn SomeTrait; + +// Step 3: Force the compiler to check whether the two names are the same type + +pub trait Supertrait { + type Foo; +} +pub trait Subtrait: Supertrait {} + +pub trait HasOutput { + type Output; +} + +fn foo() -> F::Output +where + F: HasOutput>, +{ + todo!() +} diff --git a/tests/crashes/126966.rs b/tests/crashes/126966.rs new file mode 100644 index 00000000000..edeedc68c40 --- /dev/null +++ b/tests/crashes/126966.rs @@ -0,0 +1,29 @@ +//@ known-bug: rust-lang/rust#126966 +mod assert { + use std::mem::{Assume, BikeshedIntrinsicFrom}; + + pub fn is_transmutable() + where + Dst: BikeshedIntrinsicFrom, + { + } +} + +#[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::(); +} diff --git a/tests/crashes/126969.rs b/tests/crashes/126969.rs new file mode 100644 index 00000000000..676563d059c --- /dev/null +++ b/tests/crashes/126969.rs @@ -0,0 +1,9 @@ +//@ known-bug: rust-lang/rust#126969 + +struct S { + _: union { t: T }, +} + +fn f(S::<&i8> { .. }: S<&i8>) {} + +fn main() {} diff --git a/tests/crashes/126982.rs b/tests/crashes/126982.rs new file mode 100644 index 00000000000..8522d9415eb --- /dev/null +++ b/tests/crashes/126982.rs @@ -0,0 +1,18 @@ +//@ known-bug: rust-lang/rust#126982 + +#![feature(coerce_unsized)] +use std::ops::CoerceUnsized; + +struct Foo { + a: T, +} + +impl CoerceUnsized for Foo {} + +union U { + a: usize, +} + +const C: U = Foo { a: 10 }; + +fn main() {} diff --git a/tests/crashes/127222.rs b/tests/crashes/127222.rs new file mode 100644 index 00000000000..eda0ea3d9b7 --- /dev/null +++ b/tests/crashes/127222.rs @@ -0,0 +1,3 @@ +//@ known-bug: rust-lang/rust#127222 +#[marker] +trait Foo = PartialEq + Send; diff --git a/tests/crashes/127266.rs b/tests/crashes/127266.rs new file mode 100644 index 00000000000..2bdbe03e373 --- /dev/null +++ b/tests/crashes/127266.rs @@ -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() {} diff --git a/tests/crashes/127299.rs b/tests/crashes/127299.rs new file mode 100644 index 00000000000..7eb78387997 --- /dev/null +++ b/tests/crashes/127299.rs @@ -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() {} diff --git a/tests/crashes/127304.rs b/tests/crashes/127304.rs new file mode 100644 index 00000000000..2975fc27f67 --- /dev/null +++ b/tests/crashes/127304.rs @@ -0,0 +1,20 @@ +//@ known-bug: rust-lang/rust #127304 +#![feature(adt_const_params)] + +trait Trait {} +impl Trait for () {} + +struct MyStr(str); +impl std::marker::ConstParamTy for MyStr {} + +fn function_with_my_str() -> &'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") }>(); +} diff --git a/tests/crashes/127332.rs b/tests/crashes/127332.rs new file mode 100644 index 00000000000..5c14af01cec --- /dev/null +++ b/tests/crashes/127332.rs @@ -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 }; +}