diff options
| author | bors <bors@rust-lang.org> | 2018-05-28 10:11:26 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2018-05-28 10:11:26 +0000 |
| commit | 16cd84ee22aeaa97c27eb608d117696dc7346425 (patch) | |
| tree | c3df699bf6e0eaa501aed5df1bca0fa3b937b77c /src/libsyntax/parse/lexer | |
| parent | 68e0e58df7669d548861751e9f710f85dfc39958 (diff) | |
| parent | 98a04291e4db92ae86d7e3a20b5763cb926ebfbf (diff) | |
| download | rust-16cd84ee22aeaa97c27eb608d117696dc7346425.tar.gz rust-16cd84ee22aeaa97c27eb608d117696dc7346425.zip | |
Auto merge of #50724 - zackmdavis:applicability_rush, r=Manishearth
add suggestion applicabilities to librustc and libsyntax A down payment on #50723. Interested in feedback on whether my `MaybeIncorrect` vs. `MachineApplicable` judgement calls are well-calibrated (and that we have a consensus on what this means). r? @Manishearth cc @killercup @estebank
Diffstat (limited to 'src/libsyntax/parse/lexer')
| -rw-r--r-- | src/libsyntax/parse/lexer/mod.rs | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/libsyntax/parse/lexer/mod.rs b/src/libsyntax/parse/lexer/mod.rs index c39eb1594b2..c396fb0fbc0 100644 --- a/src/libsyntax/parse/lexer/mod.rs +++ b/src/libsyntax/parse/lexer/mod.rs @@ -11,7 +11,7 @@ use ast::{self, Ident}; use syntax_pos::{self, BytePos, CharPos, Pos, Span, NO_EXPANSION}; use codemap::{CodeMap, FilePathMapping}; -use errors::{FatalError, DiagnosticBuilder}; +use errors::{Applicability, FatalError, DiagnosticBuilder}; use parse::{token, ParseSess}; use str::char_at; use symbol::{Symbol, keywords}; @@ -1379,11 +1379,12 @@ impl<'a> StringReader<'a> { self.sess.span_diagnostic .struct_span_err(span, "character literal may only contain one codepoint") - .span_suggestion(span, - "if you meant to write a `str` literal, \ - use double quotes", - format!("\"{}\"", &self.src[start..end])) - .emit(); + .span_suggestion_with_applicability( + span, + "if you meant to write a `str` literal, use double quotes", + format!("\"{}\"", &self.src[start..end]), + Applicability::MachineApplicable + ).emit(); return Ok(token::Literal(token::Str_(Symbol::intern("??")), None)) } if self.ch_is('\n') || self.is_eof() || self.ch_is('/') { |
