about summary refs log tree commit diff
diff options
context:
space:
mode:
authorCamelid <camelidcamel@gmail.com>2021-01-12 19:06:20 -0800
committerCamelid <camelidcamel@gmail.com>2021-01-12 19:25:51 -0800
commitd7307a71f5e1893f7bd69ff160ce38dc97b5d195 (patch)
tree1f1420c5ef30d71a7778ce0ca140ef27f1e2e75d
parent1bce77576964e069833edb1b3b6ca5baa68ae65e (diff)
downloadrust-d7307a71f5e1893f7bd69ff160ce38dc97b5d195.tar.gz
rust-d7307a71f5e1893f7bd69ff160ce38dc97b5d195.zip
Always show suggestions in their own subwindows
-rw-r--r--compiler/rustc_typeck/src/check/pat.rs6
-rw-r--r--src/test/ui/destructuring-assignment/tuple_struct_destructure_fail.stderr20
-rw-r--r--src/test/ui/error-codes/E0023.stderr10
-rw-r--r--src/test/ui/issues/issue-67037-pat-tup-scrut-ty-diff-less-fields.stderr10
-rw-r--r--src/test/ui/issues/issue-72574-2.stderr10
-rw-r--r--src/test/ui/match/match-pattern-field-mismatch.stderr10
-rw-r--r--src/test/ui/pattern/issue-74539.stderr10
-rw-r--r--src/test/ui/pattern/pat-tuple-underfield.stderr40
8 files changed, 69 insertions, 47 deletions
diff --git a/compiler/rustc_typeck/src/check/pat.rs b/compiler/rustc_typeck/src/check/pat.rs
index a863fc95e0e..e176389f0e2 100644
--- a/compiler/rustc_typeck/src/check/pat.rs
+++ b/compiler/rustc_typeck/src/check/pat.rs
@@ -1061,7 +1061,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
                 wildcard_sugg = String::from(", ") + &wildcard_sugg;
             }
 
