about summary refs log tree commit diff
path: root/src/test/ui/empty
diff options
context:
space:
mode:
authorEsteban Küber <esteban@kuber.com.ar>2020-08-09 20:29:39 -0700
committerEsteban Küber <esteban@kuber.com.ar>2020-08-10 12:04:10 -0700
commiteef284be59bbbe50e4d5369542a80e1ccd2ba7ab (patch)
treee071f85f8fcfeb6ca763eb37ca0d1b2d9e9901a5 /src/test/ui/empty
parent18f3be7704a4ec7976fcd1272c728974243d29bd (diff)
downloadrust-eef284be59bbbe50e4d5369542a80e1ccd2ba7ab.tar.gz
rust-eef284be59bbbe50e4d5369542a80e1ccd2ba7ab.zip
Tweak ordering of suggestions
Modify logic to make it easier to follow and recover labels that would
otherwise be lost.
Diffstat (limited to 'src/test/ui/empty')
-rw-r--r--src/test/ui/empty/empty-struct-braces-expr.stderr38
-rw-r--r--src/test/ui/empty/empty-struct-braces-pat-1.stderr8
-rw-r--r--src/test/ui/empty/empty-struct-braces-pat-2.stderr44
-rw-r--r--src/test/ui/empty/empty-struct-braces-pat-3.stderr22
4 files changed, 76 insertions, 36 deletions
diff --git a/src/test/ui/empty/empty-struct-braces-expr.stderr b/src/test/ui/empty/empty-struct-braces-expr.stderr
index c0ba9716fb0..af783996f76 100644
--- a/src/test/ui/empty/empty-struct-braces-expr.stderr
+++ b/src/test/ui/empty/empty-struct-braces-expr.stderr
@@ -12,14 +12,14 @@ LL |     let e1 = Empty1;
 LL | pub struct XEmpty2;
    | ------------------- similarly named unit struct `XEmpty2` defined here
    |
-help: a unit struct with a similar name exists
-   |
-LL |     let e1 = XEmpty2;
-   |              ^^^^^^^
 help: use struct literal syntax instead
    |
 LL |     let e1 = Empty1 {};
    |              ^^^^^^^^^
+help: a unit struct with a similar name exists
+   |
+LL |     let e1 = XEmpty2;
+   |              ^^^^^^^
 
 error[E0423]: expected function, tuple struct or tuple variant, found struct `Empty1`
   --> $DIR/empty-struct-braces-expr.rs:16:14
@@ -29,15 +29,20 @@ LL | struct Empty1 {}
 ...
 LL |     let e1 = Empty1();
    |              ^^^^^^^^
+   | 
+  ::: $DIR/auxiliary/empty-struct.rs:2:1
    |
-help: a unit struct with a similar name exists
+LL | pub struct XEmpty2;
+   | ------------------- similarly named unit struct `XEmpty2` defined here
    |
-LL |     let e1 = XEmpty2();
-   |              ^^^^^^^
 help: use struct literal syntax instead
    |
 LL |     let e1 = Empty1 {};
    |              ^^^^^^^^^
+help: a unit struct with a similar name exists
+   |
+LL |     let e1 = XEmpty2();
+   |              ^^^^^^^
 
 error[E0423]: expected value, found struct variant `E::Empty3`
   --> $DIR/empty-struct-braces-expr.rs:18:14
@@ -68,29 +73,34 @@ LL |     let xe1 = XEmpty1;
 LL | pub struct XEmpty2;
    | ------------------- similarly named unit struct `XEmpty2` defined here
    |
-help: a unit struct with a similar name exists
-   |
-LL |     let xe1 = XEmpty2;
-   |               ^^^^^^^
 help: use struct literal syntax instead
    |
 LL |     let xe1 = XEmpty1 {};
    |               ^^^^^^^^^^
