diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:18:58 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:18:58 +0000 |
commit | a4b7ed7a42c716ab9f05e351f003d589124fd55d (patch) | |
tree | b620cd3f223850b28716e474e80c58059dca5dd4 /compiler/rustc_lint_defs/src/lib.rs | |
parent | Adding upstream version 1.67.1+dfsg1. (diff) | |
download | rustc-a4b7ed7a42c716ab9f05e351f003d589124fd55d.tar.xz rustc-a4b7ed7a42c716ab9f05e351f003d589124fd55d.zip |
Adding upstream version 1.68.2+dfsg1.upstream/1.68.2+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'compiler/rustc_lint_defs/src/lib.rs')
-rw-r--r-- | compiler/rustc_lint_defs/src/lib.rs | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/compiler/rustc_lint_defs/src/lib.rs b/compiler/rustc_lint_defs/src/lib.rs index aa54b3d8a..7054d1e9f 100644 --- a/compiler/rustc_lint_defs/src/lib.rs +++ b/compiler/rustc_lint_defs/src/lib.rs @@ -6,8 +6,9 @@ extern crate rustc_macros; pub use self::Level::*; -use rustc_ast::node_id::{NodeId, NodeMap}; +use rustc_ast::node_id::NodeId; use rustc_ast::{AttrId, Attribute}; +use rustc_data_structures::fx::FxIndexMap; use rustc_data_structures::stable_hasher::{HashStable, StableHasher, ToStableHashKey}; use rustc_error_messages::{DiagnosticMessage, MultiSpan}; use rustc_hir::HashStableContext; @@ -253,6 +254,19 @@ impl Level { } } + pub fn to_cmd_flag(self) -> &'static str { + match self { + Level::Warn => "-W", + Level::Deny => "-D", + Level::Forbid => "-F", + Level::Allow => "-A", + Level::ForceWarn(_) => "--force-warn", + Level::Expect(_) => { + unreachable!("the expect level does not have a commandline flag") + } + } + } + pub fn is_error(self) -> bool { match self { Level::Allow | Level::Expect(_) | Level::Warn | Level::ForceWarn(_) => false, @@ -489,7 +503,7 @@ pub enum BuiltinLintDiagnostics { param_span: Span, /// Span of the code that should be removed when eliding this lifetime. /// This span should include leading or trailing comma. - deletion_span: Span, + deletion_span: Option<Span>, /// Span of the single use, or None if the lifetime is never used. /// If true, the lifetime will be fully elided. use_span: Option<(Span, bool)>, @@ -531,7 +545,7 @@ pub struct BufferedEarlyLint { #[derive(Default)] pub struct LintBuffer { - pub map: NodeMap<Vec<BufferedEarlyLint>>, + pub map: FxIndexMap<NodeId, Vec<BufferedEarlyLint>>, } impl LintBuffer { |