Skip to content

Commit 1784655

Browse files
committed
Don't print bang diagnostics for derives
1 parent 27dcb4a commit 1784655

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/librustdoc/passes/collect_intra_doc_links.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -585,6 +585,9 @@ impl<'a, 'tcx> DocFolder for LinkCollector<'a, 'tcx> {
585585
} else if link.starts_with("macro@") {
586586
kind = Some(MacroNS);
587587
link.trim_start_matches("macro@")
588+
} else if link.starts_with("derive@") {
589+
kind = Some(MacroNS);
590+
link.trim_start_matches("derive@")
588591
} else if link.ends_with('!') {
589592
kind = Some(MacroNS);
590593
link.trim_end_matches('!')
@@ -954,7 +957,7 @@ fn ambiguity_error(
954957
Res::Def(DefKind::AssocFn | DefKind::Fn, _) => {
955958
("add parentheses", format!("{}()", path_str))
956959
}
957-
Res::Def(DefKind::Macro(..), _) => {
960+
Res::Def(DefKind::Macro(MacroKind::Bang), _) => {
958961
("add an exclamation mark", format!("{}!", path_str))
959962
}
960963
_ => {
@@ -968,6 +971,9 @@ fn ambiguity_error(
968971
(Res::Def(DefKind::Mod, _), _) => "module",
969972
(_, TypeNS) => "type",
970973
(_, ValueNS) => "value",
974+
(Res::Def(DefKind::Macro(MacroKind::Derive), _), MacroNS) => {
975+
"derive"
976+
}
971977
(_, MacroNS) => "macro",
972978
};
973979

0 commit comments

Comments
 (0)