diff --git a/compiler/rustc_typeck/src/check/inherited.rs b/compiler/rustc_typeck/src/check/inherited.rs index 1a000f77b0f..371fc26154c 100644 --- a/compiler/rustc_typeck/src/check/inherited.rs +++ b/compiler/rustc_typeck/src/check/inherited.rs @@ -105,10 +105,13 @@ pub fn build(tcx: TyCtxt<'tcx>, def_id: LocalDefId) -> InheritedBuilder<'tcx> { let mut fulfillment_ctxt = FulfillmentContext::new_in_snapshot(); fulfillment_ctxt.register_predicate_obligations(infcx, obligations); if fulfillment_ctxt.select_all_or_error(infcx).is_empty() { - infcx.resolve_vars_if_possible(normalized_fn_sig) - } else { - fn_sig + let normalized_fn_sig = + infcx.resolve_vars_if_possible(normalized_fn_sig); + if !normalized_fn_sig.needs_infer() { + return normalized_fn_sig; + } } + fn_sig }) })), def_id,