Skip to content

Commit

Permalink
Auto merge of rust-lang#91330 - cjgillot:no-ee-features, r=Aaron1011
Browse files Browse the repository at this point in the history
Remove eval_always for lib_features.

r? `@Aaron1011`
  • Loading branch information
bors committed Nov 30, 2021
2 parents 4c94896 + 877b2d7 commit 90912e6
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 11 deletions.
2 changes: 1 addition & 1 deletion compiler/rustc_metadata/src/rmeta/encoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1749,7 +1749,7 @@ impl EncodeContext<'a, 'tcx> {
fn encode_lib_features(&mut self) -> Lazy<[(Symbol, Option<Symbol>)]> {
empty_proc_macro!(self);
let tcx = self.tcx;
let lib_features = tcx.lib_features();
let lib_features = tcx.lib_features(());
self.lazy(lib_features.to_vec())
}

Expand Down
3 changes: 1 addition & 2 deletions compiler/rustc_middle/src/query/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1485,9 +1485,8 @@ rustc_queries! {
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>)
eval_always
desc { "calculating the lib features map" }
}
query defined_lib_features(_: CrateNum)
Expand Down
5 changes: 0 additions & 5 deletions compiler/rustc_middle/src/ty/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ use crate::dep_graph::{DepGraph, DepKind, DepKindStruct};
use crate::hir::place::Place as HirPlace;
use crate::infer::canonical::{Canonical, CanonicalVarInfo, CanonicalVarInfos};
use crate::lint::{struct_lint_level, LintDiagnosticBuilder, LintLevelSource};
use crate::middle;
use crate::middle::resolve_lifetime::{self, LifetimeScopeForPath, ObjectLifetimeDefault};
use crate::middle::stability;
use crate::mir::interpret::{self, Allocation, ConstValue, Scalar};
Expand Down Expand Up @@ -1217,10 +1216,6 @@ impl<'tcx> TyCtxt<'tcx> {
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)
pub fn lang_items(self) -> &'tcx rustc_hir::lang_items::LanguageItems {
self.get_lang_items(())
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_passes/src/lib_features.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
tcx.hir().walk_attributes(&mut collector);
collector.lib_features
}

pub fn provide(providers: &mut Providers) {
providers.get_lib_features = get_lib_features;
providers.lib_features = lib_features;
}
2 changes: 1 addition & 1 deletion compiler/rustc_passes/src/stability.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
// 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() {
check_features(&mut remaining_lib_features, &local_defined_features);

Expand Down

0 comments on commit 90912e6

Please sign in to comment.