@@ -90,7 +90,7 @@ use rustc_errors::Applicability;
90
90
use rustc_errors:: Diagnostic ;
91
91
use rustc_hir as hir;
92
92
use rustc_hir:: def:: * ;
93
- use rustc_hir:: def_id:: { DefId , LocalDefId } ;
93
+ use rustc_hir:: def_id:: LocalDefId ;
94
94
use rustc_hir:: intravisit:: { self , Visitor } ;
95
95
use rustc_hir:: { Expr , HirId , HirIdMap , HirIdSet } ;
96
96
use rustc_index:: vec:: IndexVec ;
@@ -137,27 +137,22 @@ fn live_node_kind_to_string(lnk: LiveNodeKind, tcx: TyCtxt<'_>) -> String {
137
137
}
138
138
}
139
139
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 ) {
146
141
// Don't run unused pass for #[derive()]
147
- let parent = tcx. local_parent ( local_def_id ) ;
142
+ let parent = tcx. local_parent ( def_id ) ;
148
143
if let DefKind :: Impl { .. } = tcx. def_kind ( parent)
149
144
&& tcx. has_attr ( parent, sym:: automatically_derived)
150
145
{
151
146
return ;
152
147
}
153
148
154
149
// 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) {
156
151
return ;
157
152
}
158
153
159
154
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 ) ;
161
156
let hir_id = tcx. hir ( ) . body_owner ( body_id) ;
162
157
let body = tcx. hir ( ) . body ( body_id) ;
163
158
@@ -173,7 +168,7 @@ fn check_liveness(tcx: TyCtxt<'_>, def_id: DefId) {
173
168
maps. visit_body ( body) ;
174
169
175
170
// compute liveness
176
- let mut lsets = Liveness :: new ( & mut maps, local_def_id ) ;
171
+ let mut lsets = Liveness :: new ( & mut maps, def_id ) ;
177
172
let entry_ln = lsets. compute ( & body, hir_id) ;
178
173
lsets. log_liveness ( entry_ln, body_id. hir_id ) ;
179
174
0 commit comments