From 5a23a0d283653c79fd623b479b1e8e71d5eea093 Mon Sep 17 00:00:00 2001 From: Sébastien Duquette Date: Sun, 19 Aug 2018 15:01:33 -0400 Subject: Set applicability for more suggestions. --- src/libsyntax/parse/lexer/unicode_chars.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/libsyntax') diff --git a/src/libsyntax/parse/lexer/unicode_chars.rs b/src/libsyntax/parse/lexer/unicode_chars.rs index 88ff8582da8..03bf1b5a4e1 100644 --- a/src/libsyntax/parse/lexer/unicode_chars.rs +++ b/src/libsyntax/parse/lexer/unicode_chars.rs @@ -12,7 +12,7 @@ // http://www.unicode.org/Public/security/10.0.0/confusables.txt use syntax_pos::{Span, NO_EXPANSION}; -use errors::DiagnosticBuilder; +use errors::{Applicability, DiagnosticBuilder}; use super::StringReader; const UNICODE_ARRAY: &[(char, &str, char)] = &[ @@ -346,7 +346,11 @@ crate fn check_for_substitution<'a>(reader: &StringReader<'a>, let msg = format!("Unicode character '{}' ({}) looks like '{}' ({}), but it is not", ch, u_name, ascii_char, ascii_name); - err.span_suggestion(span, &msg, ascii_char.to_string()); + err.span_suggestion_with_applicability( + span, + &msg, + ascii_char.to_string(), + Applicability::MaybeIncorrect); true }, None => { -- cgit 1.4.1-3-g733a5 From 05d19fba27d2e53c64ea8ec488dca4fec7f2b984 Mon Sep 17 00:00:00 2001 From: Esteban Küber Date: Mon, 20 Aug 2018 16:16:17 -0700 Subject: Point at the trait argument when using unboxed closure --- src/libsyntax/parse/parser.rs | 15 ++++++++------- .../unboxed-closure-sugar-wrong-trait.stderr | 2 +- 2 files changed, 9 insertions(+), 8 deletions(-) (limited to 'src/libsyntax') diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index b1e2e69863d..c80187ba77e 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -1079,12 +1079,13 @@ impl<'a> Parser<'a> { self.parse_seq_to_before_tokens(&[ket], sep, TokenExpectType::Expect, f) } - fn parse_seq_to_before_tokens(&mut self, - kets: &[&token::Token], - sep: SeqSep, - expect: TokenExpectType, - mut f: F) - -> PResult<'a, Vec> + fn parse_seq_to_before_tokens( + &mut self, + kets: &[&token::Token], + sep: SeqSep, + expect: TokenExpectType, + mut f: F, + ) -> PResult<'a, Vec> where F: FnMut(&mut Parser<'a>) -> PResult<'a, T> { let mut first: bool = true; @@ -2058,12 +2059,12 @@ impl<'a> Parser<'a> { TokenExpectType::Expect, |p| p.parse_ty())?; self.bump(); // `)` + let span = lo.to(self.prev_span); let output = if self.eat(&token::RArrow) { Some(self.parse_ty_common(false, false)?) } else { None }; - let span = lo.to(self.prev_span); ParenthesisedArgs { inputs, output, span }.into() }; diff --git a/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-trait.stderr b/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-trait.stderr index 5d8c86f5a58..91f57cbd468 100644 --- a/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-trait.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-trait.stderr @@ -2,7 +2,7 @@ error[E0244]: wrong number of type arguments: expected 0, found 1 --> $DIR/unboxed-closure-sugar-wrong-trait.rs:15:13 | LL | fn f isize>(x: F) {} - | ^^^^^^^^^^^^^^^^ unexpected type argument + | ^^^^^^^ unexpected type argument error[E0220]: associated type `Output` not found for `Trait` --> $DIR/unboxed-closure-sugar-wrong-trait.rs:15:24 -- cgit 1.4.1-3-g733a5 From cf1b6d6fe87b01f556d49372d1c988c7cc686057 Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Tue, 21 Aug 2018 21:46:56 -0400 Subject: Remove super old comment on function that parses items This comment was added more than 5 years ago in ab03c1e4221. As far as anyone reading this comment today needs to know, the function has never parsed items from inside an extern crate. --- src/libsyntax/parse/parser.rs | 2 -- 1 file changed, 2 deletions(-) (limited to 'src/libsyntax') diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 5467bab33f9..d7f339a6942 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -6842,8 +6842,6 @@ impl<'a> Parser<'a> { } /// Parse one of the items allowed by the flags. - /// NB: this function no longer parses the items inside an - /// extern crate. fn parse_item_implementation( &mut self, attrs: Vec, -- cgit 1.4.1-3-g733a5