forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of rust-lang#4185 - mikerite:outer_expn_info, r=Manishearth
Add OUTER_EXPN_INFO lint changelog: none
- Loading branch information
Showing
5 changed files
with
99 additions
and
1 deletion.
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,23 @@ | ||
#![deny(clippy::internal)] | ||
#![feature(rustc_private)] | ||
|
||
#[macro_use] | ||
extern crate rustc; | ||
use rustc::hir::Expr; | ||
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; | ||
|
||
declare_lint! { | ||
pub TEST_LINT, | ||
Warn, | ||
"" | ||
} | ||
|
||
declare_lint_pass!(Pass => [TEST_LINT]); | ||
|
||
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass { | ||
fn check_expr(&mut self, _cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) { | ||
let _ = expr.span.ctxt().outer().expn_info(); | ||
} | ||
} | ||
|
||
fn main() {} |
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,15 @@ | ||
error: usage of `outer().expn_info()` | ||
--> $DIR/outer_expn_info.rs:19:33 | ||
| | ||
LL | let _ = expr.span.ctxt().outer().expn_info(); | ||
| ^^^^^^^^^^^^^^^^^^^^ help: try: `.outer_expn_info()` | ||
| | ||
note: lint level defined here | ||
--> $DIR/outer_expn_info.rs:1:9 | ||
| | ||
LL | #![deny(clippy::internal)] | ||
| ^^^^^^^^^^^^^^^^ | ||
= note: #[deny(clippy::outer_expn_info)] implied by #[deny(clippy::internal)] | ||
|
||
error: aborting due to previous error | ||
|