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 {
16
16
}
17
17
18
18
impl 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> {
22
20
match *self {
23
- ImplContainer(id) => id ,
24
- _ => bug!("associated item has wrong container type: {:?}", self) ,
21
+ ImplContainer(id) => Some(id) ,
22
+ _ => None ,
25
23
}
26
24
}
27
25
Original file line number Diff line number Diff line change @@ -1293,7 +1293,12 @@ pub fn check_type_bounds<'tcx>(
1293
1293
1294
1294
tcx.infer_ctxt().enter(move |infcx| {
1295
1295
// 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
+
1297
1302
let pred_map = match constness {
1298
1303
hir::Constness::NotConst => |p, _| p,
1299
1304
hir::Constness::Const => |p: ty::Predicate<'tcx>, tcx: TyCtxt<'tcx>| {
You can’t perform that action at this time.
0 commit comments