diff options
| author | Camille GILLOT <gillot.camille@gmail.com> | 2021-07-24 19:30:46 +0200 |
|---|---|---|
| committer | Camille GILLOT <gillot.camille@gmail.com> | 2021-07-25 12:23:37 +0200 |
| commit | f798510d02005c2bbb1269c384c321918c578f74 (patch) | |
| tree | 305a27cd3dafb23742261b063b2d52b66e55382f | |
| parent | da43aa61c1853427439d7abf46d03b381f7ab10f (diff) | |
| download | rust-f798510d02005c2bbb1269c384c321918c578f74.tar.gz rust-f798510d02005c2bbb1269c384c321918c578f74.zip | |
Only check macro attributes when checking the crate root.
| -rw-r--r-- | compiler/rustc_passes/src/check_attr.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/compiler/rustc_passes/src/check_attr.rs b/compiler/rustc_passes/src/check_attr.rs index 71231830e99..ee9057a3bab 100644 --- a/compiler/rustc_passes/src/check_attr.rs +++ b/compiler/rustc_passes/src/check_attr.rs @@ -1644,11 +1644,11 @@ fn check_invalid_macro_level_attr(tcx: TyCtxt<'_>, attrs: &[Attribute]) { fn check_mod_attrs(tcx: TyCtxt<'_>, module_def_id: LocalDefId) { let check_attr_visitor = &mut CheckAttrVisitor { tcx }; tcx.hir().visit_item_likes_in_module(module_def_id, &mut check_attr_visitor.as_deep_visitor()); - tcx.hir().visit_exported_macros_in_krate(check_attr_visitor); - check_invalid_macro_level_attr(tcx, tcx.hir().krate().non_exported_macro_attrs); if module_def_id.is_top_level_module() { check_attr_visitor.check_attributes(CRATE_HIR_ID, &DUMMY_SP, Target::Mod, None); check_invalid_crate_level_attr(tcx, tcx.hir().krate_attrs()); + tcx.hir().visit_exported_macros_in_krate(check_attr_visitor); + check_invalid_macro_level_attr(tcx, tcx.hir().krate().non_exported_macro_attrs); } } |
