1
Fork 0

Optimize out unneeded type resolving

This commit is contained in:
liudingming 2021-04-04 01:40:47 +08:00
parent 8eed8ed967
commit 3982ac2249

View file

@ -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
}