about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2024-09-07 23:30:13 +0200
committerGitHub <noreply@github.com>2024-09-07 23:30:13 +0200
commita88b1af7c05bbe0e70ed77fa6dcf8f65b0c7880f (patch)
tree9674864498537b066843ae9edb8cba3c29ec07f1 /tests
parent7b7f2f7f74522da174910f650e737aa80cc5705e (diff)
parent4a93071aa1317d6da7e2db41cd0629c9ec4589e5 (diff)
downloadrust-a88b1af7c05bbe0e70ed77fa6dcf8f65b0c7880f.tar.gz
rust-a88b1af7c05bbe0e70ed77fa6dcf8f65b0c7880f.zip
Rollup merge of #129869 - cyrgani:master, r=Mark-Simulacrum
add a few more crashtests

Added them for #123629, #127033 and #129372.
Diffstat (limited to 'tests')
-rw-r--r--tests/crashes/123629.rs10
-rw-r--r--tests/crashes/127033.rs18
-rw-r--r--tests/crashes/129372.rs52
3 files changed, 80 insertions, 0 deletions
diff --git a/tests/crashes/123629.rs b/tests/crashes/123629.rs
new file mode 100644
index 00000000000..61532321806
--- /dev/null
+++ b/tests/crashes/123629.rs
@@ -0,0 +1,10 @@
+//@ known-bug: #123629
+#![feature(generic_assert)]
+
+fn foo()
+where
+    for<const N: usize = { assert!(u) }> ():,
+{
+}
+
+fn main() {}
diff --git a/tests/crashes/127033.rs b/tests/crashes/127033.rs
new file mode 100644
index 00000000000..919c9dfd30e
--- /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 00000000000..43be01b35df
--- /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>(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<T: TraitB> MethodTrait for T
+where
+    <T as TraitB>::AssocB: TraitA,
+{
+    type Assoc<'a> = <T::AssocB as TraitA>::AssocA<'a>;
+
+    fn method(self) -> impl for<'a> FnMut(&'a ()) -> Self::Assoc<'a> {
+        move |_| loop {}
+    }
+}
+
+impl<T, B> TraitB for Wrapper<B>
+where
+    B: TraitB<AssocB = T>,
+{
+    type AssocB = T;
+}
+
+impl TraitB for Struct {
+    type AssocB = Struct;
+}
+
+impl TraitA for Struct {
+    type AssocA<'t> = Self;
+}