Skip to content

Commit 584ede5

Browse files
committed
rustc_typeck: gate AnonConst's generics on feature(const_generics).
1 parent de30d31 commit 584ede5

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

src/librustc_typeck/collect.rs

+6-8
Original file line numberDiff line numberDiff line change
@@ -909,14 +909,12 @@ fn generics_of(tcx: TyCtxt<'_>, def_id: DefId) -> &ty::Generics {
909909
let parent_id = tcx.hir().get_parent_item(hir_id);
910910
Some(tcx.hir().local_def_id(parent_id))
911911
}
912-
// FIXME(#43408) enable this in all cases when we get lazy normalization.
913-
Node::AnonConst(&anon_const) => {
914-
// HACK(eddyb) this provides the correct generics when the workaround
915-
// for a const parameter `AnonConst` is being used elsewhere, as then
916-
// there won't be the kind of cyclic dependency blocking #43408.
917-
let expr = &tcx.hir().body(anon_const.body).value;
918-
let icx = ItemCtxt::new(tcx, def_id);
919-
if AstConv::const_param_def_id(&icx, expr).is_some() {
912+
// FIXME(#43408) enable this always when we get lazy normalization.
913+
Node::AnonConst(_) => {
914+
// HACK(eddyb) this provides the correct generics when
915+
// `feature(const_generics)` is enabled, so that const expressions
916+
// used with const generics, e.g. `Foo<{N+1}>`, can work at all.
917+
if tcx.features().const_generics {
920918
let parent_id = tcx.hir().get_parent_item(hir_id);
921919
Some(tcx.hir().local_def_id(parent_id))
922920
} else {

0 commit comments

Comments
 (0)