]> git.lizzy.rs Git - rust.git/blob - src/libsyntax/early_buffered_lints.rs
Add hooks for Miri panic unwinding
[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     IncompleteInclude,
15 }
16
17 /// Stores buffered lint info which can later be passed to `librustc`.
18 pub struct BufferedEarlyLint {
19     /// The span of code that we are linting on.
20    pub span: MultiSpan,
21
22    /// The lint message.
23    pub msg: String,
24
25    /// The `NodeId` of the AST node that generated the lint.
26    pub id: NodeId,
27
28    /// A lint Id that can be passed to `rustc::lint::Lint::from_parser_lint_id`.
29    pub lint_id: BufferedEarlyLintId,
30 }