Skip to content

Commit

Permalink
Merge pull request #1619 from Techcable/fix/mir_passes
Browse files Browse the repository at this point in the history
Fix compilation on latest nightly
  • Loading branch information
oli-obk authored Mar 13, 2017
2 parents b48243c + 2d145b2 commit d77dc1f
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
4 changes: 4 additions & 0 deletions clippy_lints/src/items_after_statements.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 0 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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);
Expand Down
11 changes: 11 additions & 0 deletions tests/ui/item_after_statement.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

0 comments on commit d77dc1f

Please sign in to comment.