Merge pull request #1619 from Techcable/fix/mir_passes

Fix compilation on latest nightly
This commit is contained in:
Oliver Schneider 2017-03-13 11:30:02 +01:00 committed by GitHub
commit d77dc1f281
3 changed files with 15 additions and 2 deletions

View file

@ -58,6 +58,10 @@ impl EarlyLintPass for ItemsAfterStatements {
if in_macro(cx, it.span) {
return;
}
if let ItemKind::MacroDef(..) = it.node {
// do not lint `macro_rules`, but continue processing further statements
continue;
}
span_lint(cx,
ITEMS_AFTER_STATEMENTS,
it.span,

View file

@ -89,7 +89,6 @@ impl<'a> CompilerCalls<'a> for ClippyCompilerCalls {
lint_groups,
llvm_passes,
attributes,
mir_passes,
.. } = registry;
let sess = &state.session;
let mut ls = sess.lint_store.borrow_mut();
@ -105,7 +104,6 @@ impl<'a> CompilerCalls<'a> for ClippyCompilerCalls {
}
sess.plugin_llvm_passes.borrow_mut().extend(llvm_passes);
sess.mir_passes.borrow_mut().extend(mir_passes);
sess.plugin_attributes.borrow_mut().extend(attributes);
}
old(state);

View file

@ -17,3 +17,14 @@ fn main() {
fn foo() { println!("foo"); }
foo();
}
fn mac() {
let mut a = 5;
println!("{}", a);
// do not lint this, because it needs to be after `a`
macro_rules! b {
() => {{ a = 6 }}
}
b!();
println!("{}", a);
}