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 04:40:55 +0900
committerYuki Okushi <huyuumi.dev@gmail.com>2020-02-02 04:55:37 +0900
commit726568bd1b4ac9af4dc84816eae1957c3d2bfc32 (patch)
tree2e2b32def157c680a21f396c9d3e1d2d2c1ecb8d /src/test
parent64184a3288eca13ddfb7bc2e7b5231cbb8d5b88f (diff)
downloadrust-726568bd1b4ac9af4dc84816eae1957c3d2bfc32.tar.gz
rust-726568bd1b4ac9af4dc84816eae1957c3d2bfc32.zip
Do not suggest things named underscore
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`.