Skip to content

Commit ac5f433

Browse files
authored
Rollup merge of rust-lang#83230 - jyn514:remove-macros, r=joshtriplett
Remove unnecessary `forward_inner_docs` hack and replace it with `extended_key_value_attributes` feature. This is rust-lang#79150, but for compiler/.
2 parents edd22d7 + bb7c04a commit ac5f433

File tree

2 files changed

+7
-15
lines changed

2 files changed

+7
-15
lines changed

compiler/rustc_errors/src/diagnostic_builder.rs

+6-15
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,6 @@ struct DiagnosticBuilderInner<'a> {
3030
allow_suggestions: bool,
3131
}
3232

33-
/// This is a helper macro for [`forward!`] that allows automatically adding documentation
34-
/// that uses tokens from [`forward!`]'s input.
35-
macro_rules! forward_inner_docs {
36-
($e:expr => $i:item) => {
37-
#[doc = $e]
38-
$i
39-
};
40-
}
41-
4233
/// In general, the `DiagnosticBuilder` uses deref to allow access to
4334
/// the fields and methods of the embedded `diagnostic` in a
4435
/// transparent way. *However,* many of the methods are intended to
@@ -54,11 +45,11 @@ macro_rules! forward {
5445
pub fn $n:ident(&self, $($name:ident: $ty:ty),* $(,)?) -> &Self
5546
) => {
5647
$(#[$attrs])*
57-
forward_inner_docs!(concat!("See [`Diagnostic::", stringify!($n), "()`].") =>
48+
#[doc = concat!("See [`Diagnostic::", stringify!($n), "()`].")]
5849
pub fn $n(&self, $($name: $ty),*) -> &Self {
5950
self.diagnostic.$n($($name),*);
6051
self
61-
});
52+
}
6253
};
6354

6455
// Forward pattern for &mut self -> &mut Self
@@ -67,11 +58,11 @@ macro_rules! forward {
6758
pub fn $n:ident(&mut self, $($name:ident: $ty:ty),* $(,)?) -> &mut Self
6859
) => {
6960
$(#[$attrs])*
70-
forward_inner_docs!(concat!("See [`Diagnostic::", stringify!($n), "()`].") =>
61+
#[doc = concat!("See [`Diagnostic::", stringify!($n), "()`].")]
7162
pub fn $n(&mut self, $($name: $ty),*) -> &mut Self {
7263
self.0.diagnostic.$n($($name),*);
7364
self
74-
});
65+
}
7566
};
7667

7768
// Forward pattern for &mut self -> &mut Self, with generic parameters.
@@ -84,11 +75,11 @@ macro_rules! forward {
8475
) -> &mut Self
8576
) => {
8677
$(#[$attrs])*
87-
forward_inner_docs!(concat!("See [`Diagnostic::", stringify!($n), "()`].") =>
78+
#[doc = concat!("See [`Diagnostic::", stringify!($n), "()`].")]
8879
pub fn $n<$($generic: $bound),*>(&mut self, $($name: $ty),*) -> &mut Self {
8980
self.0.diagnostic.$n($($name),*);
9081
self
91-
});
82+
}
9283
};
9384
}
9485

compiler/rustc_errors/src/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
66
#![feature(crate_visibility_modifier)]
77
#![feature(backtrace)]
8+
#![feature(extended_key_value_attributes)]
89
#![feature(nll)]
910

1011
#[macro_use]

0 commit comments

Comments
 (0)