@@ -6,7 +6,7 @@ use crate::hair::*;
6
6
use crate :: hair:: util:: UserAnnotatedTyHelpers ;
7
7
8
8
use rustc_data_structures:: indexed_vec:: Idx ;
9
- use rustc:: hir:: def_id:: { DefId , LOCAL_CRATE } ;
9
+ use rustc:: hir:: def_id:: DefId ;
10
10
use rustc:: hir:: Node ;
11
11
use rustc:: middle:: region;
12
12
use rustc:: infer:: InferCtxt ;
@@ -76,11 +76,10 @@ impl<'a, 'gcx, 'tcx> Cx<'a, 'gcx, 'tcx> {
76
76
// Constants always need overflow checks.
77
77
check_overflow |= constness == hir:: Constness :: Const ;
78
78
79
- let lint_level = lint_level_for_hir_id ( tcx, src_id) ;
80
79
Cx {
81
80
tcx,
82
81
infcx,
83
- root_lint_level : lint_level ,
82
+ root_lint_level : src_id ,
84
83
param_env : tcx. param_env ( src_def_id) ,
85
84
identity_substs : InternalSubsts :: identity_for_item ( tcx. global_tcx ( ) , src_def_id) ,
86
85
region_scope_tree : tcx. region_scope_tree ( src_def_id) ,
@@ -197,18 +196,6 @@ impl<'a, 'gcx, 'tcx> Cx<'a, 'gcx, 'tcx> {
197
196
ty. needs_drop ( self . tcx . global_tcx ( ) , param_env)
198
197
}
199
198
200
- fn lint_level_of ( & self , hir_id : hir:: HirId ) -> LintLevel {
201
- let has_lint_level = self . tcx . dep_graph . with_ignore ( || {
202
- self . tcx . lint_levels ( LOCAL_CRATE ) . lint_level_set ( hir_id) . is_some ( )
203
- } ) ;
204
-
205
- if has_lint_level {
206
- LintLevel :: Explicit ( hir_id)
207
- } else {
208
- LintLevel :: Inherited
209
- }
210
- }
211
-
212
199
pub fn tcx ( & self ) -> TyCtxt < ' a , ' gcx , ' tcx > {
213
200
self . tcx
214
201
}
@@ -236,30 +223,6 @@ impl UserAnnotatedTyHelpers<'gcx, 'tcx> for Cx<'_, 'gcx, 'tcx> {
236
223
}
237
224
}
238
225
239
- fn lint_level_for_hir_id ( tcx : TyCtxt < ' _ , ' _ , ' _ > , mut id : hir:: HirId ) -> hir:: HirId {
240
- // Right now we insert a `with_ignore` node in the dep graph here to
241
- // ignore the fact that `lint_levels` below depends on the entire crate.
242
- // For now this'll prevent false positives of recompiling too much when
243
- // anything changes.
244
- //
245
- // Once red/green incremental compilation lands we should be able to
246
- // remove this because while the crate changes often the lint level map
247
- // will change rarely.
248
- tcx. dep_graph . with_ignore ( || {
249
- let sets = tcx. lint_levels ( LOCAL_CRATE ) ;
250
- loop {
251
- if sets. lint_level_set ( id) . is_some ( ) {
252
- return id
253
- }
254
- let next = tcx. hir ( ) . get_parent_node_by_hir_id ( id) ;
255
- if next == id {
256
- bug ! ( "lint traversal reached the root of the crate" ) ;
257
- }
258
- id = next;
259
- }
260
- } )
261
- }
262
-
263
226
mod block;
264
227
mod expr;
265
228
mod to_ref;
0 commit comments