File tree Expand file tree Collapse file tree 2 files changed +9
-6
lines changed Expand file tree Collapse file tree 2 files changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -16,12 +16,10 @@ pub enum AssocItemContainer {
1616}
1717
1818impl AssocItemContainer {
19- /// Asserts that this is the `DefId` of an associated item declared
20- /// in an impl, and returns the trait `DefId`.
21- pub fn assert_impl ( & self ) -> DefId {
19+ pub fn impl_def_id ( & self ) -> Option < DefId > {
2220 match * self {
23- ImplContainer ( id) => id ,
24- _ => bug ! ( "associated item has wrong container type: {:?}" , self ) ,
21+ ImplContainer ( id) => Some ( id ) ,
22+ _ => None ,
2523 }
2624 }
2725
Original file line number Diff line number Diff line change @@ -1293,7 +1293,12 @@ pub fn check_type_bounds<'tcx>(
12931293
12941294 tcx. infer_ctxt ( ) . enter ( move |infcx| {
12951295 // if the item is inside a const impl, we transform the predicates to be const.
1296- let constness = tcx. impl_constness ( impl_ty. container . assert_impl ( ) ) ;
1296+ let constness = impl_ty
1297+ . container
1298+ . impl_def_id ( )
1299+ . map ( |did| tcx. impl_constness ( did) )
1300+ . unwrap_or ( hir:: Constness :: NotConst ) ;
1301+
12971302 let pred_map = match constness {
12981303 hir:: Constness :: NotConst => |p, _| p,
12991304 hir:: Constness :: Const => |p : ty:: Predicate < ' tcx > , tcx : TyCtxt < ' tcx > | {
You can’t perform that action at this time.
0 commit comments