diff --git a/src/librustdoc/formats/cache.rs b/src/librustdoc/formats/cache.rs index b1db16cfe3ca..d25824a88ee8 100644 --- a/src/librustdoc/formats/cache.rs +++ b/src/librustdoc/formats/cache.rs @@ -287,6 +287,10 @@ impl<'a, 'tcx> DocFolder for CacheBuilder<'a, 'tcx> { } else { let last = self.cache.parent_stack.last().expect("parent_stack is empty 2"); let did = match &*last { + ParentStackItem::Impl { + for_: clean::Type::BorrowedRef { type_, .. }, + .. + } => type_.def_id(&self.cache), ParentStackItem::Impl { for_, .. } => for_.def_id(&self.cache), ParentStackItem::Type(item_id) => item_id.as_def_id(), }; diff --git a/tests/rustdoc-js-std/reference-shrink.js b/tests/rustdoc-js-std/reference-shrink.js new file mode 100644 index 000000000000..f90be6d1bfd3 --- /dev/null +++ b/tests/rustdoc-js-std/reference-shrink.js @@ -0,0 +1,8 @@ +// exact-check + +const QUERY = 'reference::shrink'; + +const EXPECTED = { + // avoid including the method that's not going to be in the HTML + 'others': [], +};