Rollup merge of #89318 - petrochenkov:lstore, r=oli-obk
rustc_session: Remove lint store from `Session` It was added in https://github.com/rust-lang/rust/pull/75534, but after the cleanup in https://github.com/rust-lang/rust/pull/87070 it's no longer necessary.
This commit is contained in:
commit
d9ee68fa4c
4 changed files with 4 additions and 37 deletions
|
@ -179,7 +179,7 @@ pub fn register_plugins<'a>(
|
|||
register_lints: impl Fn(&Session, &mut LintStore),
|
||||
mut krate: ast::Crate,
|
||||
crate_name: &str,
|
||||
) -> Result<(ast::Crate, Lrc<LintStore>)> {
|
||||
) -> Result<(ast::Crate, LintStore)> {
|
||||
krate = sess.time("attributes_injection", || {
|
||||
rustc_builtin_macros::cmdline_attrs::inject(
|
||||
krate,
|
||||
|
@ -230,9 +230,6 @@ pub fn register_plugins<'a>(
|
|||
}
|
||||
});
|
||||
|
||||
let lint_store = Lrc::new(lint_store);
|
||||
sess.init_lint_store(lint_store.clone());
|
||||
|
||||
Ok((krate, lint_store))
|
||||
}
|
||||
|
||||
|
|
|
@ -135,7 +135,7 @@ impl<'tcx> Queries<'tcx> {
|
|||
let krate = self.parse()?.take();
|
||||
|
||||
let empty: &(dyn Fn(&Session, &mut LintStore) + Sync + Send) = &|_, _| {};
|
||||
let result = passes::register_plugins(
|
||||
let (krate, lint_store) = passes::register_plugins(
|
||||
self.session(),
|
||||
&*self.codegen_backend().metadata_loader(),
|
||||
self.compiler.register_lints.as_deref().unwrap_or_else(|| empty),
|
||||
|
@ -150,7 +150,7 @@ impl<'tcx> Queries<'tcx> {
|
|||
// called, which happens within passes::register_plugins().
|
||||
self.dep_graph_future().ok();
|
||||
|
||||
Ok(result)
|
||||
Ok((krate, Lrc::new(lint_store)))
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
@ -38,7 +38,6 @@ use rustc_serialize::json::Json;
|
|||
use rustc_session::lint::{BuiltinLintDiagnostics, ExternDepSpec};
|
||||
use rustc_session::lint::{FutureIncompatibleInfo, Level, Lint, LintBuffer, LintId};
|
||||
use rustc_session::Session;
|
||||
use rustc_session::SessionLintStore;
|
||||
use rustc_span::lev_distance::find_best_match_for_name;
|
||||
use rustc_span::{symbol::Symbol, MultiSpan, Span, DUMMY_SP};
|
||||
use rustc_target::abi;
|
||||
|
@ -75,20 +74,6 @@ pub struct LintStore {
|
|||
lint_groups: FxHashMap<&'static str, LintGroup>,
|
||||
}
|
||||
|
||||
impl SessionLintStore for LintStore {
|
||||
fn name_to_lint(&self, lint_name: &str) -> LintId {
|
||||
let lints = self
|
||||
.find_lints(lint_name)
|
||||
.unwrap_or_else(|_| panic!("Failed to find lint with name `{}`", lint_name));
|
||||
|
||||
if let &[lint] = lints.as_slice() {
|
||||
return lint;
|
||||
} else {
|
||||
panic!("Found mutliple lints with name `{}`: {:?}", lint_name, lints);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// The target of the `by_name` map, which accounts for renaming/deprecation.
|
||||
#[derive(Debug)]
|
||||
enum TargetLint {
|
||||
|
|
|
@ -2,10 +2,9 @@ use crate::cgu_reuse_tracker::CguReuseTracker;
|
|||
use crate::code_stats::CodeStats;
|
||||
pub use crate::code_stats::{DataTypeKind, FieldInfo, SizeKind, VariantInfo};
|
||||
use crate::config::{self, CrateType, OutputType, SwitchWithOptPath};
|
||||
use crate::filesearch;
|
||||
use crate::lint::{self, LintId};
|
||||
use crate::parse::ParseSess;
|
||||
use crate::search_paths::{PathKind, SearchPath};
|
||||
use crate::{filesearch, lint};
|
||||
|
||||
pub use rustc_ast::attr::MarkedAttrs;
|
||||
pub use rustc_ast::Attribute;
|
||||
|
@ -41,10 +40,6 @@ use std::str::FromStr;
|
|||
use std::sync::Arc;
|
||||
use std::time::Duration;
|
||||
|
||||
pub trait SessionLintStore: sync::Send + sync::Sync {
|
||||
fn name_to_lint(&self, lint_name: &str) -> LintId;
|
||||
}
|
||||
|
||||
pub struct OptimizationFuel {
|
||||
/// If `-zfuel=crate=n` is specified, initially set to `n`, otherwise `0`.
|
||||
remaining: u64,
|
||||
|
@ -153,8 +148,6 @@ pub struct Session {
|
|||
|
||||
features: OnceCell<rustc_feature::Features>,
|
||||
|
||||
lint_store: OnceCell<Lrc<dyn SessionLintStore>>,
|
||||
|
||||
incr_comp_session: OneThread<RefCell<IncrCompSession>>,
|
||||
/// Used for incremental compilation tests. Will only be populated if
|
||||
/// `-Zquery-dep-graph` is specified.
|
||||
|
@ -591,13 +584,6 @@ impl Session {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn init_lint_store(&self, lint_store: Lrc<dyn SessionLintStore>) {
|
||||
self.lint_store
|
||||
.set(lint_store)
|
||||
.map_err(|_| ())
|
||||
.expect("`lint_store` was initialized twice");
|
||||
}
|
||||
|
||||
/// Calculates the flavor of LTO to use for this compilation.
|
||||
pub fn lto(&self) -> config::Lto {
|
||||
// If our target has codegen requirements ignore the command line
|
||||
|
@ -1315,7 +1301,6 @@ pub fn build_session(
|
|||
crate_types: OnceCell::new(),
|
||||
stable_crate_id: OnceCell::new(),
|
||||
features: OnceCell::new(),
|
||||
lint_store: OnceCell::new(),
|
||||
incr_comp_session: OneThread::new(RefCell::new(IncrCompSession::NotInitialized)),
|
||||
cgu_reuse_tracker,
|
||||
prof,
|
||||
|
|
Loading…
Add table
Reference in a new issue