@@ -167,7 +167,7 @@ fn gather_explicit_predicates_of(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::Gen
167167 }
168168 }
169169 ItemKind :: Trait ( _, _, _, _, _, self_bounds, ..)
170- | ItemKind :: TraitAlias ( _, _, self_bounds) => {
170+ | ItemKind :: TraitAlias ( _, _, _ , self_bounds) => {
171171 is_trait = Some ( ( self_bounds, item. span ) ) ;
172172 }
173173 _ => { }
@@ -654,7 +654,7 @@ pub(super) fn implied_predicates_with_filter<'tcx>(
654654
655655 let ( generics, superbounds) = match item. kind {
656656 hir:: ItemKind :: Trait ( .., generics, supertraits, _) => ( generics, supertraits) ,
657- hir:: ItemKind :: TraitAlias ( _, generics, supertraits) => ( generics, supertraits) ,
657+ hir:: ItemKind :: TraitAlias ( _, _ , generics, supertraits) => ( generics, supertraits) ,
658658 _ => span_bug ! ( item. span, "super_predicates invoked on non-trait" ) ,
659659 } ;
660660
@@ -1032,7 +1032,10 @@ pub(super) fn const_conditions<'tcx>(
10321032 hir:: ItemKind :: Impl ( impl_) => ( impl_. generics , None , false ) ,
10331033 hir:: ItemKind :: Fn { generics, .. } => ( generics, None , false ) ,
10341034 hir:: ItemKind :: Trait ( _, _, _, _, generics, supertraits, _) => {
1035- ( generics, Some ( ( item. owner_id . def_id , supertraits) ) , false )
1035+ ( generics, Some ( ( Some ( item. owner_id . def_id ) , supertraits) ) , false )
1036+ }
1037+ hir:: ItemKind :: TraitAlias ( _, _, generics, supertraits) => {
1038+ ( generics, Some ( ( None , supertraits) ) , false )
10361039 }
10371040 _ => bug ! ( "const_conditions called on wrong item: {def_id:?}" ) ,
10381041 } ,
@@ -1089,12 +1092,14 @@ pub(super) fn const_conditions<'tcx>(
10891092 }
10901093
10911094 if let Some ( ( def_id, supertraits) ) = trait_def_id_and_supertraits {
1092- // We've checked above that the trait is conditionally const.
1093- bounds. push ( (
1094- ty:: Binder :: dummy ( ty:: TraitRef :: identity ( tcx, def_id. to_def_id ( ) ) )
1095- . to_host_effect_clause ( tcx, ty:: BoundConstness :: Maybe ) ,
1096- DUMMY_SP ,
1097- ) ) ;
1095+ if let Some ( def_id) = def_id {
1096+ // We've checked above that the trait is conditionally const.
1097+ bounds. push ( (
1098+ ty:: Binder :: dummy ( ty:: TraitRef :: identity ( tcx, def_id. to_def_id ( ) ) )
1099+ . to_host_effect_clause ( tcx, ty:: BoundConstness :: Maybe ) ,
1100+ DUMMY_SP ,
1101+ ) ) ;
1102+ }
10981103
10991104 icx. lowerer ( ) . lower_bounds (
11001105 tcx. types . self_param ,
@@ -1143,13 +1148,14 @@ pub(super) fn explicit_implied_const_bounds<'tcx>(
11431148 span_bug ! ( tcx. def_span( def_id) , "RPITIT in impl should not have item bounds" )
11441149 }
11451150 None => match tcx. hir_node_by_def_id ( def_id) {
1146- Node :: Item ( hir:: Item { kind : hir:: ItemKind :: Trait ( ..) , .. } ) => {
1147- implied_predicates_with_filter (
1148- tcx,
1149- def_id. to_def_id ( ) ,
1150- PredicateFilter :: SelfConstIfConst ,
1151- )
1152- }
1151+ Node :: Item ( hir:: Item {
1152+ kind : hir:: ItemKind :: Trait ( ..) | hir:: ItemKind :: TraitAlias ( ..) ,
1153+ ..
1154+ } ) => implied_predicates_with_filter (
1155+ tcx,
1156+ def_id. to_def_id ( ) ,
1157+ PredicateFilter :: SelfConstIfConst ,
1158+ ) ,
11531159 Node :: TraitItem ( hir:: TraitItem { kind : hir:: TraitItemKind :: Type ( ..) , .. } )
11541160 | Node :: OpaqueTy ( _) => {
11551161 explicit_item_bounds_with_filter ( tcx, def_id, PredicateFilter :: ConstIfConst )
0 commit comments