Skip to content
Permalink
Browse files

Update lint_levels

  • Loading branch information...
Zoxc committed Nov 30, 2018
1 parent 5bcc80b commit 9dcc60b08171c1c10379595df8b6a379b0007c0b
Showing with 5 additions and 4 deletions.
  1. +1 −0 src/librustc/arena.rs
  2. +3 −3 src/librustc/lint/mod.rs
  3. +1 −1 src/librustc/query/mod.rs
@@ -78,6 +78,7 @@ macro_rules! arena_types {
>,
[few] resolve_lifetimes: rustc::middle::resolve_lifetime::ResolveLifetimes,
[decode] generic_predicates: rustc::ty::GenericPredicates<'tcx>,
[few] lint_levels: rustc::lint::LintLevelMap,
], $tcx);
)
}
@@ -21,7 +21,7 @@
pub use self::Level::*;
pub use self::LintSource::*;

use rustc_data_structures::sync::{self, Lrc};
use rustc_data_structures::sync;

use crate::hir::def_id::{CrateNum, LOCAL_CRATE};
use crate::hir::intravisit;
@@ -767,7 +767,7 @@ pub fn maybe_lint_level_root(tcx: TyCtxt<'_, '_, '_>, id: hir::HirId) -> bool {
}

fn lint_levels<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, cnum: CrateNum)
-> Lrc<LintLevelMap>
-> &'tcx LintLevelMap
{
assert_eq!(cnum, LOCAL_CRATE);
let mut builder = LintLevelMapBuilder {
@@ -784,7 +784,7 @@ fn lint_levels<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, cnum: CrateNum)
intravisit::walk_crate(&mut builder, krate);
builder.levels.pop(push);

Lrc::new(builder.levels.build_map())
tcx.arena.alloc(builder.levels.build_map())
}

struct LintLevelMapBuilder<'a, 'tcx: 'a> {
@@ -67,7 +67,7 @@ rustc_queries! {
desc { "looking up the native libraries of a linked crate" }
}

query lint_levels(_: CrateNum) -> Lrc<lint::LintLevelMap> {
query lint_levels(_: CrateNum) -> &'tcx lint::LintLevelMap {
eval_always
desc { "computing the lint levels for items in this crate" }
}

0 comments on commit 9dcc60b

Please sign in to comment.
You can’t perform that action at this time.