Skip to content

Commit fee9e9b

Browse files
Do not leak variables from probe
1 parent 075b3ce commit fee9e9b

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

compiler/rustc_typeck/src/check/inherited.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,10 +105,13 @@ impl<'tcx> Inherited<'_, 'tcx> {
105105
let mut fulfillment_ctxt = FulfillmentContext::new_in_snapshot();
106106
fulfillment_ctxt.register_predicate_obligations(infcx, obligations);
107107
if fulfillment_ctxt.select_all_or_error(infcx).is_empty() {
108-
infcx.resolve_vars_if_possible(normalized_fn_sig)
109-
} else {
110-
fn_sig
108+
let normalized_fn_sig =
109+
infcx.resolve_vars_if_possible(normalized_fn_sig);
110+
if !normalized_fn_sig.needs_infer() {
111+
return normalized_fn_sig;
112+
}
111113
}
114+
fn_sig
112115
})
113116
})),
114117
def_id,

0 commit comments

Comments
 (0)