@@ -90,7 +90,7 @@ use rustc_errors::Applicability;
9090use rustc_errors:: Diagnostic ;
9191use rustc_hir as hir;
9292use rustc_hir:: def:: * ;
93- use rustc_hir:: def_id:: { DefId , LocalDefId } ;
93+ use rustc_hir:: def_id:: LocalDefId ;
9494use rustc_hir:: intravisit:: { self , Visitor } ;
9595use rustc_hir:: { Expr , HirId , HirIdMap , HirIdSet } ;
9696use rustc_index:: vec:: IndexVec ;
@@ -137,27 +137,22 @@ fn live_node_kind_to_string(lnk: LiveNodeKind, tcx: TyCtxt<'_>) -> String {
137137 }
138138}
139139
140- fn check_liveness ( tcx : TyCtxt < ' _ > , def_id : DefId ) {
141- let local_def_id = match def_id. as_local ( ) {
142- None => return ,
143- Some ( def_id) => def_id,
144- } ;
145-
140+ fn check_liveness ( tcx : TyCtxt < ' _ > , def_id : LocalDefId ) {
146141 // Don't run unused pass for #[derive()]
147- let parent = tcx. local_parent ( local_def_id ) ;
142+ let parent = tcx. local_parent ( def_id ) ;
148143 if let DefKind :: Impl { .. } = tcx. def_kind ( parent)
149144 && tcx. has_attr ( parent, sym:: automatically_derived)
150145 {
151146 return ;
152147 }
153148
154149 // Don't run unused pass for #[naked]
155- if tcx. has_attr ( def_id, sym:: naked) {
150+ if tcx. has_attr ( def_id. to_def_id ( ) , sym:: naked) {
156151 return ;
157152 }
158153
159154 let mut maps = IrMaps :: new ( tcx) ;
160- let body_id = tcx. hir ( ) . body_owned_by ( local_def_id ) ;
155+ let body_id = tcx. hir ( ) . body_owned_by ( def_id ) ;
161156 let hir_id = tcx. hir ( ) . body_owner ( body_id) ;
162157 let body = tcx. hir ( ) . body ( body_id) ;
163158
@@ -173,7 +168,7 @@ fn check_liveness(tcx: TyCtxt<'_>, def_id: DefId) {
173168 maps. visit_body ( body) ;
174169
175170 // compute liveness
176- let mut lsets = Liveness :: new ( & mut maps, local_def_id ) ;
171+ let mut lsets = Liveness :: new ( & mut maps, def_id ) ;
177172 let entry_ln = lsets. compute ( & body, hir_id) ;
178173 lsets. log_liveness ( entry_ln, body_id. hir_id ) ;
179174
0 commit comments