@@ -1156,9 +1156,11 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
11561156 ( ty:: FnDef ( ..) , ty:: FnDef ( ..) ) => {
11571157 // Don't reify if the function types have a LUB, i.e., they
11581158 // are the same function and their parameters have a LUB.
1159- match self . commit_if_ok ( |_| {
1159+ match self . commit_if_ok ( |snapshot| {
1160+ let outer_universe = self . infcx . universe ( ) ;
1161+
11601162 // We need to eagerly handle nested obligations due to lazy norm.
1161- if self . next_trait_solver ( ) {
1163+ let result = if self . next_trait_solver ( ) {
11621164 let ocx = ObligationCtxt :: new ( self ) ;
11631165 let value = ocx. lub ( cause, self . param_env , prev_ty, new_ty) ?;
11641166 if ocx. try_evaluate_obligations ( ) . is_empty ( ) {
@@ -1171,7 +1173,10 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
11711173 }
11721174 } else {
11731175 self . at ( cause, self . param_env ) . lub ( prev_ty, new_ty)
1174- }
1176+ } ;
1177+
1178+ self . leak_check ( outer_universe, Some ( snapshot) ) ?;
1179+ result
11751180 } ) {
11761181 // We have a LUB of prev_ty and new_ty, just return it.
11771182 Ok ( ok) => return Ok ( self . register_infer_ok_obligations ( ok) ) ,
0 commit comments