File tree Expand file tree Collapse file tree 1 file changed +34
-10
lines changed
compiler/rustc_passes/src Expand file tree Collapse file tree 1 file changed +34
-10
lines changed Original file line number Diff line number Diff line change @@ -33,16 +33,40 @@ use crate::errors::{
3333// function, then we should explore its block to check for codes that
3434// may need to be marked as live.
3535fn should_explore ( tcx : TyCtxt < ' _ > , def_id : LocalDefId ) -> bool {
36- matches ! (
37- tcx. hir_node_by_def_id( def_id) ,
38- Node :: Item ( ..)
39- | Node :: ImplItem ( ..)
40- | Node :: ForeignItem ( ..)
41- | Node :: TraitItem ( ..)
42- | Node :: Variant ( ..)
43- | Node :: AnonConst ( ..)
44- | Node :: OpaqueTy ( ..)
45- )
36+ match tcx. def_kind ( def_id) {
37+ DefKind :: Mod
38+ | DefKind :: Struct
39+ | DefKind :: Union
40+ | DefKind :: Enum
41+ | DefKind :: Variant
42+ | DefKind :: Trait
43+ | DefKind :: TyAlias
44+ | DefKind :: ForeignTy
45+ | DefKind :: TraitAlias
46+ | DefKind :: AssocTy
47+ | DefKind :: Fn
48+ | DefKind :: Const
49+ | DefKind :: Static { .. }
50+ | DefKind :: AssocFn
51+ | DefKind :: AssocConst
52+ | DefKind :: Macro ( _)
53+ | DefKind :: GlobalAsm
54+ | DefKind :: Impl { .. }
55+ | DefKind :: OpaqueTy
56+ | DefKind :: AnonConst
57+ | DefKind :: InlineConst
58+ | DefKind :: ExternCrate
59+ | DefKind :: Use
60+ | DefKind :: ForeignMod => true ,
61+
62+ DefKind :: TyParam
63+ | DefKind :: ConstParam
64+ | DefKind :: Ctor ( ..)
65+ | DefKind :: Field
66+ | DefKind :: LifetimeParam
67+ | DefKind :: Closure
68+ | DefKind :: SyntheticCoroutineBody => false ,
69+ }
4670}
4771
4872/// Returns the local def id of the ADT if the given ty refers to a local one.
You can’t perform that action at this time.
0 commit comments