@@ -1400,8 +1400,17 @@ fn assemble_candidates_from_impls<'cx, 'tcx>(
1400
1400
// Any type with multiple potential metadata types is therefore not eligible.
1401
1401
let self_ty = selcx. infcx ( ) . shallow_resolve ( obligation. predicate . self_ty ( ) ) ;
1402
1402
1403
- // FIXME: should this normalize?
1404
- let tail = selcx. tcx ( ) . struct_tail_without_normalization ( self_ty) ;
1403
+ let tail = selcx. tcx ( ) . struct_tail_with_normalize ( self_ty, |ty| {
1404
+ normalize_with_depth (
1405
+ selcx,
1406
+ obligation. param_env ,
1407
+ obligation. cause . clone ( ) ,
1408
+ obligation. recursion_depth + 1 ,
1409
+ ty,
1410
+ )
1411
+ . value
1412
+ } ) ;
1413
+
1405
1414
match tail. kind ( ) {
1406
1415
ty:: Bool
1407
1416
| ty:: Char
@@ -1435,7 +1444,12 @@ fn assemble_candidates_from_impls<'cx, 'tcx>(
1435
1444
| ty:: Bound ( ..)
1436
1445
| ty:: Placeholder ( ..)
1437
1446
| ty:: Infer ( ..)
1438
- | ty:: Error ( _) => false ,
1447
+ | ty:: Error ( _) => {
1448
+ if tail. has_infer_types ( ) {
1449
+ candidate_set. mark_ambiguous ( ) ;
1450
+ }
1451
+ false
1452
+ } ,
1439
1453
}
1440
1454
}
1441
1455
super :: ImplSource :: Param ( ..) => {
@@ -1640,18 +1654,30 @@ fn confirm_pointee_candidate<'cx, 'tcx>(
1640
1654
_: ImplSourcePointeeData ,
1641
1655
) -> Progress < ' tcx > {
1642
1656
let tcx = selcx. tcx ( ) ;
1643
-
1644
1657
let self_ty = selcx. infcx ( ) . shallow_resolve ( obligation. predicate . self_ty ( ) ) ;
1645
- let substs = tcx. mk_substs ( [ self_ty. into ( ) ] . iter ( ) ) ;
1646
1658
1659
+ let mut obligations = vec ! [ ] ;
1660
+ let metadata_ty = self_ty. ptr_metadata_ty ( tcx, |ty| {
1661
+ normalize_with_depth_to (
1662
+ selcx,
1663
+ obligation. param_env ,
1664
+ obligation. cause . clone ( ) ,
1665
+ obligation. recursion_depth + 1 ,
1666
+ ty,
1667
+ & mut obligations,
1668
+ )
1669
+ } ) ;
1670
+
1671
+ let substs = tcx. mk_substs ( [ self_ty. into ( ) ] . iter ( ) ) ;
1647
1672
let metadata_def_id = tcx. require_lang_item ( LangItem :: Metadata , None ) ;
1648
1673
1649
1674
let predicate = ty:: ProjectionPredicate {
1650
1675
projection_ty : ty:: ProjectionTy { substs, item_def_id : metadata_def_id } ,
1651
- ty : self_ty . ptr_metadata_ty ( tcx ) ,
1676
+ ty : metadata_ty ,
1652
1677
} ;
1653
1678
1654
1679
confirm_param_env_candidate ( selcx, obligation, ty:: Binder :: dummy ( predicate) , false )
1680
+ . with_addl_obligations ( obligations)
1655
1681
}
1656
1682
1657
1683
fn confirm_fn_pointer_candidate < ' cx , ' tcx > (
0 commit comments