@@ -1031,9 +1031,11 @@ pub(super) fn const_conditions<'tcx>(
10311031 Node :: Item ( item) => match item. kind {
10321032 hir:: ItemKind :: Impl ( impl_) => ( impl_. generics , None , false ) ,
10331033 hir:: ItemKind :: Fn { generics, .. } => ( generics, None , false ) ,
1034- hir:: ItemKind :: TraitAlias ( _, _, generics, supertraits)
1035- | hir:: ItemKind :: Trait ( _, _, _, _, generics, supertraits, _) => {
1036- ( generics, Some ( ( item. owner_id . def_id , supertraits) ) , false )
1034+ hir:: ItemKind :: Trait ( _, _, _, _, generics, supertraits, _) => {
1035+ ( generics, Some ( ( Some ( item. owner_id . def_id ) , supertraits) ) , false )
1036+ }
1037+ hir:: ItemKind :: TraitAlias ( _, _, generics, supertraits) => {
1038+ ( generics, Some ( ( None , supertraits) ) , false )
10371039 }
10381040 _ => bug ! ( "const_conditions called on wrong item: {def_id:?}" ) ,
10391041 } ,
@@ -1090,12 +1092,14 @@ pub(super) fn const_conditions<'tcx>(
10901092 }
10911093
10921094 if let Some ( ( def_id, supertraits) ) = trait_def_id_and_supertraits {
1093- // We've checked above that the trait is conditionally const.
1094- bounds. push ( (
1095- ty:: Binder :: dummy ( ty:: TraitRef :: identity ( tcx, def_id. to_def_id ( ) ) )
1096- . to_host_effect_clause ( tcx, ty:: BoundConstness :: Maybe ) ,
1097- DUMMY_SP ,
1098- ) ) ;
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+ }
10991103
11001104 icx. lowerer ( ) . lower_bounds (
11011105 tcx. types . self_param ,
0 commit comments