Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggest _ and .. if a pattern has too few fields #80017

Merged
merged 9 commits into from
Jan 14, 2021

Conversation

camelid
Copy link
Member

@camelid camelid commented Dec 13, 2020

Fixes #80010.

@camelid camelid added A-patterns Relating to patterns and pattern matching A-suggestion-diagnostics Area: Suggestions generated by the compiler applied by `cargo fix` labels Dec 13, 2020
@rust-highfive
Copy link
Collaborator

r? @estebank

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Dec 13, 2020
@camelid camelid changed the title Add .. pattern suggestion Suggest _ and .. patterns when a pattern has too few fields Dec 15, 2020
@camelid camelid marked this pull request as ready for review December 15, 2020 03:16
@camelid camelid changed the title Suggest _ and .. patterns when a pattern has too few fields Suggest _ and .. if a pattern has too few fields Dec 15, 2020
@camelid camelid force-pushed the sugg-rest-pattern branch 2 times, most recently from 64b3db4 to eb66b98 Compare December 15, 2020 04:31
let after_fields_span = if pat_span == DUMMY_SP {
pat_span
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the DUMMY_SP for and this branch for? I never seen this before.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is to prevent a compiler crash if pat_span == DUMMY_SP since we then subtract 1 from pat_span and DUMMY_SP is basically equal to 0.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If pat_span is DUMMY_SP then you shouldn't be giving suggestions at all.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens if the error rendering system receives a diagnostic that has DUMMY_SP? Will it just ignore it?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error renderer will ignore DUMMY_SPs and not show labels associated to it, while still showing messages, but they do have the potential to break suggestions and certainly break everything when synthesizing a new span from them.

@rust-log-analyzer

This comment has been minimized.

@estebank estebank added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Dec 19, 2020
@estebank
Copy link
Contributor

Sorry for the delay in reviewing. I left a few nitpicks that require changing the logic slightly. Would you mind incorporating those changes and pinging me once that's done?

@camelid
Copy link
Member Author

camelid commented Dec 19, 2020

Sorry for the delay in reviewing.

That's okay; it seems most of the diagnostics PRs get assigned to you :)

I left a few nitpicks that require changing the logic slightly. Would you mind incorporating those changes and pinging me once that's done?

👍

@camelid camelid added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Dec 19, 2020
@camelid
Copy link
Member Author

camelid commented Dec 20, 2020

Sorry for the delay in reviewing. I left a few nitpicks that require changing the logic slightly. Would you mind incorporating those changes and pinging me once that's done?

@estebank here's your ping!

I didn't make one of the changes because of #80017 (comment).

@camelid camelid removed the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Dec 20, 2020
src/test/ui/pattern/pat-tuple-underfield.stderr Outdated Show resolved Hide resolved
Comment on lines +115 to +118
help: use `..` to ignore the rest of the fields
|
LL | Point4( a , _ , ..) => {}
| ^^^^
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this one be the following?


help: use `..` to ignore the rest of the fields
   |
LL |         Point4(   a   , ..) => {}
   |                       ^^^^

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally yes, but I think that would make the code much more complicated. This is the current behavior:

  • If it's of the form (_, _) then suggest (..)
  • Otherwise, suggest (/* ... */, ..)

Of course, there's different behavior for the case when only one field is missing :)

camelid and others added 8 commits January 12, 2021 19:25
For example, this code:

    struct S(i32, f32);

    let S(x) = S(0, 1.0);

will make the compiler suggest either:

    let S(x, _) = S(0, 1.0);

or:

    let S(x, ..) = S(0, 1.0);
Co-authored-by: Esteban Kuber <estebank@users.noreply.github.com>
It's 'parentheses', not 'parenthesis', when you have more than one.
@rust-log-analyzer
Copy link
Collaborator

The job x86_64-gnu-llvm-9 failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
.................................................................................................... 2300/11252
.................................................................................................... 2400/11252
.............................................................i..i................................... 2500/11252
.................................................................................................... 2600/11252
.........................F......................................iiiii............................... 2700/11252
.................................................................................................... 2900/11252
.................................................................................................... 3000/11252
.................................................................................................... 3100/11252
.................................................................................................... 3200/11252
---
.................................................................................................... 9000/11252
.................................................................................................... 9100/11252
.................................................................................................... 9200/11252
...............................................i......i............................................. 9300/11252
......................................................................................iiiiii..iiiiii 9400/11252
.................................................................................................... 9600/11252
.................................................................................................... 9700/11252
.................................................................................................... 9800/11252
.................................................................................................... 9900/11252
---
---- [ui] ui/destructuring-assignment/tuple_struct_destructure_fail.rs stdout ----
diff of stderr:

36    |
37 LL |     TupleStruct(_, _) = TupleStruct(1, 2);
38    |                  ^^^
+ help: use `..` to ignore all fields
+    |
+ LL |     TupleStruct(..) = TupleStruct(1, 2);
39 
39 
40 error[E0023]: this pattern has 3 fields, but the corresponding tuple variant has 2 fields
41   --> $DIR/tuple_struct_destructure_fail.rs:34:5
59    |
59    |
60 LL |     Enum::SingleVariant(_, _) = Enum::SingleVariant(1, 2);
61    |                          ^^^
+ help: use `..` to ignore all fields
+    |
+ LL |     Enum::SingleVariant(..) = Enum::SingleVariant(1, 2);
62 
62 
63 error[E0070]: invalid left-hand side of assignment
64   --> $DIR/tuple_struct_destructure_fail.rs:40:12

The actual stderr differed from the expected stderr.
The actual stderr differed from the expected stderr.
Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/destructuring-assignment/tuple_struct_destructure_fail/tuple_struct_destructure_fail.stderr
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args destructuring-assignment/tuple_struct_destructure_fail.rs`
error: 1 errors occurred comparing output.
status: exit code: 1
status: exit code: 1
command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/destructuring-assignment/tuple_struct_destructure_fail.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zemit-future-incompat-report" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/destructuring-assignment/tuple_struct_destructure_fail" "-A" "unused" "-Crpath" "-O" "-Cdebuginfo=0" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/destructuring-assignment/tuple_struct_destructure_fail/auxiliary"
------------------------------------------

------------------------------------------
stderr:
stderr:
------------------------------------------
error: `..` can only be used once per tuple struct or variant pattern
  --> /checkout/src/test/ui/destructuring-assignment/tuple_struct_destructure_fail.rs:25:27
   |
LL |     TupleStruct(a, .., b, ..) = TupleStruct(0, 1);
   |                    --     ^^ can only be used once per tuple struct or variant pattern
   |                    previously used here


error: `..` can only be used once per tuple struct or variant pattern
  --> /checkout/src/test/ui/destructuring-assignment/tuple_struct_destructure_fail.rs:27:35
   |
LL |     Enum::SingleVariant(a, .., b, ..) = Enum::SingleVariant(0, 1);
   |                            --     ^^ can only be used once per tuple struct or variant pattern
   |                            previously used here


error[E0023]: this pattern has 3 fields, but the corresponding tuple struct has 2 fields
  --> /checkout/src/test/ui/destructuring-assignment/tuple_struct_destructure_fail.rs:30:5
   |
LL | struct TupleStruct<S, T>(S, T);
   | ------------------------------- tuple struct defined here
...
LL |     TupleStruct(a, a, b) = TupleStruct(1, 2);
   |     ^^^^^^^^^^^^^^^^^^^^ expected 2 fields, found 3

error[E0023]: this pattern has 1 field, but the corresponding tuple struct has 2 fields
  --> /checkout/src/test/ui/destructuring-assignment/tuple_struct_destructure_fail.rs:32:5
   |
LL | struct TupleStruct<S, T>(S, T);
   | ------------------------------- tuple struct defined here
...
LL |     TupleStruct(_) = TupleStruct(1, 2);
   |     ^^^^^^^^^^^^^^ expected 2 fields, found 1
   |
help: use `_` to explicitly ignore each field
   |
LL |     TupleStruct(_, _) = TupleStruct(1, 2);
help: use `..` to ignore all fields
   |
   |
LL |     TupleStruct(..) = TupleStruct(1, 2);


error[E0023]: this pattern has 3 fields, but the corresponding tuple variant has 2 fields
  --> /checkout/src/test/ui/destructuring-assignment/tuple_struct_destructure_fail.rs:34:5
   |
LL |     SingleVariant(S, T)
   |     ------------------- tuple variant defined here
...
LL |     Enum::SingleVariant(a, a, b) = Enum::SingleVariant(1, 2);
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected 2 fields, found 3

error[E0023]: this pattern has 1 field, but the corresponding tuple variant has 2 fields
  --> /checkout/src/test/ui/destructuring-assignment/tuple_struct_destructure_fail.rs:36:5
Some tests failed in compiletest suite=ui mode=ui host=x86_64-unknown-linux-gnu target=x86_64-unknown-linux-gnu
Some tests failed in compiletest suite=ui mode=ui host=x86_64-unknown-linux-gnu target=x86_64-unknown-linux-gnu
LL |     SingleVariant(S, T)
   |     ------------------- tuple variant defined here
...
LL |     Enum::SingleVariant(_) = Enum::SingleVariant(1, 2);
   |     ^^^^^^^^^^^^^^^^^^^^^^ expected 2 fields, found 1
   |
help: use `_` to explicitly ignore each field
   |
LL |     Enum::SingleVariant(_, _) = Enum::SingleVariant(1, 2);
help: use `..` to ignore all fields
   |
   |
LL |     Enum::SingleVariant(..) = Enum::SingleVariant(1, 2);


error[E0070]: invalid left-hand side of assignment
  --> /checkout/src/test/ui/destructuring-assignment/tuple_struct_destructure_fail.rs:40:12
   |
LL |     test() = TupleStruct(0, 0);
   |     ------ ^
   |     cannot assign to this expression


error[E0070]: invalid left-hand side of assignment
  --> /checkout/src/test/ui/destructuring-assignment/tuple_struct_destructure_fail.rs:42:14
   |
LL |     (test)() = TupleStruct(0, 0);
   |     -------- ^
   |     cannot assign to this expression


error[E0070]: invalid left-hand side of assignment
  --> /checkout/src/test/ui/destructuring-assignment/tuple_struct_destructure_fail.rs:44:38
   |
LL |     <Alias::<isize> as Test>::test() = TupleStruct(0, 0);
   |     -------------------------------- ^
   |     cannot assign to this expression

error: aborting due to 9 previous errors

---
---- [ui] ui/issues/issue-67037-pat-tup-scrut-ty-diff-less-fields.rs stdout ----
diff of stderr:

22    |
23 LL |     let P(_) = U {};
24    |           ^
+ help: use `..` to ignore all fields
+    |
+ LL |     let P(..) = U {};
25 
26 error: aborting due to 2 previous errors
27 



The actual stderr differed from the expected stderr.
Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/issues/issue-67037-pat-tup-scrut-ty-diff-less-fields/issue-67037-pat-tup-scrut-ty-diff-less-fields.stderr
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args issues/issue-67037-pat-tup-scrut-ty-diff-less-fields.rs`
error: 1 errors occurred comparing output.
status: exit code: 1
status: exit code: 1
command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/issues/issue-67037-pat-tup-scrut-ty-diff-less-fields.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zemit-future-incompat-report" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/issues/issue-67037-pat-tup-scrut-ty-diff-less-fields" "-A" "unused" "-Crpath" "-O" "-Cdebuginfo=0" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/issues/issue-67037-pat-tup-scrut-ty-diff-less-fields/auxiliary"
------------------------------------------

------------------------------------------
stderr:
stderr:
------------------------------------------
error[E0308]: mismatched types
  --> /checkout/src/test/ui/issues/issue-67037-pat-tup-scrut-ty-diff-less-fields.rs:19:9
   |
LL |     let P() = U {}; //~ ERROR mismatched types
   |         ^^^   ---- this expression has type `U`
   |         |
   |         expected struct `U`, found struct `P`
   = note: expected struct `U`
   = note: expected struct `U`
              found struct `P<_>`

error[E0023]: this pattern has 0 fields, but the corresponding tuple struct has 1 field
   |
   |
LL | struct P<T>(T); // 1 type parameter wanted
   | --------------- tuple struct defined here
...
LL |     let P() = U {}; //~ ERROR mismatched types
   |         ^^^ expected 1 field, found 0
   |
help: use `_` to explicitly ignore each field
   |
LL |     let P(_) = U {}; //~ ERROR mismatched types
help: use `..` to ignore all fields
   |
   |
LL |     let P(..) = U {}; //~ ERROR mismatched types

error: aborting due to 2 previous errors

Some errors have detailed explanations: E0023, E0308.
---
test result: FAILED. 11164 passed; 2 failed; 86 ignored; 0 measured; 0 filtered out; finished in 137.59s



command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/compiletest" "--compile-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib" "--run-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib" "--rustc-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "--src-base" "/checkout/src/test/ui" "--build-base" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui" "--stage-id" "stage2-x86_64-unknown-linux-gnu" "--suite" "ui" "--mode" "ui" "--target" "x86_64-unknown-linux-gnu" "--host" "x86_64-unknown-linux-gnu" "--llvm-filecheck" "/usr/lib/llvm-9/bin/FileCheck" "--nodejs" "/usr/bin/node" "--host-rustcflags" "-Crpath -O -Cdebuginfo=0 -Zunstable-options  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--target-rustcflags" "-Crpath -O -Cdebuginfo=0 -Zunstable-options  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--docck-python" "/usr/bin/python2.7" "--lldb-python" "/usr/bin/python2.7" "--gdb" "/usr/bin/gdb" "--quiet" "--llvm-version" "9.0.0" "--llvm-components" "aarch64 aarch64asmparser aarch64codegen aarch64desc aarch64disassembler aarch64info aarch64utils aggressiveinstcombine all all-targets amdgpu amdgpuasmparser amdgpucodegen amdgpudesc amdgpudisassembler amdgpuinfo amdgpuutils analysis arm armasmparser armcodegen armdesc armdisassembler arminfo armutils asmparser asmprinter avr avrasmparser avrcodegen avrdesc avrdisassembler avrinfo binaryformat bitreader bitstreamreader bitwriter bpf bpfasmparser bpfcodegen bpfdesc bpfdisassembler bpfinfo codegen core coroutines coverage debuginfocodeview debuginfodwarf debuginfogsym debuginfomsf debuginfopdb demangle dlltooldriver engine executionengine fuzzmutate globalisel hexagon hexagonasmparser hexagoncodegen hexagondesc hexagondisassembler hexagoninfo instcombine instrumentation interpreter ipo irreader jitlink lanai lanaiasmparser lanaicodegen lanaidesc lanaidisassembler lanaiinfo libdriver lineeditor linker lto mc mca mcdisassembler mcjit mcparser mips mipsasmparser mipscodegen mipsdesc mipsdisassembler mipsinfo mirparser msp430 msp430asmparser msp430codegen msp430desc msp430disassembler msp430info native nativecodegen nvptx nvptxcodegen nvptxdesc nvptxinfo objcarcopts object objectyaml option orcjit passes perfjitevents powerpc powerpcasmparser powerpccodegen powerpcdesc powerpcdisassembler powerpcinfo profiledata remarks riscv riscvasmparser riscvcodegen riscvdesc riscvdisassembler riscvinfo riscvutils runtimedyld scalaropts selectiondag sparc sparcasmparser sparccodegen sparcdesc sparcdisassembler sparcinfo support symbolize systemz systemzasmparser systemzcodegen systemzdesc systemzdisassembler systemzinfo tablegen target textapi transformutils vectorize webassembly webassemblyasmparser webassemblycodegen webassemblydesc webassemblydisassembler webassemblyinfo windowsmanifest x86 x86asmparser x86codegen x86desc x86disassembler x86info x86utils xcore xcorecodegen xcoredesc xcoredisassembler xcoreinfo xray" "--system-llvm" "--cc" "" "--cxx" "" "--cflags" "" "--adb-path" "adb" "--adb-test-dir" "/data/tmp/work" "--android-cross-path" "" "--color" "always"


failed to run: /checkout/obj/build/bootstrap/debug/bootstrap --stage 2 test --exclude src/tools/tidy
Build completed unsuccessfully in 0:15:08

| ^^^
help: use `..` to ignore all fields
|
LL | Color::Rgb(..) => { }
Copy link
Contributor

@pickfire pickfire Jan 13, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why don't we suggest Color::Rgb(_, _, ..) as well? I think the above is enough but we could show the other possible options.

Copy link
Contributor

@estebank estebank Jan 13, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I consider Color::Rgb(_, _, ..) is bad style. :)

