Update lint_levels

This commit is contained in:
John Kåre Alsaker 2018-11-30 21:01:50 +01:00
parent 5bcc80be10
commit 9dcc60b081
3 changed files with 5 additions and 4 deletions

View File

@ -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);
)
}

View File

@ -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> {

View File

@ -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" }
}