should not try to apply field accessing on enum
This commit is contained in:
parent
7cfcefd1fb
commit
b71c8b64b5
1 changed files with 11 additions and 7 deletions
|
@ -1545,13 +1545,17 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||||
normalized_ty.kind,
|
normalized_ty.kind,
|
||||||
);
|
);
|
||||||
if let ty::Adt(def, _) = normalized_ty.kind {
|
if let ty::Adt(def, _) = normalized_ty.kind {
|
||||||
if def.non_enum_variant().fields.iter().any(|field| field.ident == field_ident) {
|
// no field access on enum type
|
||||||
err.span_suggestion_verbose(
|
if !def.is_enum() {
|
||||||
base.span.shrink_to_hi(),
|
if def.non_enum_variant().fields.iter().any(|field| field.ident == field_ident)
|
||||||
"consider awaiting before field access",
|
{
|
||||||
".await".to_string(),
|
err.span_suggestion_verbose(
|
||||||
Applicability::MaybeIncorrect,
|
base.span.shrink_to_hi(),
|
||||||
);
|
"consider awaiting before field access",
|
||||||
|
".await".to_string(),
|
||||||
|
Applicability::MaybeIncorrect,
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue