diff options
| author | Jubilee <workingjubilee@gmail.com> | 2024-10-26 21:58:40 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-10-26 21:58:40 -0700 |
| commit | b3ac6d339cff41a8b8ab40bffdcb712f22f20192 (patch) | |
| tree | 9fe9465a507826512c36fb6b42789025a48d18ff /src/librustdoc/html/format.rs | |
| parent | b80593995d5d149d6bb622bbdf0a3e180e2ada69 (diff) | |
| parent | b93a2dd0efeb00238543fd199ebdb8bb0f96bad7 (diff) | |
| download | rust-b3ac6d339cff41a8b8ab40bffdcb712f22f20192.tar.gz rust-b3ac6d339cff41a8b8ab40bffdcb712f22f20192.zip | |
Rollup merge of #132192 - petrochenkov:macfa, r=compiler-errors
expand: Stop using artificial `ast::Item` for macros loaded from metadata You don't need a full `Item` for that, and not using a piece of AST helps with https://github.com/rust-lang/rust/pull/131808.
Diffstat (limited to 'src/librustdoc/html/format.rs')
| -rw-r--r-- | src/librustdoc/html/format.rs | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/librustdoc/html/format.rs b/src/librustdoc/html/format.rs index ea2f930ab83..8e8e5c6ade8 100644 --- a/src/librustdoc/html/format.rs +++ b/src/librustdoc/html/format.rs @@ -16,6 +16,7 @@ use itertools::Itertools; use rustc_attr::{ConstStability, StabilityLevel, StableSince}; use rustc_data_structures::captures::Captures; use rustc_data_structures::fx::FxHashSet; +use rustc_hir as hir; use rustc_hir::def::DefKind; use rustc_hir::def_id::{DefId, LOCAL_CRATE}; use rustc_metadata::creader::{CStore, LoadedMacro}; @@ -25,7 +26,6 @@ use rustc_span::symbol::kw; use rustc_span::{Symbol, sym}; use rustc_target::spec::abi::Abi; use tracing::{debug, trace}; -use {rustc_ast as ast, rustc_hir as hir}; use super::url_parts_builder::{UrlPartsBuilder, estimate_item_path_byte_length}; use crate::clean::types::ExternalLocation; @@ -554,10 +554,8 @@ fn generate_macro_def_id_path( // Check to see if it is a macro 2.0 or built-in macro. // More information in <https://rust-lang.github.io/rfcs/1584-macros.html>. let is_macro_2 = match cstore.load_macro_untracked(def_id, tcx) { - LoadedMacro::MacroDef(def, _) => { - // If `ast_def.macro_rules` is `true`, then it's not a macro 2.0. - matches!(&def.kind, ast::ItemKind::MacroDef(ast_def) if !ast_def.macro_rules) - } + // If `def.macro_rules` is `true`, then it's not a macro 2.0. + LoadedMacro::MacroDef { def, .. } => !def.macro_rules, _ => false, }; |
