1
Fork 0

suggest deref/unboxing before wrapping variant

This commit is contained in:
Michael Goulet 2022-01-12 12:00:36 -08:00
parent 40f33a7a4c
commit 8568f44fe1
2 changed files with 5 additions and 5 deletions

View file

@ -31,8 +31,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
error: TypeError<'tcx>, error: TypeError<'tcx>,
) { ) {
self.annotate_expected_due_to_let_ty(err, expr, error); self.annotate_expected_due_to_let_ty(err, expr, error);
self.suggest_compatible_variants(err, expr, expected, expr_ty);
self.suggest_deref_ref_or_into(err, expr, expected, expr_ty, expected_ty_expr); self.suggest_deref_ref_or_into(err, expr, expected, expr_ty, expected_ty_expr);
self.suggest_compatible_variants(err, expr, expected, expr_ty);
if self.suggest_calling_boxed_future_when_appropriate(err, expr, expected, expr_ty) { if self.suggest_calling_boxed_future_when_appropriate(err, expr, expected, expr_ty) {
return; return;
} }

View file

@ -6,14 +6,14 @@ LL | Ty::List(elem) => foo(elem),
| |
= note: expected enum `Ty` = note: expected enum `Ty`
found struct `Box<Ty>` found struct `Box<Ty>`
help: try wrapping the expression in `Ty::List`
|
LL | Ty::List(elem) => foo(Ty::List(elem)),
| +++++++++ +
help: consider unboxing the value help: consider unboxing the value
| |
LL | Ty::List(elem) => foo(*elem), LL | Ty::List(elem) => foo(*elem),
| + | +
help: try wrapping the expression in `Ty::List`
|
LL | Ty::List(elem) => foo(Ty::List(elem)),
| +++++++++ +
error: aborting due to previous error error: aborting due to previous error