From 4a93071aa1317d6da7e2db41cd0629c9ec4589e5 Mon Sep 17 00:00:00 2001 From: cyrgani Date: Sun, 1 Sep 2024 22:28:23 +0200 Subject: [PATCH] add a few more crashtests --- tests/crashes/123629.rs | 10 ++++++++ tests/crashes/127033.rs | 18 ++++++++++++++ tests/crashes/129372.rs | 52 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 80 insertions(+) create mode 100644 tests/crashes/123629.rs create mode 100644 tests/crashes/127033.rs create mode 100644 tests/crashes/129372.rs diff --git a/tests/crashes/123629.rs b/tests/crashes/123629.rs new file mode 100644 index 0000000000000..615323218067d --- /dev/null +++ b/tests/crashes/123629.rs @@ -0,0 +1,10 @@ +//@ known-bug: #123629 +#![feature(generic_assert)] + +fn foo() +where + for ():, +{ +} + +fn main() {} diff --git a/tests/crashes/127033.rs b/tests/crashes/127033.rs new file mode 100644 index 0000000000000..919c9dfd30e89 --- /dev/null +++ b/tests/crashes/127033.rs @@ -0,0 +1,18 @@ +//@ known-bug: #127033 +//@ compile-flags: --edition=2021 + +pub trait RaftLogStorage { + fn save_vote(vote: ()) -> impl std::future::Future + Send; +} + +struct X; +impl RaftLogStorage for X { + fn save_vote(vote: ()) -> impl std::future::Future { + loop {} + async { + vote + } + } +} + +fn main() {} diff --git a/tests/crashes/129372.rs b/tests/crashes/129372.rs new file mode 100644 index 0000000000000..43be01b35df29 --- /dev/null +++ b/tests/crashes/129372.rs @@ -0,0 +1,52 @@ +//@ known-bug: #129372 +//@ compile-flags: -Cdebuginfo=2 -Copt-level=0 + +pub struct Wrapper(T); +struct Struct; + +pub trait TraitA { + type AssocA<'t>; +} +pub trait TraitB { + type AssocB; +} + +pub fn helper(v: impl MethodTrait) { + let _local_that_causes_ice = v.method(); +} + +pub fn main() { + helper(Wrapper(Struct)); +} + +pub trait MethodTrait { + type Assoc<'a>; + + fn method(self) -> impl for<'a> FnMut(&'a ()) -> Self::Assoc<'a>; +} + +impl MethodTrait for T +where + ::AssocB: TraitA, +{ + type Assoc<'a> = ::AssocA<'a>; + + fn method(self) -> impl for<'a> FnMut(&'a ()) -> Self::Assoc<'a> { + move |_| loop {} + } +} + +impl TraitB for Wrapper +where + B: TraitB, +{ + type AssocB = T; +} + +impl TraitB for Struct { + type AssocB = Struct; +} + +impl TraitA for Struct { + type AssocA<'t> = Self; +}