about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorMatthias Krüger <476013+matthiaskrgr@users.noreply.github.com>2025-07-18 14:49:16 +0200
committerGitHub <noreply@github.com>2025-07-18 14:49:16 +0200
commit499ccba8c1c1f40079ad2da19bfc01c0da563e97 (patch)
treebfd31c9976afdefa81709aece35e09db283d2ece /tests
parent6caa224a242d4c7b06c317969c51862815a4454b (diff)
parent848d4a5a381ddda172a5629d8050a58388ecb2b9 (diff)
downloadrust-499ccba8c1c1f40079ad2da19bfc01c0da563e97.tar.gz
rust-499ccba8c1c1f40079ad2da19bfc01c0da563e97.zip
Rollup merge of #143280 - xizheyin:143152-1, r=compiler-errors
Remove duplicate error about raw underscore lifetime

Fixes rust-lang/rust#143152

r? ```@fee1-dead```
Diffstat (limited to 'tests')
-rw-r--r--tests/ui/underscore-lifetime/raw-underscore-lifetime.rs9
-rw-r--r--tests/ui/underscore-lifetime/raw-underscore-lifetime.stderr8
2 files changed, 17 insertions, 0 deletions
diff --git a/tests/ui/underscore-lifetime/raw-underscore-lifetime.rs b/tests/ui/underscore-lifetime/raw-underscore-lifetime.rs
new file mode 100644
index 00000000000..874b3d2c48d
--- /dev/null
+++ b/tests/ui/underscore-lifetime/raw-underscore-lifetime.rs
@@ -0,0 +1,9 @@
+// This test is to ensure that the raw underscore lifetime won't emit two duplicate errors.
+// See issue #143152
+
+//@ edition: 2021
+
+fn f<'r#_>(){}
+//~^ ERROR `_` cannot be a raw lifetime
+
+fn main() {}
diff --git a/tests/ui/underscore-lifetime/raw-underscore-lifetime.stderr b/tests/ui/underscore-lifetime/raw-underscore-lifetime.stderr
new file mode 100644
index 00000000000..bdb357a47f4
--- /dev/null
+++ b/tests/ui/underscore-lifetime/raw-underscore-lifetime.stderr
@@ -0,0 +1,8 @@
+error: `_` cannot be a raw lifetime
+  --> $DIR/raw-underscore-lifetime.rs:6:6
+   |
+LL | fn f<'r#_>(){}
+   |      ^^^^
+
+error: aborting due to 1 previous error
+