Skip to content

Commit b0c6d6a

Browse files
Fix tools
1 parent 020a391 commit b0c6d6a

File tree

4 files changed

+11
-13
lines changed

4 files changed

+11
-13
lines changed

src/librustdoc/clean/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1859,7 +1859,7 @@ impl Clean<Vec<Item>> for (&hir::Item<'_>, Option<Symbol>) {
18591859
ItemKind::Fn(ref sig, ref generics, body_id) => {
18601860
clean_fn_or_proc_macro(item, sig, generics, body_id, &mut name, cx)
18611861
}
1862-
ItemKind::Macro { ref macro_def, .. } => MacroItem(Macro {
1862+
ItemKind::Macro(ref macro_def) => MacroItem(Macro {
18631863
source: display_macro_source(cx, name, &macro_def.ast, def_id, &item.vis),
18641864
imported_from: None,
18651865
}),

src/librustdoc/doctest.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1172,11 +1172,15 @@ impl<'a, 'hir, 'tcx> intravisit::Visitor<'hir> for HirCollector<'a, 'hir, 'tcx>
11721172

11731173
fn visit_item(&mut self, item: &'hir hir::Item<'_>) {
11741174
let name = match &item.kind {
1175-
hir::ItemKind::Macro { is_exported: false, .. } => {
1175+
hir::ItemKind::Macro(ref macro_def) => {
11761176
// FIXME(#88038): Non exported macros have historically not been tested,
11771177
// but we really ought to start testing them.
1178-
intravisit::walk_item(self, item);
1179-
return;
1178+
let def_id = item.def_id.to_def_id();
1179+
if macro_def.ast.macro_rules && !self.tcx.has_attr(def_id, sym::macro_export) {
1180+
intravisit::walk_item(self, item);
1181+
return;
1182+
}
1183+
item.ident.to_string()
11801184
}
11811185
hir::ItemKind::Impl(impl_) => {
11821186
rustc_hir_pretty::id_to_string(&self.map, impl_.self_ty.hir_id)

src/librustdoc/visit_ast.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> {
283283
hir::ItemKind::Mod(ref m) => {
284284
om.mods.push(self.visit_mod_contents(&item.vis, item.hir_id(), m, name));
285285
}
286-
hir::ItemKind::Macro { ref macro_def, .. } => {
286+
hir::ItemKind::Macro(ref macro_def) => {
287287
// `#[macro_export] macro_rules!` items are handled seperately in `visit()`,
288288
// above, since they need to be documented at the module top level. Accordingly,
289289
// we only want to handle macros if one of three conditions holds:

src/tools/clippy/clippy_lints/src/utils/inspector.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -408,16 +408,10 @@ fn print_item(cx: &LateContext<'_>, item: &hir::Item<'_>) {
408408
},
409409
hir::ItemKind::Mod(..) => println!("module"),
410410
hir::ItemKind::ForeignMod { abi, .. } => println!("foreign module with abi: {}", abi),
411-
hir::ItemKind::Macro { ref macro_def, .. } => {
411+
hir::ItemKind::Macro(ref macro_def) => {
412412
if macro_def.ast.macro_rules {
413-
if macro_def.is_exported {
414-
println!("exported macro introduced by `macro_rules!`");
415-
} else {
416-
println!("nonexported macro introduced by `macro_rules!`");
417-
}
413+
println!("macro introduced by `macro_rules!`");
418414
} else {
419-
// There's no point in distinguishing exported and nonexported `macro`
420-
// macros. That's defined their visibility, which was printed above.
421415
println!("macro introduced by `macro`");
422416
}
423417
}

0 commit comments

Comments
 (0)