@@ -218,10 +218,7 @@ fn project_and_unify_type<'cx, 'gcx, 'tcx>(
218218 obligation. cause . clone ( ) ,
219219 obligation. recursion_depth ) {
220220 Some ( n) => n,
221- None => {
222- consider_unification_despite_ambiguity ( selcx, obligation) ;
223- return Ok ( None ) ;
224- }
221+ None => return Ok ( None ) ,
225222 } ;
226223
227224 debug ! ( "project_and_unify_type: normalized_ty={:?} obligations={:?}" ,
@@ -240,59 +237,6 @@ fn project_and_unify_type<'cx, 'gcx, 'tcx>(
240237 }
241238}
242239
243- fn consider_unification_despite_ambiguity < ' cx , ' gcx , ' tcx > (
244- selcx : & mut SelectionContext < ' cx , ' gcx , ' tcx > ,
245- obligation : & ProjectionObligation < ' tcx > )
246- {
247- debug ! ( "consider_unification_despite_ambiguity(obligation={:?})" ,
248- obligation) ;
249-
250- let def_id = obligation. predicate . projection_ty . trait_ref . def_id ;
251- match selcx. tcx ( ) . lang_items . fn_trait_kind ( def_id) {
252- Some ( _) => { }
253- None => { return ; }
254- }
255-
256- let infcx = selcx. infcx ( ) ;
257- let self_ty = obligation. predicate . projection_ty . trait_ref . self_ty ( ) ;
258- let self_ty = infcx. shallow_resolve ( self_ty) ;
259- debug ! ( "consider_unification_despite_ambiguity: self_ty.sty={:?}" ,
260- self_ty. sty) ;
261- match self_ty. sty {
262- ty:: TyClosure ( closure_def_id, substs) => {
263- let closure_typer = selcx. closure_typer ( ) ;
264- let closure_type = closure_typer. closure_type ( closure_def_id, substs) ;
265- let ty:: Binder ( ( _, ret_type) ) =
266- infcx. tcx . closure_trait_ref_and_return_type ( def_id,
267- self_ty,
268- & closure_type. sig ,
269- util:: TupleArgumentsFlag :: No ) ;
270- // We don't have to normalize the return type here - this is only
271- // reached for TyClosure: Fn inputs where the closure kind is
272- // still unknown, which should only occur in typeck where the
273- // closure type is already normalized.
274- let ( ret_type, _) =
275- infcx. replace_late_bound_regions_with_fresh_var (
276- obligation. cause . span ,
277- infer:: AssocTypeProjection ( obligation. predicate . projection_ty . item_name ) ,
278- & ty:: Binder ( ret_type) ) ;
279-
280- debug ! ( "consider_unification_despite_ambiguity: ret_type={:?}" ,
281- ret_type) ;
282- let origin = TypeOrigin :: RelateOutputImplTypes ( obligation. cause . span ) ;
283- let obligation_ty = obligation. predicate . ty ;
284- match infcx. eq_types ( true , origin, obligation_ty, ret_type) {
285- Ok ( InferOk { obligations, .. } ) => {
286- // FIXME(#32730) propagate obligations
287- assert ! ( obligations. is_empty( ) ) ;
288- }
289- Err ( _) => { /* ignore errors */ }
290- }
291- }
292- _ => { }
293- }
294- }
295-
296240/// Normalizes any associated type projections in `value`, replacing
297241/// them with a fully resolved type where possible. The return value
298242/// combines the normalized result and any additional obligations that
0 commit comments