Note: The actual variant matched seems to be irrelevant, the significant part is the ::<N>. This does not need any feature flags, and adding either min_const_generics or const_generics does not fix it.
rustc 1.51.0-nightly (158f8d034 2020-12-29)
binary: rustc
commit-hash: 158f8d034b15e65ba8dc0d066358dd0632bfcd6e
commit-date: 2020-12-29
host: x86_64-pc-windows-msvc
release: 1.51.0-nightly
error: internal compiler error: unexpected const parent in type_of_def_id(): Pat(Pat { hir_id: HirId { owner: DefId(0:11 ~ consts[4055]::foo), local_id: 15 }, kind: TupleStruct(Resolved(None, Path { span: src\main.rs:10:12: 10:38 (#0), res: Def(Ctor(Variant, Fn), DefId(0:6 ~ consts[4055]::ConstGenericEnum::Foo::{constructor#0})), segments: [PathSegment { ident: ConstGenericEnum#0, hir_id: Some(HirId { owner: DefId(0:11 ~ consts[4055]::foo), local_id: 12 }), res: Some(Def(Enum, DefId(0:3 ~ consts[4055]::ConstGenericEnum))), args: Some(GenericArgs { args: [Const(ConstArg { value: AnonConst { hir_id: HirId { owner: DefId(0:11 ~ consts[4055]::foo), local_id: 9 }, body: BodyId { hir_id: HirId { owner: DefId(0:11 ~ consts[4055]::foo), local_id: 11 } } }, span: src\main.rs:10:31: 10:32 (#0) })], bindings: [], parenthesized: false }), infer_args: false }, PathSegment { ident: Foo#0, hir_id: Some(HirId { owner: DefId(0:11 ~ consts[4055]::foo), local_id: 13 }), res: Some(Err), args: None, infer_args: true }] }), [Pat { hir_id: HirId { owner: DefId(0:11 ~ consts[4055]::foo), local_id: 14 }, kind: Binding(Unannotated, HirId { owner: DefId(0:11 ~ consts[4055]::foo), local_id: 14 }, field#0, None), span: src\main.rs:10:39: 10:44 (#0), default_binding_modes: true }], Some(1)), span: src\main.rs:10:12: 10:49 (#0), default_binding_modes: true })
|
= note: delayed at compiler\rustc_typeck\src\collect\type_of.rs:334:26
error: internal compiler error: TyKind::Error constructed but no error reported
|
= note: delayed at compiler\rustc_typeck\src\check\coercion.rs:153:49
error: internal compiler error: TyKind::Error constructed but no error reported
|
= note: delayed at compiler\rustc_mir_build\src\build\mod.rs:696:18
error: internal compiler error: mir_const_qualif: MIR had errors
--> src\main.rs:10:31
|
10 | if let ConstGenericEnum::<N>::Foo(field, ..) = val {
| ^
|
= note: delayed at compiler\rustc_mir\src\transform\mod.rs:230:18
error: internal compiler error: PromoteTemps: MIR had errors
--> src\main.rs:10:31
|
10 | if let ConstGenericEnum::<N>::Foo(field, ..) = val {
| ^
|
= note: delayed at compiler\rustc_mir\src\transform\promote_consts.rs:55:22
error: internal compiler error: broken MIR in DefId(0:14 ~ consts[4055]::foo::{constant#0}) ("return type"): bad type [type error]
--> src\main.rs:10:31
|
10 | if let ConstGenericEnum::<N>::Foo(field, ..) = val {
| ^
|
= note: delayed at compiler\rustc_mir\src\borrow_check\type_check\mod.rs:253:27
error: internal compiler error: TyKind::Error constructed but no error reported
|
= note: delayed at compiler\rustc_mir\src\borrow_check\type_check\mod.rs:715:20
error: internal compiler error: broken MIR in DefId(0:14 ~ consts[4055]::foo::{constant#0}) (LocalDecl { mutability: Mut, local_info: None, internal: false, is_block_tail: None, ty: [type error], user_ty: None, source_info: SourceInfo { span: src\main.rs:10:31: 10:32 (#0), scope: scope[0] } }): bad type [type error]
--> src\main.rs:10:31
|
10 | if let ConstGenericEnum::<N>::Foo(field, ..) = val {
| ^
|
= note: delayed at compiler\rustc_mir\src\borrow_check\type_check\mod.rs:253:27
Code
Note: The actual variant matched seems to be irrelevant, the significant part is the
::<N>. This does not need any feature flags, and adding eithermin_const_genericsorconst_genericsdoes not fix it.Meta
rustc --version --verbose:Error output
Backtrace