diff options
| author | Karol Zwolak <karolzwolak7@gmail.com> | 2025-04-28 09:21:10 +0200 |
|---|---|---|
| committer | Karol Zwolak <karolzwolak7@gmail.com> | 2025-08-19 21:27:10 +0200 |
| commit | 9a29e1693d5122990dcd6c87a5a7b2b2b85f10da (patch) | |
| tree | c432161cb7aaeb9df6c1661ed5b48810cef5a475 /compiler/rustc_session | |
| parent | 16ad385579cebb6f7d53367c552661b6b51a4a02 (diff) | |
| download | rust-9a29e1693d5122990dcd6c87a5a7b2b2b85f10da.tar.gz rust-9a29e1693d5122990dcd6c87a5a7b2b2b85f10da.zip | |
mention lint group in default level lint note
Diffstat (limited to 'compiler/rustc_session')
| -rw-r--r-- | compiler/rustc_session/src/session.rs | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/compiler/rustc_session/src/session.rs b/compiler/rustc_session/src/session.rs index c8f4b511a7e..bb7ffa2a85d 100644 --- a/compiler/rustc_session/src/session.rs +++ b/compiler/rustc_session/src/session.rs @@ -44,6 +44,7 @@ use crate::config::{ SwitchWithOptPath, }; use crate::filesearch::FileSearch; +use crate::lint::LintId; use crate::parse::{ParseSess, add_feature_diagnostics}; use crate::search_paths::SearchPath; use crate::{errors, filesearch, lint}; @@ -139,7 +140,10 @@ pub struct CompilerIO { pub temps_dir: Option<PathBuf>, } -pub trait LintStoreMarker: Any + DynSync + DynSend {} +pub trait DynLintStore: Any + DynSync + DynSend { + /// Provides a way to access lint groups without depending on `rustc_lint` + fn lint_groups_iter(&self) -> Box<dyn Iterator<Item = LintGroup> + '_>; +} /// Represents the data associated with a compilation /// session for a single crate. @@ -164,7 +168,7 @@ pub struct Session { pub code_stats: CodeStats, /// This only ever stores a `LintStore` but we don't want a dependency on that type here. - pub lint_store: Option<Arc<dyn LintStoreMarker>>, + pub lint_store: Option<Arc<dyn DynLintStore>>, /// Cap lint level specified by a driver specifically. pub driver_lint_caps: FxHashMap<lint::LintId, lint::Level>, @@ -240,6 +244,12 @@ impl CodegenUnits { } } +pub struct LintGroup { + pub name: &'static str, + pub lints: Vec<LintId>, + pub is_externally_loaded: bool, +} + impl Session { pub fn miri_unleashed_feature(&self, span: Span, feature_gate: Option<Symbol>) { self.miri_unleashed_features.lock().push((span, feature_gate)); @@ -596,6 +606,13 @@ impl Session { (&*self.target.staticlib_prefix, &*self.target.staticlib_suffix) } } + + pub fn lint_groups_iter(&self) -> Box<dyn Iterator<Item = LintGroup> + '_> { + match self.lint_store { + Some(ref lint_store) => lint_store.lint_groups_iter(), + None => Box::new(std::iter::empty()), + } + } } // JUSTIFICATION: defn of the suggested wrapper fns |
