Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Extend ParseSess to support buffering lints
- Loading branch information
Showing
6 changed files
with
79 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
//! Allows the buffering of lints for later. | ||
//! | ||
//! Since we cannot have a dependency on `librustc`, we implement some types here that are somewhat | ||
//! redundant. Later, these types can be converted to types for use by the rest of the compiler. | ||
|
||
use syntax::ast::NodeId; | ||
use syntax_pos::MultiSpan; | ||
|
||
/// Since we cannot import `LintId`s from `rustc::lint`, we define some Ids here which can later be | ||
/// passed to `rustc::lint::Lint::from_parser_lint_id` to get a `rustc::lint::Lint`. | ||
pub enum BufferedEarlyLintId { | ||
/// Usage of `?` as a macro separator is deprecated. | ||
QuestionMarkMacroSep, | ||
} | ||
|
||
/// Stores buffered lint info which can later be passed to `librustc`. | ||
pub struct BufferedEarlyLint { | ||
/// The span of code that we are linting on. | ||
pub span: MultiSpan, | ||
|
||
/// The lint message. | ||
pub msg: String, | ||
|
||
/// The `NodeId` of the AST node that generated the lint. | ||
pub id: NodeId, | ||
|
||
/// A lint Id that can be passed to `rustc::lint::Lint::from_parser_lint_id`. | ||
pub lint_id: BufferedEarlyLintId, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -181,6 +181,8 @@ pub mod ext { | |
} | ||
} | ||
|
||
pub mod early_buffered_lints; | ||
|
||
#[cfg(test)] | ||
mod test_snippet; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters