diff options
| author | Ellen <supbscripter@gmail.com> | 2021-08-07 20:55:37 +0100 |
|---|---|---|
| committer | Ellen <supbscripter@gmail.com> | 2021-08-07 20:55:37 +0100 |
| commit | 5f61271e382cfab7159a6dedcf673cafaab51e5a (patch) | |
| tree | 00f5d0c0e33afc4213a286ce6b28ff94a8000de2 | |
| parent | d777cb84e2d27a5f44eab94854b74fea33034bb4 (diff) | |
| download | rust-5f61271e382cfab7159a6dedcf673cafaab51e5a.tar.gz rust-5f61271e382cfab7159a6dedcf673cafaab51e5a.zip | |
fmt
| -rw-r--r-- | compiler/rustc_typeck/src/collect/type_of.rs | 6 | ||||
| -rw-r--r-- | src/test/ui/const-generics/enum-variants.rs | 2 |
2 files changed, 4 insertions, 4 deletions
diff --git a/compiler/rustc_typeck/src/collect/type_of.rs b/compiler/rustc_typeck/src/collect/type_of.rs index 7083b11f7d0..b9483d6f987 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 a82db1c4b32..5c6c4a8efac 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<const N: usize> { +enum Foo<const N: usize> { Variant, Variant2(), Variant3{}, |
