-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
fix suggestion for diagnostic error E0027 #132025
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @wesleywiser (or someone else) some time within the next two weeks. Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (
|
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
compiler/rustc_hir_typeck/src/pat.rs
Outdated
@@ -2053,7 +2053,11 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { | |||
.iter() | |||
.map(|(_, name)| { | |||
let field_name = name.to_string(); | |||
if is_number(&field_name) { format!("{field_name}: _") } else { field_name } | |||
if is_number(&field_name) { | |||
format!("{}: _", field_name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did you change this? {field_name}: _
is fine, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with you. There was no need for the change. I will revert it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
10b60eb fixes this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please address the review comments, bless the tests, and squash this into one commit.
compiler/rustc_hir_typeck/src/pat.rs
Outdated
@@ -2065,11 +2069,28 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { | |||
err.span_suggestion( | |||
sp, | |||
format!( | |||
"if you don't care about {these} missing field{s}, you can explicitly ignore {them}", | |||
these = pluralize!("this", len), | |||
"if the value{s} {are} not relevant, discard {them} explicitly", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the message did not need to be changed. Tweaking the suggestion was sufficient.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, reverted the message change in 10b60eb.
rust/compiler/rustc_hir_typeck/src/pat.rs
Line 2068 in 10b60eb
"if you don't care about {these} missing field{s}, you can explicitly ignore {them}", |
@rustbot label -S-waiting-on-author +S-waiting-on-review |
@bors r+ rollup |
fix suggestion for diagnostic error E0027 Closes rust-lang#132008
Rollup of 9 pull requests Successful merges: - rust-lang#131153 (Improve duplicate derive Copy/Clone diagnostics) - rust-lang#131341 (Support clobber_abi and vector registers (clobber-only) in PowerPC inline assembly) - rust-lang#132025 (fix suggestion for diagnostic error E0027) - rust-lang#132153 (Stabilise `const_char_encode_utf16`.) - rust-lang#132303 (More tests for non-exhaustive C-like enums in FFI) - rust-lang#132473 ([core/fmt] Replace checked slice indexing by unchecked to support panic-free code) - rust-lang#132598 (Clippy: Move some attribute lints to be early pass (post expansion)) - rust-lang#132606 (Improve example of `impl Pattern for &[char]`) - rust-lang#132609 (docs: fix grammar in doc comment at unix/process.rs) r? `@ghost` `@rustbot` modify labels: rollup
…kingjubilee Rollup of 11 pull requests Successful merges: - rust-lang#131153 (Improve duplicate derive Copy/Clone diagnostics) - rust-lang#132025 (fix suggestion for diagnostic error E0027) - rust-lang#132303 (More tests for non-exhaustive C-like enums in FFI) - rust-lang#132492 (remove support for extern-block const intrinsics) - rust-lang#132587 (Revert "Avoid nested replacement ranges" from rust-lang#129346.) - rust-lang#132596 ([rustdoc] Fix `--show-coverage` when JSON output format is used) - rust-lang#132598 (Clippy: Move some attribute lints to be early pass (post expansion)) - rust-lang#132601 (Update books) - rust-lang#132606 (Improve example of `impl Pattern for &[char]`) - rust-lang#132608 (document `type_implements_trait`) - rust-lang#132609 (docs: fix grammar in doc comment at unix/process.rs) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#132025 - duncpro:E0027, r=compiler-errors fix suggestion for diagnostic error E0027 Closes rust-lang#132008
Closes #132008