about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorStuart Cook <Zalathar@users.noreply.github.com>2025-04-08 20:54:58 +1000
committerGitHub <noreply@github.com>2025-04-08 20:54:58 +1000
commit2b1afcbd1accd9e73c94029d3c420fa26b29676c (patch)
tree57f0355d037f6fea9e3581e6ff9acaa80ee97d1b /tests
parentc6c179662d5a6fc0520e05b5c0682dcfc7333f77 (diff)
parent268c56e14455d8889b818c4ea55470b94649aebc (diff)
downloadrust-2b1afcbd1accd9e73c94029d3c420fa26b29676c.tar.gz
rust-2b1afcbd1accd9e73c94029d3c420fa26b29676c.zip
Rollup merge of #138676 - compiler-errors:overflow-implied-bounds, r=lcnr
Implement overflow for infinite implied lifetime bounds

Not a great error message, but better than a hang

Fixes #138665
Fixes #102966
Fixes #115407

r? lcnr
Diffstat (limited to 'tests')
-rw-r--r--tests/ui/implied-bounds/overflow.rs11
-rw-r--r--tests/ui/implied-bounds/overflow.stderr8
2 files changed, 19 insertions, 0 deletions
diff --git a/tests/ui/implied-bounds/overflow.rs b/tests/ui/implied-bounds/overflow.rs
new file mode 100644
index 00000000000..7c36998dd4d
--- /dev/null
+++ b/tests/ui/implied-bounds/overflow.rs
@@ -0,0 +1,11 @@
+trait Tailed<'a>: 'a {
+    type Tail: Tailed<'a>;
+}
+
+struct List<'a, T: Tailed<'a>> {
+    //~^ ERROR overflow computing implied lifetime bounds for `List`
+    next: Box<List<'a, T::Tail>>,
+    node: &'a T,
+}
+
+fn main() {}
diff --git a/tests/ui/implied-bounds/overflow.stderr b/tests/ui/implied-bounds/overflow.stderr
new file mode 100644
index 00000000000..2e5a9ab141c
--- /dev/null
+++ b/tests/ui/implied-bounds/overflow.stderr
@@ -0,0 +1,8 @@
+error: overflow computing implied lifetime bounds for `List`
+  --> $DIR/overflow.rs:5:1
+   |
+LL | struct List<'a, T: Tailed<'a>> {
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 1 previous error
+