@@ -46,7 +46,7 @@ use rustc_hir::{LangItem, PredicateOrigin, find_attr};
4646use rustc_hir_analysis:: { lower_const_arg_for_rustdoc, lower_ty} ;
4747use rustc_middle:: metadata:: Reexport ;
4848use rustc_middle:: middle:: resolve_bound_vars as rbv;
49- use rustc_middle:: ty:: { self , AdtKind , GenericArgsRef , Ty , TyCtxt , TypeVisitableExt , TypingMode } ;
49+ use rustc_middle:: ty:: { self , AdtKind , GenericArgsRef , Ty , TyCtxt , TypeVisitableExt , TypingMode , Unnormalized } ;
5050use rustc_middle:: { bug, span_bug} ;
5151use rustc_span:: ExpnKind ;
5252use rustc_span:: hygiene:: { AstPass , MacroKind } ;
@@ -507,7 +507,7 @@ fn clean_hir_term<'tcx>(
507507 hir:: Term :: Ty ( ty) => Term :: Type ( clean_ty ( ty, cx) ) ,
508508 hir:: Term :: Const ( c) => {
509509 // FIXME(generic_const_items): this should instantiate with the alias item's args
510- let ty = cx. tcx . type_of ( assoc_item. unwrap ( ) ) . instantiate_identity ( ) ;
510+ let ty = cx. tcx . type_of ( assoc_item. unwrap ( ) ) . instantiate_identity ( ) . skip_normalization ( ) ;
511511 let ct = lower_const_arg_for_rustdoc ( cx. tcx , c, ty) ;
512512 Term :: Constant ( clean_middle_const ( ty:: Binder :: dummy ( ct) ) )
513513 }
@@ -590,7 +590,7 @@ fn clean_generic_param_def(
590590 && has_default
591591 {
592592 Some ( clean_middle_ty (
593- ty:: Binder :: dummy ( cx. tcx . type_of ( def. def_id ) . instantiate_identity ( ) ) ,
593+ ty:: Binder :: dummy ( cx. tcx . type_of ( def. def_id ) . instantiate_identity ( ) . skip_normalization ( ) ) ,
594594 cx,
595595 Some ( def. def_id ) ,
596596 None ,
@@ -611,7 +611,7 @@ fn clean_generic_param_def(
611611 def. name ,
612612 GenericParamDefKind :: Const {
613613 ty : Box :: new ( clean_middle_ty (
614- ty:: Binder :: dummy ( cx. tcx . type_of ( def. def_id ) . instantiate_identity ( ) ) ,
614+ ty:: Binder :: dummy ( cx. tcx . type_of ( def. def_id ) . instantiate_identity ( ) . skip_normalization ( ) ) ,
615615 cx,
616616 Some ( def. def_id ) ,
617617 None ,
@@ -620,7 +620,7 @@ fn clean_generic_param_def(
620620 && has_default
621621 {
622622 Some ( Box :: new (
623- cx. tcx . const_param_default ( def. def_id ) . instantiate_identity ( ) . to_string ( ) ,
623+ cx. tcx . const_param_default ( def. def_id ) . instantiate_identity ( ) . skip_normalization ( ) . to_string ( ) ,
624624 ) )
625625 } else {
626626 None
@@ -1328,7 +1328,7 @@ pub(crate) fn clean_middle_assoc_item(assoc_item: &ty::AssocItem, cx: &mut DocCo
13281328 let kind = match assoc_item. kind {
13291329 ty:: AssocKind :: Const { .. } => {
13301330 let ty = clean_middle_ty (
1331- ty:: Binder :: dummy ( tcx. type_of ( assoc_item. def_id ) . instantiate_identity ( ) ) ,
1331+ ty:: Binder :: dummy ( tcx. type_of ( assoc_item. def_id ) . instantiate_identity ( ) . skip_normalization ( ) ) ,
13321332 cx,
13331333 Some ( assoc_item. def_id ) ,
13341334 None ,
@@ -1364,12 +1364,12 @@ pub(crate) fn clean_middle_assoc_item(assoc_item: &ty::AssocItem, cx: &mut DocCo
13641364 if has_self {
13651365 let self_ty = match assoc_item. container {
13661366 ty:: AssocContainer :: InherentImpl | ty:: AssocContainer :: TraitImpl ( _) => {
1367- tcx. type_of ( assoc_item. container_id ( tcx) ) . instantiate_identity ( )
1367+ tcx. type_of ( assoc_item. container_id ( tcx) ) . instantiate_identity ( ) . skip_normalization ( )
13681368 }
13691369 ty:: AssocContainer :: Trait => tcx. types . self_param ,
13701370 } ;
13711371 let self_param_ty =
1372- tcx. fn_sig ( assoc_item. def_id ) . instantiate_identity ( ) . input ( 0 ) . skip_binder ( ) ;
1372+ tcx. fn_sig ( assoc_item. def_id ) . instantiate_identity ( ) . skip_normalization ( ) . input ( 0 ) . skip_binder ( ) ;
13731373 if self_param_ty == self_ty {
13741374 item. decl . inputs [ 0 ] . type_ = SelfTy ;
13751375 } else if let ty:: Ref ( _, ty, _) = * self_param_ty. kind ( )
@@ -1423,7 +1423,7 @@ pub(crate) fn clean_middle_assoc_item(assoc_item: &ty::AssocItem, cx: &mut DocCo
14231423
14241424 let mut predicates = tcx. explicit_predicates_of ( assoc_item. def_id ) . predicates ;
14251425 if let ty:: AssocContainer :: Trait = assoc_item. container {
1426- let bounds = tcx. explicit_item_bounds ( assoc_item. def_id ) . iter_identity_copied ( ) ;
1426+ let bounds = tcx. explicit_item_bounds ( assoc_item. def_id ) . iter_identity_copied ( ) . map ( Unnormalized :: skip_normalization ) ;
14271427 predicates = tcx. arena . alloc_from_iter ( bounds. chain ( predicates. iter ( ) . copied ( ) ) ) ;
14281428 }
14291429 let mut generics = clean_ty_generics_inner (
@@ -1509,7 +1509,7 @@ pub(crate) fn clean_middle_assoc_item(assoc_item: &ty::AssocItem, cx: &mut DocCo
15091509 Box :: new ( TypeAlias {
15101510 type_ : clean_middle_ty (
15111511 ty:: Binder :: dummy (
1512- tcx. type_of ( assoc_item. def_id ) . instantiate_identity ( ) ,
1512+ tcx. type_of ( assoc_item. def_id ) . instantiate_identity ( ) . skip_normalization ( ) ,
15131513 ) ,
15141514 cx,
15151515 Some ( assoc_item. def_id ) ,
@@ -1529,7 +1529,7 @@ pub(crate) fn clean_middle_assoc_item(assoc_item: &ty::AssocItem, cx: &mut DocCo
15291529 Box :: new ( TypeAlias {
15301530 type_ : clean_middle_ty (
15311531 ty:: Binder :: dummy (
1532- tcx. type_of ( assoc_item. def_id ) . instantiate_identity ( ) ,
1532+ tcx. type_of ( assoc_item. def_id ) . instantiate_identity ( ) . skip_normalization ( ) ,
15331533 ) ,
15341534 cx,
15351535 Some ( assoc_item. def_id ) ,
@@ -2267,7 +2267,7 @@ pub(crate) fn clean_middle_ty<'tcx>(
22672267 clean_middle_path ( cx, def_id, false , ThinVec :: new ( ) , bound_ty. rebind ( args) ) ;
22682268 Type :: Path { path }
22692269 } else {
2270- let ty = cx. tcx . type_of ( def_id) . instantiate ( cx. tcx , args) ;
2270+ let ty = cx. tcx . type_of ( def_id) . instantiate ( cx. tcx , args) . skip_normalization ( ) ;
22712271 clean_middle_ty ( bound_ty. rebind ( ty) , cx, None , None )
22722272 }
22732273 }
@@ -2328,8 +2328,7 @@ fn clean_middle_opaque_bounds<'tcx>(
23282328
23292329 let bounds: Vec < _ > = cx
23302330 . tcx
2331- . explicit_item_bounds ( impl_trait_def_id)
2332- . iter_instantiated_copied ( cx. tcx , args)
2331+ . explicit_item_bounds ( impl_trait_def_id) . iter_instantiated_copied ( cx. tcx , args) . map ( Unnormalized :: skip_normalization)
23332332 . collect ( ) ;
23342333
23352334 let mut bounds = bounds
@@ -2427,7 +2426,7 @@ pub(crate) fn clean_middle_field(field: &ty::FieldDef, cx: &mut DocContext<'_>)
24272426 field. did ,
24282427 field. name ,
24292428 clean_middle_ty (
2430- ty:: Binder :: dummy ( cx. tcx . type_of ( field. did ) . instantiate_identity ( ) ) ,
2429+ ty:: Binder :: dummy ( cx. tcx . type_of ( field. did ) . instantiate_identity ( ) . skip_normalization ( ) ) ,
24312430 cx,
24322431 Some ( field. did ) ,
24332432 None ,
@@ -2491,7 +2490,7 @@ pub(crate) fn clean_variant_def_with_args<'tcx>(
24912490 . fields
24922491 . iter ( )
24932492 . map ( |field| {
2494- let ty = cx. tcx . type_of ( field. did ) . instantiate ( cx. tcx , args) ;
2493+ let ty = cx. tcx . type_of ( field. did ) . instantiate ( cx. tcx , args) . skip_normalization ( ) ;
24952494
24962495 // normalize the type to only show concrete types
24972496 // note: we do not use try_normalize_erasing_regions since we
@@ -2516,7 +2515,7 @@ pub(crate) fn clean_variant_def_with_args<'tcx>(
25162515 . fields
25172516 . iter ( )
25182517 . map ( |field| {
2519- let ty = cx. tcx . type_of ( field. did ) . instantiate ( cx. tcx , args) ;
2518+ let ty = cx. tcx . type_of ( field. did ) . instantiate ( cx. tcx , args) . skip_normalization ( ) ;
25202519
25212520 // normalize the type to only show concrete types
25222521 // note: we do not use try_normalize_erasing_regions since we
@@ -2860,7 +2859,7 @@ fn clean_maybe_renamed_item<'tcx>(
28602859 }
28612860 }
28622861
2863- let ty = cx. tcx . type_of ( def_id) . instantiate_identity ( ) ;
2862+ let ty = cx. tcx . type_of ( def_id) . instantiate_identity ( ) . skip_normalization ( ) ;
28642863
28652864 let mut ret = Vec :: new ( ) ;
28662865 let inner_type = clean_ty_alias_inner_type ( ty, cx, & mut ret) ;
@@ -2992,7 +2991,7 @@ fn clean_impl<'tcx>(
29922991 let type_alias =
29932992 for_. def_id ( & cx. cache ) . and_then ( |alias_def_id : DefId | match tcx. def_kind ( alias_def_id) {
29942993 DefKind :: TyAlias => Some ( clean_middle_ty (
2995- ty:: Binder :: dummy ( tcx. type_of ( def_id) . instantiate_identity ( ) ) ,
2994+ ty:: Binder :: dummy ( tcx. type_of ( def_id) . instantiate_identity ( ) . skip_normalization ( ) ) ,
29962995 cx,
29972996 Some ( def_id. to_def_id ( ) ) ,
29982997 None ,
0 commit comments