-            err.span_suggestion_short(
+            err.span_suggestion_verbose(
                 after_fields_span,
                 "use `_` to explicitly ignore each field",
                 wildcard_sugg,
@@ -1071,14 +1071,14 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
             // Only suggest `..` if more than one field is missing.
             if fields.len() - subpats.len() > 1 {
                 if subpats.is_empty() || all_wildcards {
-                    err.span_suggestion_short(
+                    err.span_suggestion_verbose(
                         all_fields_span,
                         "use `..` to ignore all fields",
                         String::from(".."),
                         Applicability::MaybeIncorrect,
                     );
                 } else {
-                    err.span_suggestion_short(
+                    err.span_suggestion_verbose(
                         after_fields_span,
                         "use `..` to ignore the rest of the fields",
                         String::from(", .."),
diff --git a/src/test/ui/destructuring-assignment/tuple_struct_destructure_fail.stderr b/src/test/ui/destructuring-assignment/tuple_struct_destructure_fail.stderr
index 42859406e17..8c20bb4fb83 100644
--- a/src/test/ui/destructuring-assignment/tuple_struct_destructure_fail.stderr
+++ b/src/test/ui/destructuring-assignment/tuple_struct_destructure_fail.stderr
@@ -30,10 +30,12 @@ LL | struct TupleStruct<S, T>(S, T);
    | ------------------------------- tuple struct defined here
 ...
 LL |     TupleStruct(_) = TupleStruct(1, 2);
-   |     ^^^^^^^^^^^^^-
-   |     |            |
-   |     |            help: use `_` to explicitly ignore each field
-   |     expected 2 fields, found 1
+   |     ^^^^^^^^^^^^^^ expected 2 fields, found 1
+   |
+help: use `_` to explicitly ignore each field
+   |
+LL |     TupleStruct(_, _) = TupleStruct(1, 2);
+   |                  ^^^
 
 error[E0023]: this pattern has 3 fields, but the corresponding tuple variant has 2 fields
   --> $DIR/tuple_struct_destructure_fail.rs:34:5
@@ -51,10 +53,12 @@ LL |     SingleVariant(S, T)
    |     ------------------- tuple variant defined here
 ...
 LL |     Enum::SingleVariant(_) = Enum::SingleVariant(1, 2);
-   |     ^^^^^^^^^^^^^^^^^^^^^-
-   |     |                    |
-   |     |                    help: use `_` to explicitly ignore each field
-   |     expected 2 fields, found 1
+   |     ^^^^^^^^^^^^^^^^^^^^^^ expected 2 fields, found 1
+   |
+help: use `_` to explicitly ignore each field
+   |
+LL |     Enum::SingleVariant(_, _) = Enum::SingleVariant(1, 2);
+   |                          ^^^
 
 error[E0070]: invalid left-hand side of assignment
   --> $DIR/tuple_struct_destructure_fail.rs:40:12
diff --git a/src/test/ui/error-codes/E0023.stderr b/src/test/ui/error-codes/E0023.stderr
index 0c6f496cf43..832eba69722 100644
--- a/src/test/ui/error-codes/E0023.stderr
+++ b/src/test/ui/error-codes/E0023.stderr
@@ -5,10 +5,12 @@ LL |     Apple(String, String),
    |     --------------------- tuple variant defined here
 ...
 LL |         Fruit::Apple(a) => {},
-   |         ^^^^^^^^^^^^^^-
-   |         |             |
-   |         |             help: use `_` to explicitly ignore each field
-   |         expected 2 fields, found 1
+   |         ^^^^^^^^^^^^^^^ expected 2 fields, found 1
+   |
+help: use `_` to explicitly ignore each field
+   |
+LL |         Fruit::Apple(a, _) => {},
+   |                       ^^^
 
 error[E0023]: this pattern has 3 fields, but the corresponding tuple variant has 2 fields
   --> $DIR/E0023.rs:12:9
diff --git a/src/test/ui/issues/issue-67037-pat-tup-scrut-ty-diff-less-fields.stderr b/src/test/ui/issues/issue-67037-pat-tup-scrut-ty-diff-less-fields.stderr
index 86be8e7db4e..46ffac48c1b 100644
--- a/src/test/ui/issues/issue-67037-pat-tup-scrut-ty-diff-less-fields.stderr
+++ b/src/test/ui/issues/issue-67037-pat-tup-scrut-ty-diff-less-fields.stderr
@@ -16,10 +16,12 @@ LL | struct P<T>(T); // 1 type parameter wanted
    | --------------- tuple struct defined here
 ...
 LL |     let P() = U {};
-   |         ^^-
-   |         | |
-   |         | help: use `_` to explicitly ignore each field
-   |         expected 1 field, found 0
+   |         ^^^ expected 1 field, found 0
+   |
+help: use `_` to explicitly ignore each field
+   |
+LL |     let P(_) = U {};
+   |           ^
 
 error: aborting due to 2 previous errors
 
diff --git a/src/test/ui/issues/issue-72574-2.stderr b/src/test/ui/issues/issue-72574-2.stderr
index 9479e365aee..a1e8ec1677d 100644
--- a/src/test/ui/issues/issue-72574-2.stderr
+++ b/src/test/ui/issues/issue-72574-2.stderr
@@ -25,10 +25,12 @@ LL | struct Binder(i32, i32, i32);
    | ----------------------------- tuple struct defined here
 ...
 LL |         Binder(_a, _x @ ..) => {}
-   |         ^^^^^^^^^^^^^^^^^^-
-   |         |                 |
-   |         |                 help: use `_` to explicitly ignore each field
-   |         expected 3 fields, found 2
+   |         ^^^^^^^^^^^^^^^^^^^ expected 3 fields, found 2
+   |
+help: use `_` to explicitly ignore each field
+   |
+LL |         Binder(_a, _x @ .., _) => {}
+   |                           ^^^
 
 error: aborting due to 3 previous errors
 
diff --git a/src/test/ui/match/match-pattern-field-mismatch.stderr b/src/test/ui/match/match-pattern-field-mismatch.stderr
index 0bb5e726ccb..04f8cab900e 100644
--- a/src/test/ui/match/match-pattern-field-mismatch.stderr
+++ b/src/test/ui/match/match-pattern-field-mismatch.stderr
@@ -5,10 +5,12 @@ LL |         Rgb(usize, usize, usize),
    |         ------------------------ tuple variant defined here
 ...
 LL |           Color::Rgb(_, _) => { }
-   |           ^^^^^^^^^^^^^^^-
-   |           |              |
-   |           |              help: use `_` to explicitly ignore each field
-   |           expected 3 fields, found 2
+   |           ^^^^^^^^^^^^^^^^ expected 3 fields, found 2
+   |
+help: use `_` to explicitly ignore each field
+   |
+LL |           Color::Rgb(_, _, _) => { }
+   |                          ^^^
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/pattern/issue-74539.stderr b/src/test/ui/pattern/issue-74539.stderr
index 49011d83e50..f7644c19ea0 100644
--- a/src/test/ui/pattern/issue-74539.stderr
+++ b/src/test/ui/pattern/issue-74539.stderr
@@ -25,10 +25,12 @@ LL |     A(u8, u8),
    |     --------- tuple variant defined here
 ...
 LL |         E::A(x @ ..) => {
-   |         ^^^^^^^^^^^-
-   |         |          |
-   |         |          help: use `_` to explicitly ignore each field
-   |         expected 2 fields, found 1
+   |         ^^^^^^^^^^^^ expected 2 fields, found 1
+   |
+help: use `_` to explicitly ignore each field
+   |
+LL |         E::A(x @ .., _) => {
+   |                    ^^^
 
 error: aborting due to 3 previous errors
 
diff --git a/src/test/ui/pattern/pat-tuple-underfield.stderr b/src/test/ui/pattern/pat-tuple-underfield.stderr
index df6b216272e..cdf7cfe3005 100644
--- a/src/test/ui/pattern/pat-tuple-underfield.stderr
+++ b/src/test/ui/pattern/pat-tuple-underfield.stderr
@@ -14,10 +14,12 @@ LL | struct S(i32, f32);
    | ------------------- tuple struct defined here
 ...
 LL |         S(x) => {}
-   |         ^^^-
-   |         |  |
-   |         |  help: use `_` to explicitly ignore each field
-   |         expected 2 fields, found 1
+   |         ^^^^ expected 2 fields, found 1
+   |
+help: use `_` to explicitly ignore each field
+   |
+LL |         S(x, _) => {}
+   |            ^^^
 
 error[E0023]: this pattern has 1 field, but the corresponding tuple struct has 2 fields
   --> $DIR/pat-tuple-underfield.rs:14:9
@@ -26,10 +28,12 @@ LL | struct S(i32, f32);
    | ------------------- tuple struct defined here
 ...
 LL |         S(_) => {}
-   |         ^^^-
-   |         |  |
-   |         |  help: use `_` to explicitly ignore each field
-   |         expected 2 fields, found 1
+   |         ^^^^ expected 2 fields, found 1
+   |
+help: use `_` to explicitly ignore each field
+   |
+LL |         S(_, _) => {}
+   |            ^^^
 
 error[E0023]: this pattern has 0 fields, but the corresponding tuple struct has 2 fields
   --> $DIR/pat-tuple-underfield.rs:19:9
@@ -56,10 +60,12 @@ LL |     S(i32, f32),
    |     ----------- tuple variant defined here
 ...
 LL |         E::S(x) => {}
-   |         ^^^^^^-
-   |         |     |
-   |         |     help: use `_` to explicitly ignore each field
-   |         expected 2 fields, found 1
+   |         ^^^^^^^ expected 2 fields, found 1
+   |
+help: use `_` to explicitly ignore each field
+   |
+LL |         E::S(x, _) => {}
+   |               ^^^
 
 error[E0023]: this pattern has 1 field, but the corresponding tuple variant has 2 fields
   --> $DIR/pat-tuple-underfield.rs:31:9
@@ -68,10 +74,12 @@ LL |     S(i32, f32),
    |     ----------- tuple variant defined here
 ...
 LL |         E::S(_) => {}
-   |         ^^^^^^-
-   |         |     |
-   |         |     help: use `_` to explicitly ignore each field
-   |         expected 2 fields, found 1
+   |         ^^^^^^^ expected 2 fields, found 1
+   |
+help: use `_` to explicitly ignore each field
+   |
+LL |         E::S(_, _) => {}
+   |               ^^^
 
 error[E0023]: this pattern has 0 fields, but the corresponding tuple variant has 2 fields
   --> $DIR/pat-tuple-underfield.rs:36:9