diff options
| author | bors <bors@rust-lang.org> | 2018-09-20 06:34:22 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2018-09-20 06:34:22 +0000 |
| commit | 992d1e4d3de364c895963167b70934599574d9a7 (patch) | |
| tree | 4766e0608291ff78f47f76fc90a52e1e9e40e9e2 /src/libsyntax | |
| parent | d16f27f89a3a439467533066ff794f41aa63f28f (diff) | |
| parent | d0790c490a2233d04375072123e70ed158eb3848 (diff) | |
| download | rust-992d1e4d3de364c895963167b70934599574d9a7.tar.gz rust-992d1e4d3de364c895963167b70934599574d9a7.zip | |
Auto merge of #54241 - vi:suggest_with_applicability, r=estebank
Remove usages of span_suggestion without Applicability Use `Applicability::Unspecified` for all of them instead. Shall deprecations for the non-`_with_applicability` functions be added? Shall clippy be addressed somehow? r? @estebank
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/config.rs | 8 | ||||
| -rw-r--r-- | src/libsyntax/ext/tt/macro_rules.rs | 4 | ||||
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 7 |
3 files changed, 16 insertions, 3 deletions
diff --git a/src/libsyntax/config.rs b/src/libsyntax/config.rs index 63b70b12248..5d978b6b9e6 100644 --- a/src/libsyntax/config.rs +++ b/src/libsyntax/config.rs @@ -16,6 +16,7 @@ use source_map::Spanned; use edition::Edition; use parse::{token, ParseSess}; use OneVector; +use errors::Applicability; use ptr::P; @@ -123,7 +124,12 @@ impl<'a> StripUnconfigured<'a> { let error = |span, msg, suggestion: &str| { let mut err = self.sess.span_diagnostic.struct_span_err(span, msg); if !suggestion.is_empty() { - err.span_suggestion(span, "expected syntax is", suggestion.into()); + err.span_suggestion_with_applicability( + span, + "expected syntax is", + suggestion.into(), + Applicability::MaybeIncorrect, + ); } err.emit(); true diff --git a/src/libsyntax/ext/tt/macro_rules.rs b/src/libsyntax/ext/tt/macro_rules.rs index 86247745c41..214bc9cffc4 100644 --- a/src/libsyntax/ext/tt/macro_rules.rs +++ b/src/libsyntax/ext/tt/macro_rules.rs @@ -32,6 +32,7 @@ use std::borrow::Cow; use std::collections::hash_map::Entry; use rustc_data_structures::sync::Lrc; +use errors::Applicability; pub struct ParserAnyMacro<'a> { parser: Parser<'a>, @@ -187,10 +188,11 @@ fn generic_extension<'cx>(cx: &'cx mut ExtCtxt, if comma_span == DUMMY_SP { err.note("you might be missing a comma"); } else { - err.span_suggestion_short( + err.span_suggestion_short_with_applicability( comma_span, "missing comma here", ", ".to_string(), + Applicability::MachineApplicable, ); } } diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 48e034b117f..6ec1ad969ee 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -3882,7 +3882,12 @@ impl<'a> Parser<'a> { if self.token == token::CloseDelim(token::Brace) { // If the struct looks otherwise well formed, recover and continue. if let Some(sp) = comma_sp { - err.span_suggestion_short(sp, "remove this comma", String::new()); + err.span_suggestion_short_with_applicability( + sp, + "remove this comma", + String::new(), + Applicability::MachineApplicable, + ); } err.emit(); break; |
