Skip to content

Commit

Permalink
Auto merge of #83839 - ldm0:deref, r=petrochenkov
Browse files Browse the repository at this point in the history
Remove unneeded type resolving

small optimization.
  • Loading branch information
bors committed Apr 4, 2021
2 parents f98135b + 3982ac2 commit b1ea261
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions compiler/rustc_typeck/src/check/expectation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@ impl<'a, 'tcx> Expectation<'tcx> {
/// for the program to type-check). `only_has_type` will return
/// such a constraint, if it exists.
pub(super) fn only_has_type(self, fcx: &FnCtxt<'a, 'tcx>) -> Option<Ty<'tcx>> {
match self.resolve(fcx) {
ExpectHasType(ty) => Some(ty),
match self {
ExpectHasType(ty) => Some(fcx.resolve_vars_if_possible(ty)),
NoExpectation | ExpectCastableToType(_) | ExpectRvalueLikeUnsized(_) | IsLast(_) => {
None
}
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_typeck/src/check/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
expr: &'tcx hir::Expr<'tcx>,
expected: Expectation<'tcx>,
) -> Ty<'tcx> {
debug!(">> type-checking: expr={:?} expected={:?}", expr, expected);
debug!(">> type-checking: expected={:?}, expr={:?} ", expected, expr);

// True if `expr` is a `Try::from_ok(())` that is a result of desugaring a try block
// without the final expr (e.g. `try { return; }`). We don't want to generate an
Expand Down Expand Up @@ -224,7 +224,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
expr: &'tcx hir::Expr<'tcx>,
expected: Expectation<'tcx>,
) -> Ty<'tcx> {
debug!("check_expr_kind(expr={:?}, expected={:?})", expr, expected);
debug!("check_expr_kind(expected={:?}, expr={:?})", expected, expr);

let tcx = self.tcx;
match expr.kind {
Expand Down

0 comments on commit b1ea261

Please sign in to comment.