Skip to content

Commit 3982ac2

Browse files
committed
Optimize out unneeded type resolving
1 parent 8eed8ed commit 3982ac2

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

compiler/rustc_typeck/src/check/expectation.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,8 @@ impl<'a, 'tcx> Expectation<'tcx> {
104104
/// for the program to type-check). `only_has_type` will return
105105
/// such a constraint, if it exists.
106106
pub(super) fn only_has_type(self, fcx: &FnCtxt<'a, 'tcx>) -> Option<Ty<'tcx>> {
107-
match self.resolve(fcx) {
108-
ExpectHasType(ty) => Some(ty),
107+
match self {
108+
ExpectHasType(ty) => Some(fcx.resolve_vars_if_possible(ty)),
109109
NoExpectation | ExpectCastableToType(_) | ExpectRvalueLikeUnsized(_) | IsLast(_) => {
110110
None
111111
}

0 commit comments

Comments
 (0)