about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2025-03-06 17:32:32 +0000
committerMichael Goulet <michael@errs.io>2025-03-06 18:18:32 +0000
commitac40ea7129447abbd004859957bf00a374e8a739 (patch)
tree62be5aee1c7a62712fc4bb6b0bc3b1c7898e162d /tests
parent30f168ef811aec63124eac677e14699baa9395bd (diff)
downloadrust-ac40ea7129447abbd004859957bf00a374e8a739.tar.gz
rust-ac40ea7129447abbd004859957bf00a374e8a739.zip
Suggest typo fix for static lifetime
Diffstat (limited to 'tests')
-rw-r--r--tests/ui/lifetimes/static-typos.rs7
-rw-r--r--tests/ui/lifetimes/static-typos.stderr26
2 files changed, 33 insertions, 0 deletions
diff --git a/tests/ui/lifetimes/static-typos.rs b/tests/ui/lifetimes/static-typos.rs
new file mode 100644
index 00000000000..941d1b376bc
--- /dev/null
+++ b/tests/ui/lifetimes/static-typos.rs
@@ -0,0 +1,7 @@
+fn stati<T: 'stati>() {}
+//~^ ERROR use of undeclared lifetime name `'stati`
+
+fn statoc<T: 'statoc>() {}
+//~^ ERROR use of undeclared lifetime name `'statoc`
+
+fn main() {}
diff --git a/tests/ui/lifetimes/static-typos.stderr b/tests/ui/lifetimes/static-typos.stderr
new file mode 100644
index 00000000000..a817fa89c7e
--- /dev/null
+++ b/tests/ui/lifetimes/static-typos.stderr
@@ -0,0 +1,26 @@
+error[E0261]: use of undeclared lifetime name `'stati`
+  --> $DIR/static-typos.rs:1:13
+   |
+LL | fn stati<T: 'stati>() {}
+   |             ^^^^^^ undeclared lifetime
+   |
+help: you may have misspelled the `'static` lifetime
+   |
+LL | fn stati<T: 'static>() {}
+   |                   +
+
+error[E0261]: use of undeclared lifetime name `'statoc`
+  --> $DIR/static-typos.rs:4:14
+   |
+LL | fn statoc<T: 'statoc>() {}
+   |              ^^^^^^^ undeclared lifetime
+   |
+help: you may have misspelled the `'static` lifetime
+   |
+LL - fn statoc<T: 'statoc>() {}
+LL + fn statoc<T: 'static>() {}
+   |
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0261`.