+help: a unit struct with a similar name exists
+   |
+LL |     let xe1 = XEmpty2;
+   |               ^^^^^^^
 
 error[E0423]: expected function, tuple struct or tuple variant, found struct `XEmpty1`
   --> $DIR/empty-struct-braces-expr.rs:23:15
    |
 LL |     let xe1 = XEmpty1();
    |               ^^^^^^^^^
+   | 
+  ::: $DIR/auxiliary/empty-struct.rs:2:1
    |
-help: a unit struct with a similar name exists
+LL | pub struct XEmpty2;
+   | ------------------- similarly named unit struct `XEmpty2` defined here
    |
-LL |     let xe1 = XEmpty2();
-   |               ^^^^^^^
 help: use struct literal syntax instead
    |
 LL |     let xe1 = XEmpty1 {};
    |               ^^^^^^^^^^
+help: a unit struct with a similar name exists
+   |
+LL |     let xe1 = XEmpty2();
+   |               ^^^^^^^
 
 error[E0599]: no variant or associated item named `Empty3` found for enum `empty_struct::XE` in the current scope
   --> $DIR/empty-struct-braces-expr.rs:25:19
diff --git a/src/test/ui/empty/empty-struct-braces-pat-1.stderr b/src/test/ui/empty/empty-struct-braces-pat-1.stderr
index b027c82f7dd..70847ca45d0 100644
--- a/src/test/ui/empty/empty-struct-braces-pat-1.stderr
+++ b/src/test/ui/empty/empty-struct-braces-pat-1.stderr
@@ -18,14 +18,14 @@ LL |         XE::XEmpty3 => ()
 LL |     XEmpty4,
    |     ------- similarly named unit variant `XEmpty4` defined here
    |
-help: a unit variant with a similar name exists
-   |
-LL |         XE::XEmpty4 => ()
-   |             ^^^^^^^
 help: use struct pattern syntax instead
    |
 LL |         XE::XEmpty3 { /* fields */ } => ()
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+help: a unit variant with a similar name exists
+   |
+LL |         XE::XEmpty4 => ()
+   |             ^^^^^^^
 
 error: aborting due to 2 previous errors
 
diff --git a/src/test/ui/empty/empty-struct-braces-pat-2.stderr b/src/test/ui/empty/empty-struct-braces-pat-2.stderr
index a53b88db7d1..19792bc9fc5 100644
--- a/src/test/ui/empty/empty-struct-braces-pat-2.stderr
+++ b/src/test/ui/empty/empty-struct-braces-pat-2.stderr
@@ -6,30 +6,40 @@ LL | struct Empty1 {}
 ...
 LL |         Empty1() => ()
    |         ^^^^^^^^
+   | 
+  ::: $DIR/auxiliary/empty-struct.rs:3:1
    |
-help: a tuple struct with a similar name exists
+LL | pub struct XEmpty6();
+   | --------------------- similarly named tuple struct `XEmpty6` defined here
    |
-LL |         XEmpty6() => ()
-   |         ^^^^^^^
 help: use struct pattern syntax instead
    |
 LL |         Empty1 {} => ()
    |         ^^^^^^^^^
+help: a tuple struct with a similar name exists
+   |
+LL |         XEmpty6() => ()
+   |         ^^^^^^^
 
 error[E0532]: expected tuple struct or tuple variant, found struct `XEmpty1`
   --> $DIR/empty-struct-braces-pat-2.rs:18:9
    |
 LL |         XEmpty1() => ()
    |         ^^^^^^^^^
+   | 
+  ::: $DIR/auxiliary/empty-struct.rs:3:1
    |
-help: a tuple struct with a similar name exists
+LL | pub struct XEmpty6();
+   | --------------------- similarly named tuple struct `XEmpty6` defined here
    |
-LL |         XEmpty6() => ()
-   |         ^^^^^^^
 help: use struct pattern syntax instead
    |
 LL |         XEmpty1 {} => ()
    |         ^^^^^^^^^^
+help: a tuple struct with a similar name exists
+   |
+LL |         XEmpty6() => ()
+   |         ^^^^^^^
 
 error[E0532]: expected tuple struct or tuple variant, found struct `Empty1`
   --> $DIR/empty-struct-braces-pat-2.rs:21:9
