diff options
Diffstat (limited to 'src/librustdoc/core.rs')
| -rw-r--r-- | src/librustdoc/core.rs | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/librustdoc/core.rs b/src/librustdoc/core.rs index e89733b2f6d..b8aaafcb517 100644 --- a/src/librustdoc/core.rs +++ b/src/librustdoc/core.rs @@ -31,6 +31,7 @@ use crate::clean::inline::build_trait; use crate::clean::{self, ItemId}; use crate::config::{Options as RustdocOptions, OutputFormat, RenderOptions}; use crate::formats::cache::Cache; +use crate::html::macro_expansion::{ExpandedCode, source_macro_expansion}; use crate::passes; use crate::passes::Condition::*; use crate::passes::collect_intra_doc_links::LinkCollector; @@ -334,11 +335,19 @@ pub(crate) fn run_global_ctxt( show_coverage: bool, render_options: RenderOptions, output_format: OutputFormat, -) -> (clean::Crate, RenderOptions, Cache) { +) -> (clean::Crate, RenderOptions, Cache, FxHashMap<rustc_span::BytePos, Vec<ExpandedCode>>) { // Certain queries assume that some checks were run elsewhere // (see https://github.com/rust-lang/rust/pull/73566#issuecomment-656954425), // so type-check everything other than function bodies in this crate before running lints. + let expanded_macros = { + // We need for these variables to be removed to ensure that the `Crate` won't be "stolen" + // anymore. + let (_resolver, krate) = &*tcx.resolver_for_lowering().borrow(); + + source_macro_expansion(&krate, &render_options, output_format, tcx.sess.source_map()) + }; + // NOTE: this does not call `tcx.analysis()` so that we won't // typeck function bodies or run the default rustc lints. // (see `override_queries` in the `config`) @@ -448,7 +457,7 @@ pub(crate) fn run_global_ctxt( tcx.dcx().abort_if_errors(); - (krate, ctxt.render_options, ctxt.cache) + (krate, ctxt.render_options, ctxt.cache, expanded_macros) } /// Due to <https://github.com/rust-lang/rust/pull/73566>, |