Edit: let me clarify :)

Rgb(_, _, _) is useful because you're saying "I care if Rgb changes and adds fields", while Rgb(..) is saying "I don't care about the values, I just care about the tagged variant". Rgb(_, _, ..) seems to be saying "I only care to change this pattern if the variant has less than 3 fields", which seems very special cased to me.

);

// Only suggest `..` if more than one field is missing
// or the pattern consists of all wildcards.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// or the pattern consists of all wildcards.
// or the pattern consists of all wildcards `(_, _)`.

Would be better to show an example here for the comment.

Comment on lines +21 to +28
help: use `_` to explicitly ignore each field
|
LL | let P(_) = U {};
| ^
help: use `..` to ignore all fields
|
LL | let P(..) = U {};
| ^^
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that we'll need to special case when there's only one field missing (and all the other preceding fields aren't _) and _only suggest _. To clarify, I think that in this case we should only provide the first suggestion, not the .. one. That being said, it is something I can look at myself if you're itching to merge asap.

It also feels like we could deal with language for a single field. My ideal output for this case would be:

help: use `_` to explicitly ignore the missing field
   |
LL |     let P(_) = U {};
   |           ^

Copy link
Member Author

@camelid camelid Jan 13, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To clarify, I think that in this case we should only provide the first suggestion, not the .. one.

I actually think we should suggest .. in this case. It's very possible that someone didn't list any fields because they want to match on the outer structure, and so they just want to ignore all of them. We should definitely suggest .. in that case.

And also, as you said, I would like to get this merged soon. I appreciate the desire to make diagnostics as good as possible - I share that desire - but I feel that further changes would have diminishing returns and increase the risk of introducing bugs. Also, this change has taken way longer than I anticipated and I would like to spend my time on some other things :)