@@ -39,30 +49,40 @@ LL | struct Empty1 {}
 ...
 LL |         Empty1(..) => ()
    |         ^^^^^^^^^^
+   | 
+  ::: $DIR/auxiliary/empty-struct.rs:3:1
    |
-help: a tuple struct with a similar name exists
+LL | pub struct XEmpty6();
+   | --------------------- similarly named tuple struct `XEmpty6` defined here
    |
-LL |         XEmpty6(..) => ()
-   |         ^^^^^^^
 help: use struct pattern syntax instead
    |
 LL |         Empty1 {} => ()
    |         ^^^^^^^^^
+help: a tuple struct with a similar name exists
+   |
+LL |         XEmpty6(..) => ()
+   |         ^^^^^^^
 
 error[E0532]: expected tuple struct or tuple variant, found struct `XEmpty1`
   --> $DIR/empty-struct-braces-pat-2.rs:24:9
    |
 LL |         XEmpty1(..) => ()
    |         ^^^^^^^^^^^
+   | 
+  ::: $DIR/auxiliary/empty-struct.rs:3:1
    |
-help: a tuple struct with a similar name exists
+LL | pub struct XEmpty6();
+   | --------------------- similarly named tuple struct `XEmpty6` defined here
    |
-LL |         XEmpty6(..) => ()
-   |         ^^^^^^^
 help: use struct pattern syntax instead
    |
 LL |         XEmpty1 {} => ()
    |         ^^^^^^^^^^
+help: a tuple struct with a similar name exists
+   |
+LL |         XEmpty6(..) => ()
+   |         ^^^^^^^
 
 error: aborting due to 4 previous errors
 
diff --git a/src/test/ui/empty/empty-struct-braces-pat-3.stderr b/src/test/ui/empty/empty-struct-braces-pat-3.stderr
index 93ace3eccef..066c42d8181 100644
--- a/src/test/ui/empty/empty-struct-braces-pat-3.stderr
+++ b/src/test/ui/empty/empty-struct-braces-pat-3.stderr
@@ -12,15 +12,20 @@ error[E0532]: expected tuple struct or tuple variant, found struct variant `XE::
    |
 LL |         XE::XEmpty3() => ()
    |         ^^^^^^^^^^^^^
+   | 
+  ::: $DIR/auxiliary/empty-struct.rs:8:5
    |
-help: a tuple variant with a similar name exists
+LL |     XEmpty5(),
+   |     --------- similarly named tuple variant `XEmpty5` defined here
    |
-LL |         XE::XEmpty5() => ()
-   |             ^^^^^^^
 help: use struct pattern syntax instead
    |
 LL |         XE::XEmpty3 { /* fields */ } => ()
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+help: a tuple variant with a similar name exists
+   |
+LL |         XE::XEmpty5() => ()
+   |             ^^^^^^^
 
 error[E0532]: expected tuple struct or tuple variant, found struct variant `E::Empty3`
   --> $DIR/empty-struct-braces-pat-3.rs:25:9
@@ -36,15 +41,20 @@ error[E0532]: expected tuple struct or tuple variant, found struct variant `XE::
    |
 LL |         XE::XEmpty3(..) => ()
    |         ^^^^^^^^^^^^^^^
+   | 
+  ::: $DIR/auxiliary/empty-struct.rs:8:5
    |
-help: a tuple variant with a similar name exists
+LL |     XEmpty5(),
+   |     --------- similarly named tuple variant `XEmpty5` defined here
    |
-LL |         XE::XEmpty5(..) => ()
-   |             ^^^^^^^
 help: use struct pattern syntax instead
    |
 LL |         XE::XEmpty3 { /* fields */ } => ()
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+help: a tuple variant with a similar name exists
+   |
+LL |         XE::XEmpty5(..) => ()
+   |             ^^^^^^^
 
 error: aborting due to 4 previous errors