Skip to content
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
1b3fe75
Allow simd_shuffle to accept vectors of any length
calebzulawski Sep 11, 2021
37196e3
Suggest replacing an inexisting field for an unmentioned field
hkmatsumoto Aug 12, 2021
ffdabc8
Check for shadowing issues involving block labels
tmiasko Sep 15, 2021
bd4c967
Fix linting when trailing macro expands to a trailing semi
Aaron1011 Sep 16, 2021
4a4ca94
Fix shuffle index constant not being monomorphized.
calebzulawski Sep 16, 2021
2b512cc
fix potential race in AtomicU64 time monotonizer
the8472 Sep 16, 2021
f84000d
Add a separate error for `dyn Trait` in `const fn`
WaffleLapkin Sep 16, 2021
57465d9
use AtomicU64::fetch_update instead of handrolled RMW-loop
the8472 Sep 17, 2021
ec34aa6
modify std::os docs to be more consistent
schctl Sep 17, 2021
05b01cd
refactor: VecDeques IntoIter fields to private
DeveloperC286 Sep 17, 2021
68147eb
Suggest better place to add call parentheses for method expressions w…
Kobzol Sep 17, 2021
59d5eb2
Resolve issue 85066
Wardenfar Sep 16, 2021
3f75ab3
Fix typo
Sep 18, 2021
2f210be
Rollup merge of #87960 - hkmatsumoto:suggest-inexisting-field-for-unm…
JohnTitor Sep 19, 2021
5bc783b
Rollup merge of #88855 - calebzulawski:feature/simd_shuffle, r=nagisa
JohnTitor Sep 19, 2021
25beabe
Rollup merge of #88966 - tmiasko:block-label-shadowing, r=petrochenkov
JohnTitor Sep 19, 2021
ddf3c53
Rollup merge of #88996 - Aaron1011:trailing-macro-semi, r=petrochenkov
JohnTitor Sep 19, 2021
487101d
Rollup merge of #89017 - the8472:fix-u64-time-monotonizer, r=kennytm
JohnTitor Sep 19, 2021
c58c4b0
Rollup merge of #89021 - WaffleLapkin:separate_error_for_dyn_trait_in…
JohnTitor Sep 19, 2021
833312b
Rollup merge of #89023 - Wardenfar:issue-85066, r=nagisa
JohnTitor Sep 19, 2021
59891cc
Rollup merge of #89051 - schctl:master, r=jyn514
JohnTitor Sep 19, 2021
93bb4a9
Rollup merge of #89053 - DeveloperC286:into_iter_fields_to_private, r…
JohnTitor Sep 19, 2021
64b19fe
Rollup merge of #89055 - Kobzol:wrapped-method-expr-call-parens, r=we…
JohnTitor Sep 19, 2021
265dd84
Rollup merge of #89081 - ondra05:patch-1, r=dtolnay
JohnTitor Sep 19, 2021
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
15 changes: 14 additions & 1 deletion compiler/rustc_typeck/src/check/pat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1452,7 +1452,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
plural
),
);
if plural == "" {

if unmentioned_fields.len() == 1 {
let input =
unmentioned_fields.iter().map(|(_, field)| field.name).collect::<Vec<_>>();
let suggested_name = find_best_match_for_name(&input, ident.name, None);
Expand All @@ -1473,6 +1474,18 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
// We don't want to throw `E0027` in case we have thrown `E0026` for them.
unmentioned_fields.retain(|&(_, x)| x.name != suggested_name);
}
} else if inexistent_fields.len() == 1 {
let unmentioned_field = unmentioned_fields[0].1.name;
err.span_suggestion_short(
ident.span,
&format!(
"`{}` has a field named `{}`",
tcx.def_path_str(variant.def_id),
unmentioned_field
),
unmentioned_field.to_string(),
Applicability::MaybeIncorrect,
);
}
}
}
Expand Down
5 changes: 4 additions & 1 deletion src/test/ui/issues/issue-51102.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ error[E0026]: struct `SimpleStruct` does not have a field named `state`
--> $DIR/issue-51102.rs:13:17
|
LL | state: 0,
| ^^^^^ struct `SimpleStruct` does not have this field
| ^^^^^
| |
| struct `SimpleStruct` does not have this field
| help: `SimpleStruct` has a field named `no_state_here`

error[E0025]: field `no_state_here` bound multiple times in the pattern
--> $DIR/issue-51102.rs:24:17
Expand Down
5 changes: 4 additions & 1 deletion src/test/ui/numeric/numeric-fields.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ error[E0026]: struct `S` does not have a field named `0x1`
--> $DIR/numeric-fields.rs:7:17
|
LL | S{0: a, 0x1: b, ..} => {}
| ^^^ struct `S` does not have this field
| ^^^
| |
| struct `S` does not have this field
| help: `S` has a field named `1`

error: aborting due to 2 previous errors

Expand Down