diff options
| author | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2025-02-18 18:07:14 +0100 |
|---|---|---|
| committer | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2025-08-23 00:57:28 +0200 |
| commit | f8ce37621ae83f1323a83f833ab2abecdc20a0ba (patch) | |
| tree | 7ddd757ee755e897d1ab6fa3de58704655bdc2ad /src/librustdoc/html/render/span_map.rs | |
| parent | ba3099f60b25437b7a871a3dfe7aa71bf867cd90 (diff) | |
| download | rust-f8ce37621ae83f1323a83f833ab2abecdc20a0ba.tar.gz rust-f8ce37621ae83f1323a83f833ab2abecdc20a0ba.zip | |
Add new unstable `--generate-macro-expansion` rustdoc command line flag
Diffstat (limited to 'src/librustdoc/html/render/span_map.rs')
| -rw-r--r-- | src/librustdoc/html/render/span_map.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/librustdoc/html/render/span_map.rs b/src/librustdoc/html/render/span_map.rs index 842da838049..10969188dc7 100644 --- a/src/librustdoc/html/render/span_map.rs +++ b/src/librustdoc/html/render/span_map.rs @@ -60,6 +60,7 @@ pub(crate) fn collect_spans_and_sources( src_root: &Path, include_sources: bool, generate_link_to_definition: bool, + generate_macro_expansion: bool, ) -> ( FxIndexMap<PathBuf, String>, FxHashMap<Span, LinkFromSrc>, @@ -69,7 +70,9 @@ pub(crate) fn collect_spans_and_sources( let mut visitor = SpanMapVisitor { tcx, matches: FxHashMap::default() }; let mut expanded_visitor = ExpandedCodeVisitor { tcx, expanded_codes: Vec::new() }; - tcx.hir_walk_toplevel_module(&mut expanded_visitor); + if generate_macro_expansion { + tcx.hir_walk_toplevel_module(&mut expanded_visitor); + } if generate_link_to_definition { tcx.hir_walk_toplevel_module(&mut visitor); } @@ -350,10 +353,7 @@ impl<'tcx> ExpandedCodeVisitor<'tcx> { } } else { // We add a new item. - self.expanded_codes.push(ExpandedCodeInfo { - span: new_span, - code: f(self.tcx), - }); + self.expanded_codes.push(ExpandedCodeInfo { span: new_span, code: f(self.tcx) }); } } |
