diff options
| author | Dylan DPC <99973273+Dylan-DPC@users.noreply.github.com> | 2022-04-15 20:50:45 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-04-15 20:50:45 +0200 |
| commit | bdbf0998f3e6f323b680594cad66c7e792c861f4 (patch) | |
| tree | 816e48cc90e8dcf3b606e90803a075add14afd99 /src/librustdoc/html/render | |
| parent | a32e0f3041e4a480f4201f9817e5ec352897dc55 (diff) | |
| parent | 8c2353b6c142d5665006cf79cbec511f666dbed2 (diff) | |
| download | rust-bdbf0998f3e6f323b680594cad66c7e792c861f4.tar.gz rust-bdbf0998f3e6f323b680594cad66c7e792c861f4.zip | |
Rollup merge of #95194 - kckeiks:update-algo-in-find-use-placement, r=pnkfelix
remove find_use_placement A more robust solution to finding where to place use suggestions was added in #94584. The algorithm uses the AST to find the span for the suggestion so we pass this span down to the HIR during lowering and use it instead of calling `find_use_placement` Fixes #94941
Diffstat (limited to 'src/librustdoc/html/render')
| -rw-r--r-- | src/librustdoc/html/render/span_map.rs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/librustdoc/html/render/span_map.rs b/src/librustdoc/html/render/span_map.rs index 731e18b1eec..06c63ec97d7 100644 --- a/src/librustdoc/html/render/span_map.rs +++ b/src/librustdoc/html/render/span_map.rs @@ -119,11 +119,14 @@ impl<'tcx> Visitor<'tcx> for SpanMapVisitor<'tcx> { fn visit_mod(&mut self, m: &'tcx Mod<'tcx>, span: Span, id: HirId) { // To make the difference between "mod foo {}" and "mod foo;". In case we "import" another // file, we want to link to it. Otherwise no need to create a link. - if !span.overlaps(m.inner) { + if !span.overlaps(m.spans.inner_span) { // Now that we confirmed it's a file import, we want to get the span for the module // name only and not all the "mod foo;". if let Some(Node::Item(item)) = self.tcx.hir().find(id) { - self.matches.insert(item.ident.span, LinkFromSrc::Local(clean::Span::new(m.inner))); + self.matches.insert( + item.ident.span, + LinkFromSrc::Local(clean::Span::new(m.spans.inner_span)), + ); } } intravisit::walk_mod(self, m, id); |
