Rollup merge of #82563 - lucas-deangelis:issue-82209-fix, r=jyn514
Fix intra-doc handling of `Self` in enum Fixes #82209
This commit is contained in:
commit
b5f5c106c0
@ -838,6 +838,14 @@ fn fold_item(&mut self, mut item: Item) -> Option<Item> {
|
||||
debug!("looking for the `Self` type");
|
||||
let self_id = if item.is_fake() {
|
||||
None
|
||||
// Checking if the item is a field in an enum variant
|
||||
} else if (matches!(self.cx.tcx.def_kind(item.def_id), DefKind::Field)
|
||||
&& matches!(
|
||||
self.cx.tcx.def_kind(self.cx.tcx.parent(item.def_id).unwrap()),
|
||||
DefKind::Variant
|
||||
))
|
||||
{
|
||||
self.cx.tcx.parent(item.def_id).and_then(|item_id| self.cx.tcx.parent(item_id))
|
||||
} else if matches!(
|
||||
self.cx.tcx.def_kind(item.def_id),
|
||||
DefKind::AssocConst
|
||||
|
11
src/test/rustdoc/intra-doc/issue-82209.rs
Normal file
11
src/test/rustdoc/intra-doc/issue-82209.rs
Normal file
@ -0,0 +1,11 @@
|
||||
#![crate_name = "foo"]
|
||||
#![deny(broken_intra_doc_links)]
|
||||
pub enum Foo {
|
||||
Bar {
|
||||
abc: i32,
|
||||
/// [Self::Bar::abc]
|
||||
xyz: i32,
|
||||
},
|
||||
}
|
||||
|
||||
// @has foo/enum.Foo.html '//a/@href' '../foo/enum.Foo.html#variant.Bar.field.abc'
|
Loading…
Reference in New Issue
Block a user