mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-22 02:00:00 +03:00
review comments
This commit is contained in:
@@ -1555,15 +1555,11 @@ pub fn is_place_expr(&self) -> bool {
|
||||
/// `ExprKind` of any given `Expr` for presentation don't have to care about `DropTemps`
|
||||
/// beyond remembering to call this function before doing analysis on it.
|
||||
pub fn peel_drop_temps(&self) -> &Self {
|
||||
let mut base_expr = self;
|
||||
loop {
|
||||
match &base_expr.kind {
|
||||
ExprKind::DropTemps(expr) => {
|
||||
base_expr = &expr;
|
||||
}
|
||||
_ => return base_expr,
|
||||
}
|
||||
let mut expr = self;
|
||||
while let ExprKind::DropTemps(inner) = &expr.kind {
|
||||
expr = inner;
|
||||
}
|
||||
expr
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -109,13 +109,13 @@ pub fn demand_coerce_diag(&self,
|
||||
allow_two_phase: AllowTwoPhase)
|
||||
-> (Ty<'tcx>, Option<DiagnosticBuilder<'tcx>>) {
|
||||
let expected = self.resolve_type_vars_with_obligations(expected);
|
||||
let expr = expr.peel_drop_temps();
|
||||
|
||||
let e = match self.try_coerce(expr, checked_ty, expected, allow_two_phase) {
|
||||
Ok(ty) => return (ty, None),
|
||||
Err(e) => e
|
||||
};
|
||||
|
||||
let expr = expr.peel_drop_temps();
|
||||
let cause = self.misc(expr.span);
|
||||
let expr_ty = self.resolve_type_vars_with_obligations(checked_ty);
|
||||
let mut err = self.report_mismatched_types(&cause, expected, expr_ty, e);
|
||||
|
||||
Reference in New Issue
Block a user