diff options
| author | Mazdak Farrokhzad <twingoow@gmail.com> | 2019-01-19 14:21:23 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-01-19 14:21:23 +0100 |
| commit | e78bde401524a430290dd5e5f1fc404422f8be2e (patch) | |
| tree | 6b4848d00a16a6df28c16e8f5fea3c29a21ef33c /src/librustc_errors | |
| parent | c8c03afa5762624b37877c00485a5b0ca0d07797 (diff) | |
| parent | 02843d9eb71ad50d490afc6276f4bfe59f182624 (diff) | |
| download | rust-e78bde401524a430290dd5e5f1fc404422f8be2e.tar.gz rust-e78bde401524a430290dd5e5f1fc404422f8be2e.zip | |
Rollup merge of #57699 - euclio:applicability-ify, r=petrochenkov
add applicability to remaining suggestions Fixes #50723. I noticed that the suggestion methods on `DiagnosticBuilder` weren't actually deprecated due to #57679. This PR deprecates them properly and fixes the remaining usages. There's also a PR for clippy at rust-lang/rust-clippy#3667.
Diffstat (limited to 'src/librustc_errors')
| -rw-r--r-- | src/librustc_errors/diagnostic_builder.rs | 90 |
1 files changed, 56 insertions, 34 deletions
diff --git a/src/librustc_errors/diagnostic_builder.rs b/src/librustc_errors/diagnostic_builder.rs index 7449b2b7583..736cca6bd64 100644 --- a/src/librustc_errors/diagnostic_builder.rs +++ b/src/librustc_errors/diagnostic_builder.rs @@ -33,7 +33,11 @@ pub struct DiagnosticBuilder<'a> { /// it easy to declare such methods on the builder. macro_rules! forward { // Forward pattern for &self -> &Self - (pub fn $n:ident(&self, $($name:ident: $ty:ty),* $(,)*) -> &Self) => { + ( + $(#[$attrs:meta])* + pub fn $n:ident(&self, $($name:ident: $ty:ty),* $(,)*) -> &Self + ) => { + $(#[$attrs])* pub fn $n(&self, $($name: $ty),*) -> &Self { #[allow(deprecated)] self.diagnostic.$n($($name),*); @@ -42,7 +46,11 @@ macro_rules! forward { }; // Forward pattern for &mut self -> &mut Self - (pub fn $n:ident(&mut self, $($name:ident: $ty:ty),* $(,)*) -> &mut Self) => { + ( + $(#[$attrs:meta])* + pub fn $n:ident(&mut self, $($name:ident: $ty:ty),* $(,)*) -> &mut Self + ) => { + $(#[$attrs])* pub fn $n(&mut self, $($name: $ty),*) -> &mut Self { #[allow(deprecated)] self.diagnostic.$n($($name),*); @@ -52,10 +60,15 @@ macro_rules! forward { // Forward pattern for &mut self -> &mut Self, with S: Into<MultiSpan> // type parameter. No obvious way to make this more generic. - (pub fn $n:ident<S: Into<MultiSpan>>( - &mut self, - $($name:ident: $ty:ty),* - $(,)*) -> &mut Self) => { + ( + $(#[$attrs:meta])* + pub fn $n:ident<S: Into<MultiSpan>>( + &mut self, + $($name:ident: $ty:ty),* + $(,)* + ) -> &mut Self + ) => { + $(#[$attrs])* pub fn $n<S: Into<MultiSpan>>(&mut self, $($name: $ty),*) -> &mut Self { #[allow(deprecated)] self.diagnostic.$n($($name),*); @@ -177,34 +190,43 @@ impl<'a> DiagnosticBuilder<'a> { msg: &str, ) -> &mut Self); - #[deprecated(note = "Use `span_suggestion_short_with_applicability`")] - forward!(pub fn span_suggestion_short( - &mut self, - sp: Span, - msg: &str, - suggestion: String, - ) -> &mut Self); - - #[deprecated(note = "Use `multipart_suggestion_with_applicability`")] - forward!(pub fn multipart_suggestion( - &mut self, - msg: &str, - suggestion: Vec<(Span, String)>, - ) -> &mut Self); - - #[deprecated(note = "Use `span_suggestion_with_applicability`")] - forward!(pub fn span_suggestion(&mut self, - sp: Span, - msg: &str, - suggestion: String, - ) -> &mut Self); - - #[deprecated(note = "Use `span_suggestions_with_applicability`")] - forward!(pub fn span_suggestions(&mut self, - sp: Span, - msg: &str, - suggestions: Vec<String>, - ) -> &mut Self); + forward!( + #[deprecated(note = "Use `span_suggestion_short_with_applicability`")] + pub fn span_suggestion_short( + &mut self, + sp: Span, + msg: &str, + suggestion: String, + ) -> &mut Self + ); + + forward!( + #[deprecated(note = "Use `multipart_suggestion_with_applicability`")] + pub fn multipart_suggestion( + &mut self, + msg: &str, + suggestion: Vec<(Span, String)>, + ) -> &mut Self + ); + + forward!( + #[deprecated(note = "Use `span_suggestion_with_applicability`")] + pub fn span_suggestion( + &mut self, + sp: Span, + msg: &str, + suggestion: String, + ) -> &mut Self + ); + + forward!( + #[deprecated(note = "Use `span_suggestions_with_applicability`")] + pub fn span_suggestions(&mut self, + sp: Span, + msg: &str, + suggestions: Vec<String>, + ) -> &mut Self + ); pub fn multipart_suggestion_with_applicability(&mut self, msg: &str, |
