diff options
| author | bors <bors@rust-lang.org> | 2021-07-19 04:22:51 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2021-07-19 04:22:51 +0000 |
| commit | 0ecff8c623fa29cccad6f946c657e81dacd85847 (patch) | |
| tree | 55544579cafd394ca22ccd8cd8ab7179c39ed57f /compiler/rustc_mir/src/transform/coverage/graph.rs | |
| parent | 10c0b003dbfee812788ac9f753a9b28bb3996b26 (diff) | |
| parent | 1c1c7949ab6a8d4150b7e645ae4779677e86ebd1 (diff) | |
| download | rust-0ecff8c623fa29cccad6f946c657e81dacd85847.tar.gz rust-0ecff8c623fa29cccad6f946c657e81dacd85847.zip | |
Auto merge of #87146 - Aaron1011:better-macro-lint, r=petrochenkov
Compute a better `lint_node_id` during expansion When we need to emit a lint at a macro invocation, we currently use the `NodeId` of its parent definition (e.g. the enclosing function). This means that any `#[allow]` / `#[deny]` attributes placed 'closer' to the macro (e.g. on an enclosing block or statement) will have no effect. This commit computes a better `lint_node_id` in `InvocationCollector`. When we visit/flat_map an AST node, we assign it a `NodeId` (earlier than we normally would), and store than `NodeId` in current `ExpansionData`. When we collect a macro invocation, the current `lint_node_id` gets cloned along with our `ExpansionData`, allowing it to be used if we need to emit a lint later on. This improves the handling of `#[allow]` / `#[deny]` for `SEMICOLON_IN_EXPRESSIONS_FROM_MACROS` and some `asm!`-related lints. The 'legacy derive helpers' lint retains its current behavior (I've inlined the now-removed `lint_node_id` function), since there isn't an `ExpansionData` readily available.
Diffstat (limited to 'compiler/rustc_mir/src/transform/coverage/graph.rs')
0 files changed, 0 insertions, 0 deletions
