about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorYuki Okushi <huyuumi.dev@gmail.com>2020-02-02 08:30:21 +0900
committerGitHub <noreply@github.com>2020-02-02 08:30:21 +0900
commit87bb0c4389b09bfa86780eb014a4a2de95a3840b (patch)
treef29b6c6172ad7b834afac0155d93036c028cfc63 /src/test
parentc7332abee219ca36d9920bde4e51101fc549452b (diff)
parent726568bd1b4ac9af4dc84816eae1957c3d2bfc32 (diff)
downloadrust-87bb0c4389b09bfa86780eb014a4a2de95a3840b.tar.gz
rust-87bb0c4389b09bfa86780eb014a4a2de95a3840b.zip
Rollup merge of #68740 - JohnTitor:do-not-sugg-underscore, r=Centril
Do not suggest things named underscore

Fixes #68719

r? @estebank
Diffstat (limited to 'src/test')
-rw-r--r--src/test/ui/resolve/typo-suggestion-named-underscore.rs14
-rw-r--r--src/test/ui/resolve/typo-suggestion-named-underscore.stderr16
2 files changed, 30 insertions, 0 deletions
diff --git a/src/test/ui/resolve/typo-suggestion-named-underscore.rs b/src/test/ui/resolve/typo-suggestion-named-underscore.rs
new file mode 100644
index 00000000000..a2b05db0351
--- /dev/null
+++ b/src/test/ui/resolve/typo-suggestion-named-underscore.rs
@@ -0,0 +1,14 @@
+const _: () = ();
+
+fn main() {
+    a // Shouldn't suggest underscore
+    //~^ ERROR: cannot find value `a` in this scope
+}
+
+trait Unknown {}
+
+#[allow(unused_imports)]
+use Unknown as _;
+
+fn foo<T: A>(x: T) {} // Shouldn't suggest underscore
+//~^ ERROR: cannot find trait `A` in this scope
diff --git a/src/test/ui/resolve/typo-suggestion-named-underscore.stderr b/src/test/ui/resolve/typo-suggestion-named-underscore.stderr
new file mode 100644
index 00000000000..65d1b084a3a
--- /dev/null
+++ b/src/test/ui/resolve/typo-suggestion-named-underscore.stderr
@@ -0,0 +1,16 @@
+error[E0425]: cannot find value `a` in this scope
+  --> $DIR/typo-suggestion-named-underscore.rs:4:5
+   |
+LL |     a // Shouldn't suggest underscore
+   |     ^ not found in this scope
+
+error[E0405]: cannot find trait `A` in this scope
+  --> $DIR/typo-suggestion-named-underscore.rs:13:11
+   |
+LL | fn foo<T: A>(x: T) {} // Shouldn't suggest underscore
+   |           ^ not found in this scope
+
+error: aborting due to 2 previous errors
+
+Some errors have detailed explanations: E0405, E0425.
+For more information about an error, try `rustc --explain E0405`.