Skip to content

Commit e8c25f2

Browse files
committed
Auto merge of rust-lang#87836 - tsoutsman:master, r=petrochenkov
Change proc_macro::Diagnostics docs With Rust 1.54 attributes can invoke function-like macros. This allows functions generated by macros to have non-generic documentation. This pull request changes the documentation of `proc_macro::Diagnostics` to be more specific and include a link to the level. ## Example Before: ```markdown Adds a new child diagnostic message to `self` with the level identified by this method’s name with the given `message`. ``` After: ```markdown Adds a new child diagnostic message to self with the [`Level::Error`] level, and the given `message`. ```
2 parents c4c2986 + 26bf0ef commit e8c25f2

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

library/proc_macro/src/diagnostic.rs

+4-5
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,9 @@ pub struct Diagnostic {
5656

5757
macro_rules! diagnostic_child_methods {
5858
($spanned:ident, $regular:ident, $level:expr) => {
59-
/// Adds a new child diagnostic message to `self` with the level
60-
/// identified by this method's name with the given `spans` and
61-
/// `message`.
6259
#[unstable(feature = "proc_macro_diagnostic", issue = "54140")]
60+
#[doc = concat!("Adds a new child diagnostics message to `self` with the [`",
61+
stringify!($level), "`] level, and the given `spans` and `message`.")]
6362
pub fn $spanned<S, T>(mut self, spans: S, message: T) -> Diagnostic
6463
where
6564
S: MultiSpan,
@@ -69,9 +68,9 @@ macro_rules! diagnostic_child_methods {
6968
self
7069
}
7170

72-
/// Adds a new child diagnostic message to `self` with the level
73-
/// identified by this method's name with the given `message`.
7471
#[unstable(feature = "proc_macro_diagnostic", issue = "54140")]
72+
#[doc = concat!("Adds a new child diagnostic message to `self` with the [`",
73+
stringify!($level), "`] level, and the given `message`.")]
7574
pub fn $regular<T: Into<String>>(mut self, message: T) -> Diagnostic {
7675
self.children.push(Diagnostic::new($level, message));
7776
self

0 commit comments

Comments
 (0)