@estebank
Copy link
Contributor

this change has taken way longer than I anticipated and I would like to spend my time on some other things :)

👍

@bors r+

@bors
Copy link
Contributor

bors commented Jan 13, 2021

📌 Commit e8c8793 has been approved by estebank

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jan 13, 2021
m-ou-se added a commit to m-ou-se/rust that referenced this pull request Jan 14, 2021
Suggest `_` and `..` if a pattern has too few fields

Fixes rust-lang#80010.
bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 14, 2021
Rollup of 17 pull requests

Successful merges:

 - rust-lang#79982 (Add missing methods to unix ExitStatusExt)
 - rust-lang#80017 (Suggest `_` and `..` if a pattern has too few fields)
 - rust-lang#80169 (Recommend panic::resume_unwind instead of panicking.)
 - rust-lang#80217 (Add a `std::io::read_to_string` function)
 - rust-lang#80444 (Add as_ref and as_mut methods for Bound)
 - rust-lang#80567 (Add Iterator::intersperse_with)
 - rust-lang#80829 (Get rid of `DepConstructor`)
 - rust-lang#80895 (Fix handling of malicious Readers in read_to_end)
 - rust-lang#80966 (Deprecate atomic::spin_loop_hint in favour of hint::spin_loop)
 - rust-lang#80969 (Use better ICE message when no MIR is available)
 - rust-lang#80972 (Remove unstable deprecated Vec::remove_item)
 - rust-lang#80973 (Update books)
 - rust-lang#80980 (Fixed incorrect doc comment)
 - rust-lang#80981 (Fix -Cpasses=list and llvm version print with -vV)
 - rust-lang#80985 (Fix stabilisation version of slice_strip)
 - rust-lang#80990 (llvm: Remove the unused context from CreateDebugLocation)
 - rust-lang#80991 (Fix formatting specifiers doc links)

Failed merges:

 - rust-lang#80944 (Use Option::map_or instead of `.map(..).unwrap_or(..)`)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit d3b3106 into rust-lang:master Jan 14, 2021
@rustbot rustbot added this to the 1.51.0 milestone Jan 14, 2021
@camelid camelid deleted the sugg-rest-pattern branch January 15, 2021 00:02
estebank added a commit to estebank/rust that referenced this pull request Jan 27, 2021
m-ou-se added a commit to m-ou-se/rust that referenced this pull request Jan 30, 2021
Account for existing `_` field pattern when suggesting `..`

Follow up to rust-lang#80017.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-patterns Relating to patterns and pattern matching A-suggestion-diagnostics Area: Suggestions generated by the compiler applied by `cargo fix` S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

diagnostics: mismatched pattern field: suggest ".." instead of "_"
8 participants