@@ -6,7 +6,7 @@ use crate::hair::*;
66use crate :: hair:: util:: UserAnnotatedTyHelpers ;
77
88use rustc_data_structures:: indexed_vec:: Idx ;
9- use rustc:: hir:: def_id:: { DefId , LOCAL_CRATE } ;
9+ use rustc:: hir:: def_id:: DefId ;
1010use rustc:: hir:: Node ;
1111use rustc:: middle:: region;
1212use rustc:: infer:: InferCtxt ;
@@ -76,11 +76,10 @@ impl<'a, 'gcx, 'tcx> Cx<'a, 'gcx, 'tcx> {
7676 // Constants always need overflow checks.
7777 check_overflow |= constness == hir:: Constness :: Const ;
7878
79- let lint_level = lint_level_for_hir_id ( tcx, src_id) ;
8079 Cx {
8180 tcx,
8281 infcx,
83- root_lint_level : lint_level ,
82+ root_lint_level : src_id ,
8483 param_env : tcx. param_env ( src_def_id) ,
8584 identity_substs : InternalSubsts :: identity_for_item ( tcx. global_tcx ( ) , src_def_id) ,
8685 region_scope_tree : tcx. region_scope_tree ( src_def_id) ,
@@ -197,18 +196,6 @@ impl<'a, 'gcx, 'tcx> Cx<'a, 'gcx, 'tcx> {
197196 ty. needs_drop ( self . tcx . global_tcx ( ) , param_env)
198197 }
199198
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-
212199 pub fn tcx ( & self ) -> TyCtxt < ' a , ' gcx , ' tcx > {
213200 self . tcx
214201 }
@@ -236,30 +223,6 @@ impl UserAnnotatedTyHelpers<'gcx, 'tcx> for Cx<'_, 'gcx, 'tcx> {
236223 }
237224}
238225
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-
263226mod block;
264227mod expr;
265228mod to_ref;
0 commit comments