]> git.lizzy.rs Git - rust.git/blob - src/libsyntax/early_buffered_lints.rs
make it a migration lint
[rust.git] / src / libsyntax / early_buffered_lints.rs
1 // Copyright 2017 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
4 //
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
10
11 //! Allows the buffering of lints for later.
12 //!
13 //! Since we cannot have a dependency on `librustc`, we implement some types here that are somewhat
14 //! redundant. Later, these types can be converted to types for use by the rest of the compiler.
15
16 use syntax::ast::NodeId;
17 use syntax_pos::MultiSpan;
18
19 /// Since we cannot import `LintId`s from `rustc::lint`, we define some Ids here which can later be
20 /// passed to `rustc::lint::Lint::from_parser_lint_id` to get a `rustc::lint::Lint`.
21 pub enum BufferedEarlyLintId {
22     /// Usage of `?` as a macro separator is deprecated.
23     QuestionMarkMacroSep,
24 }
25
26 /// Stores buffered lint info which can later be passed to `librustc`.
27 pub struct BufferedEarlyLint {
28     /// The span of code that we are linting on.
29    pub span: MultiSpan,
30
31    /// The lint message.
32    pub msg: String,
33
34    /// The `NodeId` of the AST node that generated the lint.
35    pub id: NodeId,
36
37    /// A lint Id that can be passed to `rustc::lint::Lint::from_parser_lint_id`.
38    pub lint_id: BufferedEarlyLintId,
39 }