typeck: Don't suggest converting LHS exprs
Converting LHS of an assignment does not work, so avoid suggesting that. Fixes #81293
This commit is contained in:
parent
ff6ee2a702
commit
d035be8e6f
4 changed files with 51 additions and 0 deletions
|
@ -816,6 +816,13 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
|||
|err: &mut DiagnosticBuilder<'_>,
|
||||
found_to_exp_is_fallible: bool,
|
||||
exp_to_found_is_fallible: bool| {
|
||||
let exp_is_lhs =
|
||||
expected_ty_expr.map(|e| self.tcx.hir().is_lhs(e.hir_id)).unwrap_or(false);
|
||||
|
||||
if exp_is_lhs {
|
||||
return;
|
||||
}
|
||||
|
||||
let always_fallible = found_to_exp_is_fallible
|
||||
&& (exp_to_found_is_fallible || expected_ty_expr.is_none());
|
||||
let msg = if literal_is_ty_suffixed(expr) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue