Skip to content

Commit 959fc61

Browse files
committed
Deprecate *_suggestion* that are without explicit applicability
1 parent 4b05128 commit 959fc61

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

src/librustc_errors/diagnostic.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,7 @@ impl Diagnostic {
232232
/// inline it will only show the text message and not the text.
233233
///
234234
/// See `CodeSuggestion` for more information.
235+
#[deprecated(note = "Use `span_suggestion_short_with_applicability`")]
235236
pub fn span_suggestion_short(&mut self, sp: Span, msg: &str, suggestion: String) -> &mut Self {
236237
self.suggestions.push(CodeSuggestion {
237238
substitutions: vec![Substitution {
@@ -263,6 +264,7 @@ impl Diagnostic {
263264
/// * may contain a name of a function, variable or type, but not whole expressions
264265
///
265266
/// See `CodeSuggestion` for more information.
267+
#[deprecated(note = "Use `span_suggestion_with_applicability`")]
266268
pub fn span_suggestion(&mut self, sp: Span, msg: &str, suggestion: String) -> &mut Self {
267269
self.suggestions.push(CodeSuggestion {
268270
substitutions: vec![Substitution {
@@ -298,6 +300,7 @@ impl Diagnostic {
298300
self
299301
}
300302

303+
#[deprecated(note = "Use `multipart_suggestion_with_applicability`")]
301304
pub fn multipart_suggestion(
302305
&mut self,
303306
msg: &str,
@@ -311,6 +314,7 @@ impl Diagnostic {
311314
}
312315

313316
/// Prints out a message with multiple suggested edits of the code.
317+
#[deprecated(note = "Use `span_suggestions_with_applicability`")]
314318
pub fn span_suggestions(&mut self, sp: Span, msg: &str, suggestions: Vec<String>) -> &mut Self {
315319
self.suggestions.push(CodeSuggestion {
316320
substitutions: suggestions.into_iter().map(|snippet| Substitution {

src/librustc_errors/diagnostic_builder.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ macro_rules! forward {
4141
// Forward pattern for &self -> &Self
4242
(pub fn $n:ident(&self, $($name:ident: $ty:ty),*) -> &Self) => {
4343
pub fn $n(&self, $($name: $ty),*) -> &Self {
44+
#[allow(deprecated)]
4445
self.diagnostic.$n($($name),*);
4546
self
4647
}
@@ -49,6 +50,7 @@ macro_rules! forward {
4950
// Forward pattern for &mut self -> &mut Self
5051
(pub fn $n:ident(&mut self, $($name:ident: $ty:ty),*) -> &mut Self) => {
5152
pub fn $n(&mut self, $($name: $ty),*) -> &mut Self {
53+
#[allow(deprecated)]
5254
self.diagnostic.$n($($name),*);
5355
self
5456
}
@@ -58,6 +60,7 @@ macro_rules! forward {
5860
// type parameter. No obvious way to make this more generic.
5961
(pub fn $n:ident<S: Into<MultiSpan>>(&mut self, $($name:ident: $ty:ty),*) -> &mut Self) => {
6062
pub fn $n<S: Into<MultiSpan>>(&mut self, $($name: $ty),*) -> &mut Self {
63+
#[allow(deprecated)]
6164
self.diagnostic.$n($($name),*);
6265
self
6366
}
@@ -167,21 +170,29 @@ impl<'a> DiagnosticBuilder<'a> {
167170
sp: S,
168171
msg: &str)
169172
-> &mut Self);
173+
174+
#[deprecated(note = "Use `span_suggestion_short_with_applicability`")]
170175
forward!(pub fn span_suggestion_short(&mut self,
171176
sp: Span,
172177
msg: &str,
173178
suggestion: String)
174179
-> &mut Self);
180+
181+
#[deprecated(note = "Use `multipart_suggestion_with_applicability`")]
175182
forward!(pub fn multipart_suggestion(
176183
&mut self,
177184
msg: &str,
178185
suggestion: Vec<(Span, String)>
179186
) -> &mut Self);
187+
188+
#[deprecated(note = "Use `span_suggestion_with_applicability`")]
180189
forward!(pub fn span_suggestion(&mut self,
181190
sp: Span,
182191
msg: &str,
183192
suggestion: String)
184193
-> &mut Self);
194+
195+
#[deprecated(note = "Use `span_suggestions_with_applicability`")]
185196
forward!(pub fn span_suggestions(&mut self,
186197
sp: Span,
187198
msg: &str,

0 commit comments

Comments
 (0)