about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume.gomez@huawei.com>2023-03-17 11:56:10 +0100
committerGuillaume Gomez <guillaume.gomez@huawei.com>2023-03-17 11:56:10 +0100
commit5b7b91c2f4fe640917a68edbd1122ed55bec1e19 (patch)
treea78b4ebd6f0998aa54a071273d07855cb8a575ff /src
parent24c0b81c1fd5de8e00276524896d3352ed91a8cb (diff)
downloadrust-5b7b91c2f4fe640917a68edbd1122ed55bec1e19.tar.gz
rust-5b7b91c2f4fe640917a68edbd1122ed55bec1e19.zip
Only add into `view_item_stack` if the item will be inlined
Diffstat (limited to 'src')
-rw-r--r--src/librustdoc/visit_ast.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/librustdoc/visit_ast.rs b/src/librustdoc/visit_ast.rs
index e09a68069e8..060062db002 100644
--- a/src/librustdoc/visit_ast.rs
+++ b/src/librustdoc/visit_ast.rs
@@ -265,10 +265,6 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> {
             return false;
         }
 
-        if !self.view_item_stack.insert(res_did) {
-            return false;
-        }
-
         if !please_inline &&
             let mut visitor = OneLevelVisitor::new(self.cx.tcx.hir(), res_did) &&
             let Some(item) = visitor.find_target(self.cx.tcx, def_id.to_def_id(), path) &&
@@ -285,6 +281,10 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> {
             return false;
         }
 
+        if !self.view_item_stack.insert(res_did) {
+            return false;
+        }
+
         let ret = match tcx.hir().get_by_def_id(res_did) {
             Node::Item(&hir::Item { kind: hir::ItemKind::Mod(ref m), .. }) if glob => {
                 let prev = mem::replace(&mut self.inlining, true);