about summary refs log tree commit diff
path: root/src/test/ui/error-codes
diff options
context:
space:
mode:
authorEsteban Küber <esteban@kuber.com.ar>2019-10-14 17:20:50 -0700
committerEsteban Küber <esteban@kuber.com.ar>2019-10-27 11:50:43 -0700
commitb26ddb8af37362e33c45c78c9c91a3c5cdabfe7e (patch)
tree13882f89b25e139a8e0997d8c7146bc15b0483c0 /src/test/ui/error-codes
parent0f677c65e867d93a47ccbaeaf6e6725cde8c5ff6 (diff)
Point at local similarly named element and tweak references to variants
Point at the span for the definition of ADTs internal to the current
crate.

Look at the leading char of the ident to determine whether we're
expecting a likely fn or any of a fn, a tuple struct or a tuple variant.

Turn fn `add_typo_suggestion` into a `Resolver` method.
Diffstat (limited to 'src/test/ui/error-codes')
-rw-r--r--src/test/ui/error-codes/E0164.stderr2
-rw-r--r--src/test/ui/error-codes/E0423.stderr22
-rw-r--r--src/test/ui/error-codes/E0424.stderr2
-rw-r--r--src/test/ui/error-codes/E0532.rs2
-rw-r--r--src/test/ui/error-codes/E0532.stderr4
5 files changed, 19 insertions, 13 deletions
diff --git a/src/test/ui/error-codes/E0164.stderr b/src/test/ui/error-codes/E0164.stderr
index 0a153d85b42..4bbddb1978c 100644
--- a/src/test/ui/error-codes/E0164.stderr
+++ b/src/test/ui/error-codes/E0164.stderr
@@ -1,4 +1,4 @@
-error[E0164]: expected tuple struct/variant, found associated constant `<Foo>::B`
+error[E0164]: expected tuple struct or tuple variant, found associated constant `<Foo>::B`
   --> $DIR/E0164.rs:9:9
    |
 LL |         Foo::B(i) => i,
diff --git a/src/test/ui/error-codes/E0423.stderr b/src/test/ui/error-codes/E0423.stderr
index 4e016dbd1c0..09792845d16 100644
--- a/src/test/ui/error-codes/E0423.stderr
+++ b/src/test/ui/error-codes/E0423.stderr
@@ -26,17 +26,23 @@ help: surround the struct literal with parentheses
 LL |     for _ in (std::ops::Range { start: 0, end: 10 }) {}
    |              ^                                     ^
 
-error[E0423]: expected function, found struct `Foo`
+error[E0423]: expected function, tuple struct or tuple variant, found struct `Foo`
   --> $DIR/E0423.rs:4:13
    |
-LL |     struct Foo { a: bool };
-   |     ---------------------- `Foo` defined here
+LL |       struct Foo { a: bool };
+   |       ---------------------- `Foo` defined here
 LL | 
-LL |     let f = Foo();
-   |             ^^^
-   |             |
-   |             did you mean `Foo { /* fields */ }`?
-   |             help: a function with a similar name exists (notice the capitalization): `foo`
+LL |       let f = Foo();
+   |               ^^^
+   |               |
+   |               did you mean `Foo { /* fields */ }`?
+   |               help: a function with a similar name exists (notice the capitalization): `foo`
+...
+LL | / fn foo() {
+LL | |     for _ in std::ops::Range { start: 0, end: 10 } {}
+LL | |
+LL | | }
+   | |_- similarly named function `foo` defined here
 
 error[E0423]: expected value, found struct `T`
   --> $DIR/E0423.rs:14:8
diff --git a/src/test/ui/error-codes/E0424.stderr b/src/test/ui/error-codes/E0424.stderr
index 567d1b3cc75..690a101496d 100644
--- a/src/test/ui/error-codes/E0424.stderr
+++ b/src/test/ui/error-codes/E0424.stderr
@@ -7,7 +7,7 @@ LL | |         self.bar();
 LL | |     }
    | |_____- this function doesn't have a `self` parameter
 
-error[E0424]: expected unit struct/variant or constant, found module `self`
+error[E0424]: expected unit struct, unit variant or constant, found module `self`
   --> $DIR/E0424.rs:12:9
    |
 LL | / fn main () {
diff --git a/src/test/ui/error-codes/E0532.rs b/src/test/ui/error-codes/E0532.rs
index 931ca4628fe..486da0e029e 100644
--- a/src/test/ui/error-codes/E0532.rs
+++ b/src/test/ui/error-codes/E0532.rs
@@ -3,7 +3,7 @@ fn main() {
 
     match SomeStruct(value) {
         StructConst1(_) => { },
-        //~^ ERROR expected tuple struct/variant, found constant `StructConst1`
+        //~^ ERROR expected tuple struct or tuple variant, found constant `StructConst1`
         _ => { },
     }
 
diff --git a/src/test/ui/error-codes/E0532.stderr b/src/test/ui/error-codes/E0532.stderr
index 887ede0a412..eeccadccc63 100644
--- a/src/test/ui/error-codes/E0532.stderr
+++ b/src/test/ui/error-codes/E0532.stderr
@@ -1,8 +1,8 @@
-error[E0532]: expected tuple struct/variant, found constant `StructConst1`
+error[E0532]: expected tuple struct or tuple variant, found constant `StructConst1`
   --> $DIR/E0532.rs:5:9
    |
 LL |         StructConst1(_) => { },
-   |         ^^^^^^^^^^^^ not a tuple struct/variant
+   |         ^^^^^^^^^^^^ not a tuple struct or tuple variant
 
 error: aborting due to previous error