about summary refs log tree commit diff
diff options
context:
space:
mode:
authorDeadbeef <ent3rm4n@gmail.com>2021-12-01 23:33:37 +0800
committerDeadbeef <ent3rm4n@gmail.com>2021-12-01 23:33:37 +0800
commit5ebc99e5b29a36150dfe090b4ac17d241debfb36 (patch)
tree55fa1f3a5154d2559c848ae9262c3917cbd9fcb6
parentb64c40bc6f4ced6e418fe89d6754c86e5841f714 (diff)
downloadrust-5ebc99e5b29a36150dfe090b4ac17d241debfb36.tar.gz
rust-5ebc99e5b29a36150dfe090b4ac17d241debfb36.zip
Format
-rw-r--r--compiler/rustc_ty_utils/src/ty.rs32
1 files changed, 26 insertions, 6 deletions
diff --git a/compiler/rustc_ty_utils/src/ty.rs b/compiler/rustc_ty_utils/src/ty.rs
index f47f8a562dd..c20c81e41cc 100644
--- a/compiler/rustc_ty_utils/src/ty.rs
+++ b/compiler/rustc_ty_utils/src/ty.rs
@@ -290,11 +290,20 @@ fn param_env(tcx: TyCtxt<'_>, def_id: DefId) -> ty::ParamEnv<'_> {
         Some(hir_id) => match tcx.hir().get(hir_id) {
             hir::Node::Item(hir::Item { kind: hir::ItemKind::Const(..), .. })
             | hir::Node::Item(hir::Item { kind: hir::ItemKind::Static(..), .. })
-            | hir::Node::TraitItem(hir::TraitItem { kind: hir::TraitItemKind::Const(..), .. })
+            | hir::Node::TraitItem(hir::TraitItem {
+                kind: hir::TraitItemKind::Const(..), ..
+            })
             | hir::Node::AnonConst(_)
             | hir::Node::ImplItem(hir::ImplItem { kind: hir::ImplItemKind::Const(..), .. })
             | hir::Node::ImplItem(hir::ImplItem {
-                kind: hir::ImplItemKind::Fn(hir::FnSig { header: hir::FnHeader { constness: hir::Constness::Const, .. }, .. }, ..),
+                kind:
+                    hir::ImplItemKind::Fn(
+                        hir::FnSig {
+                            header: hir::FnHeader { constness: hir::Constness::Const, .. },
+                            ..
+                        },
+                        ..,
+                    ),
                 ..
             }) => hir::Constness::Const,
 
@@ -304,7 +313,10 @@ fn param_env(tcx: TyCtxt<'_>, def_id: DefId) -> ty::ParamEnv<'_> {
             }) => {
                 let parent_hir_id = tcx.hir().get_parent_node(hir_id);
                 match tcx.hir().get(parent_hir_id) {
-                    hir::Node::Item(hir::Item { kind: hir::ItemKind::Impl(hir::Impl { constness, .. }), .. }) => *constness,
+                    hir::Node::Item(hir::Item {
+                        kind: hir::ItemKind::Impl(hir::Impl { constness, .. }),
+                        ..
+                    }) => *constness,
                     _ => span_bug!(
                         tcx.def_span(parent_hir_id.owner),
                         "impl item's parent node is not an impl",
@@ -313,14 +325,22 @@ fn param_env(tcx: TyCtxt<'_>, def_id: DefId) -> ty::ParamEnv<'_> {
             }
 
             hir::Node::Item(hir::Item {
-                kind: hir::ItemKind::Fn(hir::FnSig { header: hir::FnHeader { constness, .. }, .. }, ..),
+                kind:
+                    hir::ItemKind::Fn(hir::FnSig { header: hir::FnHeader { constness, .. }, .. }, ..),
                 ..
             })
             | hir::Node::TraitItem(hir::TraitItem {
-                kind: hir::TraitItemKind::Fn(hir::FnSig { header: hir::FnHeader { constness, .. }, .. }, ..),
+                kind:
+                    hir::TraitItemKind::Fn(
+                        hir::FnSig { header: hir::FnHeader { constness, .. }, .. },
+                        ..,
+                    ),
                 ..
             })
-            | hir::Node::Item(hir::Item { kind: hir::ItemKind::Impl(hir::Impl { constness, .. }), .. }) => *constness,
+            | hir::Node::Item(hir::Item {
+                kind: hir::ItemKind::Impl(hir::Impl { constness, .. }),
+                ..
+            }) => *constness,
 
             _ => hir::Constness::NotConst,
         },