diff --git a/src/librustc_typeck/collect.rs b/src/librustc_typeck/collect.rs index 652f081e1761c..301b0ff350302 100644 --- a/src/librustc_typeck/collect.rs +++ b/src/librustc_typeck/collect.rs @@ -909,14 +909,12 @@ fn generics_of(tcx: TyCtxt<'_>, def_id: DefId) -> &ty::Generics { let parent_id = tcx.hir().get_parent_item(hir_id); Some(tcx.hir().local_def_id(parent_id)) } - // FIXME(#43408) enable this in all cases when we get lazy normalization. - Node::AnonConst(&anon_const) => { - // HACK(eddyb) this provides the correct generics when the workaround - // for a const parameter `AnonConst` is being used elsewhere, as then - // there won't be the kind of cyclic dependency blocking #43408. - let expr = &tcx.hir().body(anon_const.body).value; - let icx = ItemCtxt::new(tcx, def_id); - if AstConv::const_param_def_id(&icx, expr).is_some() { + // FIXME(#43408) enable this always when we get lazy normalization. + Node::AnonConst(_) => { + // HACK(eddyb) this provides the correct generics when + // `feature(const_generics)` is enabled, so that const expressions + // used with const generics, e.g. `Foo<{N+1}>`, can work at all. + if tcx.features().const_generics { let parent_id = tcx.hir().get_parent_item(hir_id); Some(tcx.hir().local_def_id(parent_id)) } else {