]> git.lizzy.rs Git - rust.git/blob - src/libsyntax/early_buffered_lints.rs
Rollup merge of #64229 - kawa-yoiko:unreachable-call-lint, r=estebank
[rust.git] / src / libsyntax / early_buffered_lints.rs
1 //! Allows the buffering of lints for later.
2 //!
3 //! Since we cannot have a dependency on `librustc`, we implement some types here that are somewhat
4 //! redundant. Later, these types can be converted to types for use by the rest of the compiler.
5
6 use crate::ast::NodeId;
7 use syntax_pos::MultiSpan;
8
9 /// Since we cannot import `LintId`s from `rustc::lint`, we define some Ids here which can later be
10 /// passed to `rustc::lint::Lint::from_parser_lint_id` to get a `rustc::lint::Lint`.
11 pub enum BufferedEarlyLintId {
12     IllFormedAttributeInput,
13     MetaVariableMisuse,
14 }
15
16 /// Stores buffered lint info which can later be passed to `librustc`.
17 pub struct BufferedEarlyLint {
18     /// The span of code that we are linting on.
19    pub span: MultiSpan,
20
21    /// The lint message.
22    pub msg: String,
23
24    /// The `NodeId` of the AST node that generated the lint.
25    pub id: NodeId,
26
27    /// A lint Id that can be passed to `rustc::lint::Lint::from_parser_lint_id`.
28    pub lint_id: BufferedEarlyLintId,
29 }