Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
e3029ab
Improve duplicate derive Copy/Clone diagnostics
VulnBandit Oct 2, 2024
10b60eb
add third help hint to diagnostic error E0027
duncpro Oct 22, 2024
a645342
More test for non-exhaustive C-like enums in FFI
nyurik Oct 29, 2024
981dc02
Revert "Avoid nested replacement ranges" from #129346.
nnethercote Nov 4, 2024
e9161db
Fix invalid coverage computation when `--output-format=json` is enabled
GuillaumeGomez Nov 4, 2024
0eff07e
Add UI regressions tests for rustdoc `--show-coverage` option
GuillaumeGomez Nov 4, 2024
5dfbc03
Rename `DocContext::is_json` into `DocContext::is_json_output`
GuillaumeGomez Nov 4, 2024
c88ba28
document `type_implements_trait`
mejrs Nov 4, 2024
75c943e
Update books
rustbot Nov 4, 2024
4872b6b
Improve example of `impl Pattern for &[char]`
eduardosm Nov 4, 2024
107b4fd
docs: fix grammar in doc comment at unix/process.rs
SnirBroshi Nov 4, 2024
f4b72dc
Move two attribute lints to be early pass (post expansion)
jdonszelmann Nov 4, 2024
7934f26
convert all const-callable intrinsics into the new form (without exte…
RalfJung Nov 1, 2024
10723c2
remove support for extern-block const intrinsics
RalfJung Nov 1, 2024
1f0ed2b
add new rustc_const_stable_intrinsic attribute for const-stable intri…
RalfJung Nov 1, 2024
5069434
most const intrinsics don't need an explicit rustc_const_unstable any…
RalfJung Nov 2, 2024
a741b33
when an intrinsic has a const-stable fallback body, we can easily exp…
RalfJung Nov 2, 2024
e37a3a8
Explain how to evaluate an obligation
mejrs Nov 5, 2024
972fef2
Rollup merge of #131153 - VulnBandit:copy_impl_vuln, r=compiler-errors
workingjubilee Nov 5, 2024
c17cf1d
Rollup merge of #132025 - duncpro:E0027, r=compiler-errors
workingjubilee Nov 5, 2024
56aa51e
Rollup merge of #132303 - nyurik:non-exhaustive-err, r=compiler-errors
workingjubilee Nov 5, 2024
23ef001
Rollup merge of #132492 - RalfJung:const-intrinsics, r=compiler-errors
workingjubilee Nov 5, 2024
f8ac0e7
Rollup merge of #132587 - nnethercote:revert-avoid-nested-replacement…
workingjubilee Nov 5, 2024
b3fc9e6
Rollup merge of #132596 - GuillaumeGomez:show-coverage, r=notriddle
workingjubilee Nov 5, 2024
d70e2e3
Rollup merge of #132598 - jdonszelmann:move-lints-to-early, r=xFrednet
workingjubilee Nov 5, 2024
3d4dd74
Rollup merge of #132601 - rustbot:docs-update, r=ehuss
workingjubilee Nov 5, 2024
67477ca
Rollup merge of #132606 - eduardosm:char-slice-str-pattern-doc, r=tgr…
workingjubilee Nov 5, 2024
33ebfff
Rollup merge of #132608 - mejrs:type_impls_trait, r=compiler-errors
workingjubilee Nov 5, 2024
7bff6ff
Rollup merge of #132609 - NotWearingPants:patch-1, r=Amanieu
workingjubilee Nov 5, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions compiler/rustc_hir_typeck/src/pat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2071,6 +2071,25 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
s = pluralize!(len),
them = if len == 1 { "it" } else { "them" },
),
format!(
"{}{}{}{}",
prefix,
unmentioned_fields
.iter()
.map(|(_, name)| {
let field_name = name.to_string();
format!("{field_name}: _")
})
.collect::<Vec<_>>()
.join(", "),
if have_inaccessible_fields { ", .." } else { "" },
postfix,
),
Applicability::MachineApplicable,
);
err.span_suggestion(
sp,
"or always ignore missing fields here",
format!("{prefix}..{postfix}"),
Applicability::MachineApplicable,
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ LL | Struct { a, b } = Struct { a: 1, b: 2 };
| ~~~~~
help: if you don't care about this missing field, you can explicitly ignore it
|
LL | Struct { a, b: _ } = Struct { a: 1, b: 2 };
| ~~~~~~~~
help: or always ignore missing fields here
|
LL | Struct { a, .. } = Struct { a: 1, b: 2 };
| ~~~~~~

Expand Down
16 changes: 16 additions & 0 deletions tests/ui/error-codes/E0027.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ LL | Dog { age: x, name } => {}
| ~~~~~~~~
help: if you don't care about this missing field, you can explicitly ignore it
|
LL | Dog { age: x, name: _ } => {}
| ~~~~~~~~~~~
help: or always ignore missing fields here
|
LL | Dog { age: x, .. } => {}
| ~~~~~~

Expand All @@ -25,6 +29,10 @@ LL | Dog { name: x, age } => {}
| ~~~~~~~
help: if you don't care about this missing field, you can explicitly ignore it
|
LL | Dog { name: x, age: _ } => {}
| ~~~~~~~~~~
help: or always ignore missing fields here
|
LL | Dog { name: x, .. } => {}
| ~~~~~~

Expand All @@ -40,6 +48,10 @@ LL | Dog { name: x, age } => {}
| ~~~~~~~
help: if you don't care about this missing field, you can explicitly ignore it
|
LL | Dog { name: x, age: _ } => {}
| ~~~~~~~~~~
help: or always ignore missing fields here
|
LL | Dog { name: x, .. } => {}
| ~~~~~~

Expand All @@ -55,6 +67,10 @@ LL | Dog { name, age } => {}
| ~~~~~~~~~~~~~
help: if you don't care about these missing fields, you can explicitly ignore them
|
LL | Dog { name: _, age: _ } => {}
| ~~~~~~~~~~~~~~~~~~~
help: or always ignore missing fields here
|
LL | Dog { .. } => {}
| ~~~~~~

Expand Down
12 changes: 12 additions & 0 deletions tests/ui/pattern/usefulness/doc-hidden-fields.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ LL | let HiddenStruct { one, two, .. } = HiddenStruct::default();
| ~~~~~~~~~~~
help: if you don't care about this missing field, you can explicitly ignore it
|
LL | let HiddenStruct { one, two: _, .. } = HiddenStruct::default();
| ~~~~~~~~~~~~~~
help: or always ignore missing fields here
|
LL | let HiddenStruct { one, .. } = HiddenStruct::default();
| ~~~~~~

Expand All @@ -36,6 +40,10 @@ LL | let HiddenStruct { one, hide, two } = HiddenStruct::default();
| ~~~~~~~
help: if you don't care about this missing field, you can explicitly ignore it
|
LL | let HiddenStruct { one, hide, two: _ } = HiddenStruct::default();
| ~~~~~~~~~~
help: or always ignore missing fields here
|
LL | let HiddenStruct { one, hide, .. } = HiddenStruct::default();
| ~~~~~~

Expand All @@ -51,6 +59,10 @@ LL | let InCrate { a, b, im_hidden } = InCrate { a: 0, b: false, im_hidden:
| ~~~~~~~~~~~~~
help: if you don't care about this missing field, you can explicitly ignore it
|
LL | let InCrate { a, b, im_hidden: _ } = InCrate { a: 0, b: false, im_hidden: 0 };
| ~~~~~~~~~~~~~~~~
help: or always ignore missing fields here
|
LL | let InCrate { a, b, .. } = InCrate { a: 0, b: false, im_hidden: 0 };
| ~~~~~~

Expand Down
4 changes: 4 additions & 0 deletions tests/ui/pattern/usefulness/stable-gated-fields.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ LL | let UnstableStruct { stable, stable2, .. } = UnstableStruct::default();
| ~~~~~~~~~~~~~~~
help: if you don't care about this missing field, you can explicitly ignore it
|
LL | let UnstableStruct { stable, stable2: _, .. } = UnstableStruct::default();
| ~~~~~~~~~~~~~~~~~~
help: or always ignore missing fields here
|
LL | let UnstableStruct { stable, .. } = UnstableStruct::default();
| ~~~~~~

Expand Down
8 changes: 8 additions & 0 deletions tests/ui/pattern/usefulness/unstable-gated-fields.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ LL | let UnstableStruct { stable, stable2, unstable } = UnstableStruct::defa
| ~~~~~~~~~~~~
help: if you don't care about this missing field, you can explicitly ignore it
|
LL | let UnstableStruct { stable, stable2, unstable: _ } = UnstableStruct::default();
| ~~~~~~~~~~~~~~~
help: or always ignore missing fields here
|
LL | let UnstableStruct { stable, stable2, .. } = UnstableStruct::default();
| ~~~~~~

Expand All @@ -25,6 +29,10 @@ LL | let UnstableStruct { stable, unstable, stable2 } = UnstableStruct::defa
| ~~~~~~~~~~~
help: if you don't care about this missing field, you can explicitly ignore it
|
LL | let UnstableStruct { stable, unstable, stable2: _ } = UnstableStruct::default();
| ~~~~~~~~~~~~~~
help: or always ignore missing fields here
|
LL | let UnstableStruct { stable, unstable, .. } = UnstableStruct::default();
| ~~~~~~

Expand Down
4 changes: 4 additions & 0 deletions tests/ui/structs/struct-field-cfg.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ LL | let Foo { present } = foo;
| ~~~~~~~~~~~
help: if you don't care about this missing field, you can explicitly ignore it
|
LL | let Foo { present: _ } = foo;
| ~~~~~~~~~~~~~~
help: or always ignore missing fields here
|
LL | let Foo { .. } = foo;
| ~~~~~~

Expand Down
4 changes: 4 additions & 0 deletions tests/ui/structs/struct-pat-derived-error.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ LL | let A { x, y, b, c } = self.d;
| ~~~~~~~~
help: if you don't care about these missing fields, you can explicitly ignore them
|
LL | let A { x, y, b: _, c: _ } = self.d;
| ~~~~~~~~~~~~~~
help: or always ignore missing fields here
|
LL | let A { x, y, .. } = self.d;
| ~~~~~~

Expand Down
4 changes: 4 additions & 0 deletions tests/ui/structs/struct-tuple-field-names.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ LL | if let E::S { 0: a, 1: _ } = x {
| ~~~~~~~~
help: if you don't care about this missing field, you can explicitly ignore it
|
LL | if let E::S { 0: a, 1: _ } = x {
| ~~~~~~~~
help: or always ignore missing fields here
|
LL | if let E::S { 0: a, .. } = x {
| ~~~~~~

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ LL | Foo::Bar { a, aa: 1, c, b } => (),
| ~~~~~
help: if you don't care about this missing field, you can explicitly ignore it
|
LL | Foo::Bar { a, aa: 1, c, b: _ } => (),
| ~~~~~~~~
help: or always ignore missing fields here
|
LL | Foo::Bar { a, aa: 1, c, .. } => (),
| ~~~~~~

Expand All @@ -43,6 +47,10 @@ LL | Foo::Baz { bb: 1.0, a } => (),
| ~~~~~
help: if you don't care about this missing field, you can explicitly ignore it
|
LL | Foo::Baz { bb: 1.0, a: _ } => (),
| ~~~~~~~~
help: or always ignore missing fields here
|
LL | Foo::Baz { bb: 1.0, .. } => (),
| ~~~~~~

Expand All @@ -64,6 +72,10 @@ LL | Foo::Bar { a, aa: "", c, b } => (),
| ~~~~~
help: if you don't care about this missing field, you can explicitly ignore it
|
LL | Foo::Bar { a, aa: "", c, b: _ } => (),
| ~~~~~~~~
help: or always ignore missing fields here
|
LL | Foo::Bar { a, aa: "", c, .. } => (),
| ~~~~~~

Expand All @@ -85,6 +97,10 @@ LL | Foo::Baz { bb: "", a } => (),
| ~~~~~
help: if you don't care about this missing field, you can explicitly ignore it
|
LL | Foo::Baz { bb: "", a: _ } => (),
| ~~~~~~~~
help: or always ignore missing fields here
|
LL | Foo::Baz { bb: "", .. } => (),
| ~~~~~~

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ LL | let foo::Foo { visible, .. } = foo::Foo::default();
| ~~~~~~~~~~~~~~~
help: if you don't care about this missing field, you can explicitly ignore it
|
LL | let foo::Foo { visible: _, .. } = foo::Foo::default();
| ~~~~~~~~~~~~~~~~~~
help: or always ignore missing fields here
|
LL | let foo::Foo { .. } = foo::Foo::default();
| ~~~~~~

Expand Down