Skip to content

Commit 6943228

Browse files
committed
Auto merge of rust-lang#15834 - lnicola:derive-docs, r=lnicola
fix: Fix docs path for derive macros Fixes rust-lang#15831. Not sure about `attr`, I don't think those are documented anyway. And many macros don't work because we pick the wrong path.
2 parents 0fec61a + 19bf0da commit 6943228

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

crates/ide/src/doc_links.rs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -602,7 +602,17 @@ fn filename_and_frag_for_def(
602602
}
603603
Definition::Const(c) => format!("const.{}.html", c.name(db)?.display(db.upcast())),
604604
Definition::Static(s) => format!("static.{}.html", s.name(db).display(db.upcast())),
605-
Definition::Macro(mac) => format!("macro.{}.html", mac.name(db).display(db.upcast())),
605+
Definition::Macro(mac) => match mac.kind(db) {
606+
hir::MacroKind::Declarative
607+
| hir::MacroKind::BuiltIn
608+
| hir::MacroKind::Attr
609+
| hir::MacroKind::ProcMacro => {
610+
format!("macro.{}.html", mac.name(db).display(db.upcast()))
611+
}
612+
hir::MacroKind::Derive => {
613+
format!("derive.{}.html", mac.name(db).display(db.upcast()))
614+
}
615+
},
606616
Definition::Field(field) => {
607617
let def = match field.parent_def(db) {
608618
hir::VariantDef::Struct(it) => Definition::Adt(it.into()),

0 commit comments

Comments
 (0)