diff --git a/compiler/rustc_typeck/src/collect/type_of.rs b/compiler/rustc_typeck/src/collect/type_of.rs index 7083b11f7d0ac..b9483d6f98760 100644 --- a/compiler/rustc_typeck/src/collect/type_of.rs +++ b/compiler/rustc_typeck/src/collect/type_of.rs @@ -192,9 +192,9 @@ pub(super) fn opt_const_param_of(tcx: TyCtxt<'_>, def_id: LocalDefId) -> Option< let res = segment.res.filter(|&r| r != Res::Err).unwrap_or(path.res); use def::CtorOf; let generics = match res { - Res::Def(DefKind::Ctor(CtorOf::Variant, _), def_id) => { - tcx.generics_of(tcx.parent(def_id).and_then(|def_id| tcx.parent(def_id)).unwrap()) - } + Res::Def(DefKind::Ctor(CtorOf::Variant, _), def_id) => tcx.generics_of( + tcx.parent(def_id).and_then(|def_id| tcx.parent(def_id)).unwrap(), + ), Res::Def(DefKind::Variant | DefKind::Ctor(CtorOf::Struct, _), def_id) => { tcx.generics_of(tcx.parent(def_id).unwrap()) } diff --git a/src/test/ui/const-generics/enum-variants.rs b/src/test/ui/const-generics/enum-variants.rs index a82db1c4b3217..5c6c4a8efac15 100644 --- a/src/test/ui/const-generics/enum-variants.rs +++ b/src/test/ui/const-generics/enum-variants.rs @@ -1,5 +1,5 @@ // check-pass -pub enum Foo { +enum Foo { Variant, Variant2(), Variant3{},