Auto merge of #75985 - csmoe:issue-61076-1, r=estebank
Should not apply field accessing on enum Closes #75977 But I'm surprised that `x.py test --stage 1` and CI didn't catch this with existing testcase. r? @estebank
This commit is contained in:
commit
65d071eeb5
@ -1545,13 +1545,17 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
normalized_ty.kind,
|
||||
);
|
||||
if let ty::Adt(def, _) = normalized_ty.kind {
|
||||
if def.non_enum_variant().fields.iter().any(|field| field.ident == field_ident) {
|
||||
err.span_suggestion_verbose(
|
||||
base.span.shrink_to_hi(),
|
||||
"consider awaiting before field access",
|
||||
".await".to_string(),
|
||||
Applicability::MaybeIncorrect,
|
||||
);
|
||||
// no field access on enum type
|
||||
if !def.is_enum() {
|
||||
if def.non_enum_variant().fields.iter().any(|field| field.ident == field_ident)
|
||||
{
|
||||
err.span_suggestion_verbose(
|
||||
base.span.shrink_to_hi(),
|
||||
"consider awaiting before field access",
|
||||
".await".to_string(),
|
||||
Applicability::MaybeIncorrect,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user