From 67748015631ebbb798c6b8f2693fead06d06ce87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Kr=C3=BCger?= Date: Sun, 21 Apr 2024 21:01:04 +0200 Subject: [PATCH] crashes: add a couple more ICE tests --- tests/crashes/123664.rs | 4 ++++ tests/crashes/123955.rs | 6 ++++++ tests/crashes/124092.rs | 7 +++++++ tests/crashes/124182.rs | 22 ++++++++++++++++++++++ tests/crashes/124189.rs | 14 ++++++++++++++ tests/crashes/124207.rs | 9 +++++++++ 6 files changed, 62 insertions(+) create mode 100644 tests/crashes/123664.rs create mode 100644 tests/crashes/123955.rs create mode 100644 tests/crashes/124092.rs create mode 100644 tests/crashes/124182.rs create mode 100644 tests/crashes/124189.rs create mode 100644 tests/crashes/124207.rs diff --git a/tests/crashes/123664.rs b/tests/crashes/123664.rs new file mode 100644 index 00000000000..80c415fe07b --- /dev/null +++ b/tests/crashes/123664.rs @@ -0,0 +1,4 @@ +//@ known-bug: #123664 +#![feature(generic_const_exprs, effects)] +const fn with_positive() {} +pub fn main() {} diff --git a/tests/crashes/123955.rs b/tests/crashes/123955.rs new file mode 100644 index 00000000000..fdd58c84794 --- /dev/null +++ b/tests/crashes/123955.rs @@ -0,0 +1,6 @@ +//@ known-bug: #123955 +//@ compile-flags: -Clto -Zvirtual-function-elimination +//@ only-x86_64 +pub fn main() { + _ = Box::new(()) as Box; +} diff --git a/tests/crashes/124092.rs b/tests/crashes/124092.rs new file mode 100644 index 00000000000..c03db384e76 --- /dev/null +++ b/tests/crashes/124092.rs @@ -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 as Box; +} diff --git a/tests/crashes/124182.rs b/tests/crashes/124182.rs new file mode 100644 index 00000000000..46948207df3 --- /dev/null +++ b/tests/crashes/124182.rs @@ -0,0 +1,22 @@ +//@ known-bug: #124182 +struct LazyLock { + data: (Copy, fn() -> T), +} + +impl LazyLock { + pub const fn new(f: fn() -> T) -> LazyLock { + LazyLock { data: (None, f) } + } +} + +struct A(Option); + +impl Default for A { + fn default() -> Self { + A(None) + } +} + +static EMPTY_SET: LazyLock> = LazyLock::new(A::default); + +fn main() {} diff --git a/tests/crashes/124189.rs b/tests/crashes/124189.rs new file mode 100644 index 00000000000..7c193ec1bce --- /dev/null +++ b/tests/crashes/124189.rs @@ -0,0 +1,14 @@ +//@ known-bug: #124189 +trait Trait { + type Type; +} + +impl Trait for T { + type Type = (); +} + +fn f(_: <&Copy as Trait>::Type) {} + +fn main() { + f(()); +} diff --git a/tests/crashes/124207.rs b/tests/crashes/124207.rs new file mode 100644 index 00000000000..a4e1c551890 --- /dev/null +++ b/tests/crashes/124207.rs @@ -0,0 +1,9 @@ +//@ known-bug: #124207 +#![feature(transmutability)] +#![feature(type_alias_impl_trait)] +trait OpaqueTrait {} +type OpaqueType = impl OpaqueTrait; +trait AnotherTrait {} +impl> AnotherTrait for T {} +impl AnotherTrait for OpaqueType {} +pub fn main() {}