Auto merge of #124236 - matthiaskrgr:n-ice, r=jieyouxu

crashes: add a couple more ICE tests
This commit is contained in:
bors 2024-04-22 07:57:04 +00:00
commit b3e117044c
6 changed files with 62 additions and 0 deletions

4
tests/crashes/123664.rs Normal file
View File

@ -0,0 +1,4 @@
//@ known-bug: #123664
#![feature(generic_const_exprs, effects)]
const fn with_positive<F: ~const Fn()>() {}
pub fn main() {}

6
tests/crashes/123955.rs Normal file
View File

@ -0,0 +1,6 @@
//@ known-bug: #123955
//@ compile-flags: -Clto -Zvirtual-function-elimination
//@ only-x86_64
pub fn main() {
_ = Box::new(()) as Box<dyn Send>;
}

7
tests/crashes/124092.rs Normal file
View File

@ -0,0 +1,7 @@
//@ known-bug: #124092
//@ compile-flags: -Zvirtual-function-elimination=true -Clto=true
//@ only-x86_64
const X: for<'b> fn(&'b ()) = |&()| ();
fn main() {
let dyn_debug = Box::new(X) as Box<fn(&'static ())> as Box<dyn Send>;
}

22
tests/crashes/124182.rs Normal file
View File

@ -0,0 +1,22 @@
//@ known-bug: #124182
struct LazyLock<T> {
data: (Copy, fn() -> T),
}
impl<T> LazyLock<T> {
pub const fn new(f: fn() -> T) -> LazyLock<T> {
LazyLock { data: (None, f) }
}
}
struct A<T = i32>(Option<T>);
impl<T> Default for A<T> {
fn default() -> Self {
A(None)
}
}
static EMPTY_SET: LazyLock<A<i32>> = LazyLock::new(A::default);
fn main() {}

14
tests/crashes/124189.rs Normal file
View File

@ -0,0 +1,14 @@
//@ known-bug: #124189
trait Trait {
type Type;
}
impl<T> Trait for T {
type Type = ();
}
fn f(_: <&Copy as Trait>::Type) {}
fn main() {
f(());
}

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

@ -0,0 +1,9 @@
//@ known-bug: #124207
#![feature(transmutability)]
#![feature(type_alias_impl_trait)]
trait OpaqueTrait {}
type OpaqueType = impl OpaqueTrait;
trait AnotherTrait {}
impl<T: std::mem::BikeshedIntrinsicFrom<(), ()>> AnotherTrait for T {}
impl AnotherTrait for OpaqueType {}
pub fn main() {}