Skip to content

Commit

Permalink
Rollup merge of #124236 - matthiaskrgr:n-ice, r=jieyouxu
Browse files Browse the repository at this point in the history
crashes: add a couple more ICE tests
  • Loading branch information
matthiaskrgr authored Apr 22, 2024
2 parents eb70af2 + 6774801 commit ea6e206
Show file tree
Hide file tree
Showing 6 changed files with 62 additions and 0 deletions.
4 changes: 4 additions & 0 deletions tests/crashes/123664.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
//@ known-bug: #123664
#![feature(generic_const_exprs, effects)]
const fn with_positive<F: ~const Fn()>() {}
pub fn main() {}
6 changes: 6 additions & 0 deletions tests/crashes/123955.rs
Original file line number Diff line number Diff line change
@@ -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 changes: 7 additions & 0 deletions tests/crashes/124092.rs
Original file line number Diff line number Diff line change
@@ -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 changes: 22 additions & 0 deletions tests/crashes/124182.rs
Original file line number Diff line number Diff line change
@@ -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 changes: 14 additions & 0 deletions tests/crashes/124189.rs
Original file line number Diff line number Diff line change
@@ -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 changes: 9 additions & 0 deletions tests/crashes/124207.rs
Original file line number Diff line number Diff line change
@@ -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() {}

0 comments on commit ea6e206

Please sign in to comment.