Remove eval_always for lib_features.
This commit is contained in:
parent
e6d2de9483
commit
877b2d79d9
5 changed files with 5 additions and 11 deletions
|
@ -1751,7 +1751,7 @@ impl EncodeContext<'a, 'tcx> {
|
||||||
fn encode_lib_features(&mut self) -> Lazy<[(Symbol, Option<Symbol>)]> {
|
fn encode_lib_features(&mut self) -> Lazy<[(Symbol, Option<Symbol>)]> {
|
||||||
empty_proc_macro!(self);
|
empty_proc_macro!(self);
|
||||||
let tcx = self.tcx;
|
let tcx = self.tcx;
|
||||||
let lib_features = tcx.lib_features();
|
let lib_features = tcx.lib_features(());
|
||||||
self.lazy(lib_features.to_vec())
|
self.lazy(lib_features.to_vec())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1485,9 +1485,8 @@ rustc_queries! {
|
||||||
desc { |tcx| "computing crate imported by `{}`", tcx.def_path_str(def_id.to_def_id()) }
|
desc { |tcx| "computing crate imported by `{}`", tcx.def_path_str(def_id.to_def_id()) }
|
||||||
}
|
}
|
||||||
|
|
||||||
query get_lib_features(_: ()) -> LibFeatures {
|
query lib_features(_: ()) -> LibFeatures {
|
||||||
storage(ArenaCacheSelector<'tcx>)
|
storage(ArenaCacheSelector<'tcx>)
|
||||||
eval_always
|
|
||||||
desc { "calculating the lib features map" }
|
desc { "calculating the lib features map" }
|
||||||
}
|
}
|
||||||
query defined_lib_features(_: CrateNum)
|
query defined_lib_features(_: CrateNum)
|
||||||
|
|
|
@ -5,7 +5,6 @@ use crate::dep_graph::{DepGraph, DepKind, DepKindStruct};
|
||||||
use crate::hir::place::Place as HirPlace;
|
use crate::hir::place::Place as HirPlace;
|
||||||
use crate::infer::canonical::{Canonical, CanonicalVarInfo, CanonicalVarInfos};
|
use crate::infer::canonical::{Canonical, CanonicalVarInfo, CanonicalVarInfos};
|
||||||
use crate::lint::{struct_lint_level, LintDiagnosticBuilder, LintLevelSource};
|
use crate::lint::{struct_lint_level, LintDiagnosticBuilder, LintLevelSource};
|
||||||
use crate::middle;
|
|
||||||
use crate::middle::resolve_lifetime::{self, LifetimeScopeForPath, ObjectLifetimeDefault};
|
use crate::middle::resolve_lifetime::{self, LifetimeScopeForPath, ObjectLifetimeDefault};
|
||||||
use crate::middle::stability;
|
use crate::middle::stability;
|
||||||
use crate::mir::interpret::{self, Allocation, ConstValue, Scalar};
|
use crate::mir::interpret::{self, Allocation, ConstValue, Scalar};
|
||||||
|
@ -1217,10 +1216,6 @@ impl<'tcx> TyCtxt<'tcx> {
|
||||||
self.sess.consider_optimizing(&cname, msg)
|
self.sess.consider_optimizing(&cname, msg)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn lib_features(self) -> &'tcx middle::lib_features::LibFeatures {
|
|
||||||
self.get_lib_features(())
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Obtain all lang items of this crate and all dependencies (recursively)
|
/// Obtain all lang items of this crate and all dependencies (recursively)
|
||||||
pub fn lang_items(self) -> &'tcx rustc_hir::lang_items::LanguageItems {
|
pub fn lang_items(self) -> &'tcx rustc_hir::lang_items::LanguageItems {
|
||||||
self.get_lang_items(())
|
self.get_lang_items(())
|
||||||
|
|
|
@ -124,12 +124,12 @@ impl Visitor<'tcx> for LibFeatureCollector<'tcx> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_lib_features(tcx: TyCtxt<'_>, (): ()) -> LibFeatures {
|
fn lib_features(tcx: TyCtxt<'_>, (): ()) -> LibFeatures {
|
||||||
let mut collector = LibFeatureCollector::new(tcx);
|
let mut collector = LibFeatureCollector::new(tcx);
|
||||||
tcx.hir().walk_attributes(&mut collector);
|
tcx.hir().walk_attributes(&mut collector);
|
||||||
collector.lib_features
|
collector.lib_features
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn provide(providers: &mut Providers) {
|
pub fn provide(providers: &mut Providers) {
|
||||||
providers.get_lib_features = get_lib_features;
|
providers.lib_features = lib_features;
|
||||||
}
|
}
|
||||||
|
|
|
@ -970,7 +970,7 @@ pub fn check_unused_or_stable_features(tcx: TyCtxt<'_>) {
|
||||||
|
|
||||||
// We always collect the lib features declared in the current crate, even if there are
|
// We always collect the lib features declared in the current crate, even if there are
|
||||||
// no unknown features, because the collection also does feature attribute validation.
|
// no unknown features, because the collection also does feature attribute validation.
|
||||||
let local_defined_features = tcx.lib_features().to_vec();
|
let local_defined_features = tcx.lib_features(()).to_vec();
|
||||||
if !remaining_lib_features.is_empty() {
|
if !remaining_lib_features.is_empty() {
|
||||||
check_features(&mut remaining_lib_features, &local_defined_features);
|
check_features(&mut remaining_lib_features, &local_defined_features);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue