diff --git a/src/libsyntax/lib.rs b/src/libsyntax/lib.rs index 0c105865e0c2e..31468fcee0307 100644 --- a/src/libsyntax/lib.rs +++ b/src/libsyntax/lib.rs @@ -27,6 +27,7 @@ #![feature(slice_sort_by_cached_key)] #![feature(str_escape)] #![feature(unicode_internals)] +#![feature(catch_expr)] #![recursion_limit="256"] diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 9011b6e48b974..8e60e23df6860 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -875,6 +875,7 @@ impl<'a> Parser<'a> { } } + #[inline] fn check_ident(&mut self) -> bool { if self.token.is_ident() { true @@ -893,6 +894,7 @@ impl<'a> Parser<'a> { } } + #[inline] fn check_type(&mut self) -> bool { if self.token.can_begin_type() { true @@ -1714,11 +1716,10 @@ impl<'a> Parser<'a> { } else if self.eat_keyword(keywords::Const) { Mutability::Immutable } else { - let span = self.prev_span; - self.span_err(span, - "expected mut or const in raw pointer type (use \ - `*mut T` or `*const T` as appropriate)"); - Mutability::Immutable + let mut err = self.fatal("expected mut or const in raw pointer type (use \ + `*mut T` or `*const T` as appropriate)"); + err.span_label(self.prev_span, "expected mut or const"); + return Err(err); }; let t = self.parse_ty_no_plus()?; Ok(MutTy { ty: t, mutbl: mutbl }) @@ -1984,20 +1985,26 @@ impl<'a> Parser<'a> { -> PResult<'a, PathSegment> { let ident = self.parse_path_segment_ident()?; - let is_args_start = |token: &token::Token| match *token { - token::Lt | token::BinOp(token::Shl) | token::OpenDelim(token::Paren) => true, + let is_args_start = |token: &token::Token, include_paren: bool| match *token { + token::Lt | token::BinOp(token::Shl) => true, + token::OpenDelim(token::Paren) => include_paren, _ => false, }; - let check_args_start = |this: &mut Self| { - this.expected_tokens.extend_from_slice( - &[TokenType::Token(token::Lt), TokenType::Token(token::OpenDelim(token::Paren))] - ); - is_args_start(&this.token) + let check_args_start = |this: &mut Self, include_paren: bool| { + this.expected_tokens.push(TokenType::Token(token::Lt)); + if include_paren { + this.expected_tokens.push(TokenType::Token(token::OpenDelim(token::Paren))); + } + is_args_start(&this.token, include_paren) }; - Ok(if style == PathStyle::Type && check_args_start(self) || + let expr_without_disambig = style == PathStyle::Expr && check_args_start(self, false); + let parser_snapshot_before_generics = self.clone(); + + Ok(if style == PathStyle::Type && check_args_start(self, true) || style != PathStyle::Mod && self.check(&token::ModSep) - && self.look_ahead(1, |t| is_args_start(t)) { + && self.look_ahead(1, |t| is_args_start(t, true)) + || expr_without_disambig { // Generic arguments are found - `<`, `(`, `::<` or `::(`. let lo = self.span; if self.eat(&token::ModSep) && style == PathStyle::Type && enable_warning { @@ -2007,10 +2014,26 @@ impl<'a> Parser<'a> { let args = if self.eat_lt() { // `<'a, T, A = U>` - let (args, bindings) = self.parse_generic_args()?; - self.expect_gt()?; - let span = lo.to(self.prev_span); - AngleBracketedArgs { args, bindings, span }.into() + let args: PResult<_> = do catch { + let (args, bindings) = self.parse_generic_args()?; + self.expect_gt()?; + let span = lo.to(self.prev_span); + AngleBracketedArgs { args, bindings, span } + }; + + match args { + Err(mut err) => { + if expr_without_disambig { + err.cancel(); + mem::replace(self, parser_snapshot_before_generics); + return Ok(PathSegment::from_ident(ident)); + } + return Err(err); + } + _ => { + args?.into() + } + } } else { // `(T, U) -> R` self.bump(); // `(` @@ -2036,6 +2059,7 @@ impl<'a> Parser<'a> { }) } + #[inline] crate fn check_lifetime(&mut self) -> bool { self.expected_tokens.push(TokenType::Lifetime); self.token.is_lifetime() @@ -5039,51 +5063,76 @@ impl<'a> Parser<'a> { /// Parses (possibly empty) list of lifetime and type arguments and associated type bindings, /// possibly including trailing comma. - fn parse_generic_args(&mut self) - -> PResult<'a, (Vec, Vec)> { - let mut args = Vec::new(); - let mut bindings = Vec::new(); + fn parse_generic_args(&mut self) -> PResult<'a, (Vec, Vec)> { + let mut args: Option> = None; + let mut bindings: Option> = None; let mut seen_type = false; let mut seen_binding = false; loop { - if self.check_lifetime() && self.look_ahead(1, |t| !t.is_like_plus()) { + let mut arg = None; + let mut binding = None; + + let (is_not_like_plus, is_eq) = if let Some(TokenTree::Token(_, tok)) = + self.token_cursor.frame.tree_cursor.look_ahead(0) { + (!tok.is_like_plus(), tok == token::Eq) + } else { + (false, false) + }; + + if is_not_like_plus && self.check_lifetime() { // Parse lifetime argument. - args.push(GenericArg::Lifetime(self.expect_lifetime())); if seen_type || seen_binding { self.span_err(self.prev_span, "lifetime parameters must be declared prior to type parameters"); } - } else if self.check_ident() && self.look_ahead(1, |t| t == &token::Eq) { + arg = Some(GenericArg::Lifetime(self.expect_lifetime())); + } else if is_eq && self.check_ident() { // Parse associated type binding. let lo = self.span; let ident = self.parse_ident()?; self.bump(); let ty = self.parse_ty()?; - bindings.push(TypeBinding { + seen_binding = true; + binding = Some(TypeBinding { id: ast::DUMMY_NODE_ID, ident, ty, span: lo.to(self.prev_span), }); - seen_binding = true; } else if self.check_type() { // Parse type argument. - let ty_param = self.parse_ty()?; + let ty = self.parse_ty()?; if seen_binding { - self.span_err(ty_param.span, + self.span_err(ty.span, "type parameters must be declared prior to associated type bindings"); } - args.push(GenericArg::Type(ty_param)); seen_type = true; + arg = Some(GenericArg::Type(ty)); } else { - break + break; + } + + if let Some(arg) = arg { + if let Some(ref mut args) = args { + args.push(arg); + } else { + args = Some(vec![arg]); + } + } + + if let Some(binding) = binding { + if let Some(ref mut bindings) = bindings { + bindings.push(binding); + } else { + bindings = Some(vec![binding]); + } } if !self.eat(&token::Comma) { - break + break; } } - Ok((args, bindings)) + Ok((args.unwrap_or_default(), bindings.unwrap_or_default())) } /// Parses an optional `where` clause and places it in `generics`. diff --git a/src/libsyntax/parse/token.rs b/src/libsyntax/parse/token.rs index c449cc0a6525a..9a8873685c97b 100644 --- a/src/libsyntax/parse/token.rs +++ b/src/libsyntax/parse/token.rs @@ -124,6 +124,7 @@ pub(crate) fn ident_can_begin_expr(ident: ast::Ident, is_raw: bool) -> bool { ].contains(&ident.name) } +#[inline] fn ident_can_begin_type(ident: ast::Ident, is_raw: bool) -> bool { let ident_token: Token = Ident(ident, is_raw); @@ -167,7 +168,7 @@ pub enum Token { Comma, Semi, Colon, - ModSep, + ModSep, // `::` RArrow, LArrow, FatArrow, @@ -218,6 +219,7 @@ impl Token { Ident(ident, ident.is_raw_guess()) } + #[inline] crate fn is_like_plus(&self) -> bool { match *self { BinOp(Plus) | BinOpEq(Plus) => true, @@ -307,6 +309,7 @@ impl Token { } /// Returns an identifier if this token is an identifier. + #[inline] pub fn ident(&self) -> Option<(ast::Ident, /* is_raw */ bool)> { match *self { Ident(ident, is_raw) => Some((ident, is_raw)), @@ -318,6 +321,7 @@ impl Token { } } /// Returns a lifetime identifier if this token is a lifetime. + #[inline] pub fn lifetime(&self) -> Option { match *self { Lifetime(ident) => Some(ident), @@ -329,10 +333,12 @@ impl Token { } } /// Returns `true` if the token is an identifier. + #[inline] pub fn is_ident(&self) -> bool { self.ident().is_some() } /// Returns `true` if the token is a lifetime. + #[inline] crate fn is_lifetime(&self) -> bool { self.lifetime().is_some() } @@ -376,6 +382,7 @@ impl Token { self.ident().map(|(ident, is_raw)| ident.name == kw.name() && !is_raw).unwrap_or(false) } + #[inline] pub fn is_path_segment_keyword(&self) -> bool { match self.ident() { Some((id, false)) => id.is_path_segment_keyword(), @@ -409,6 +416,7 @@ impl Token { } /// Returns `true` if the token is either a special identifier or a keyword. + #[inline] pub fn is_reserved_ident(&self) -> bool { match self.ident() { Some((id, false)) => id.is_reserved(), diff --git a/src/test/parse-fail/pat-ranges-2.rs b/src/test/parse-fail/pat-ranges-2.rs index 64c749333cf4a..fd76e794cd8d0 100644 --- a/src/test/parse-fail/pat-ranges-2.rs +++ b/src/test/parse-fail/pat-ranges-2.rs @@ -11,5 +11,5 @@ // Parsing of range patterns fn main() { - let 10 ..= makropulos!() = 12; //~ error: expected one of `::`, `:`, `;`, or `=`, found `!` + let 10 ..= makropulos!() = 12; //~ error: expected one of `::`, `:`, `;`, `<`, or `=`, found `!` } diff --git a/src/test/parse-fail/require-parens-for-chained-comparison.rs b/src/test/parse-fail/require-parens-for-chained-comparison.rs index 1ee6996ce9c84..c330c17804ba1 100644 --- a/src/test/parse-fail/require-parens-for-chained-comparison.rs +++ b/src/test/parse-fail/require-parens-for-chained-comparison.rs @@ -18,9 +18,4 @@ fn main() { false == 0 < 2; //~^ ERROR: chained comparison operators require parentheses - - f(); - //~^ ERROR: chained comparison operators require parentheses - //~| HELP: use `::<...>` instead of `<...>` - //~| HELP: or use `(...)` } diff --git a/src/test/ui/did_you_mean/issue-40396.rs b/src/test/ui/did_you_mean/issue-40396.rs index eb62dc5408494..0f6758d9fd681 100644 --- a/src/test/ui/did_you_mean/issue-40396.rs +++ b/src/test/ui/did_you_mean/issue-40396.rs @@ -9,16 +9,16 @@ // except according to those terms. fn foo() { - println!("{:?}", (0..13).collect>()); //~ ERROR chained comparison + println!("{:?}", (0..13).collect>()); // ok } fn bar() { - println!("{:?}", Vec::new()); //~ ERROR chained comparison + println!("{:?}", Vec::new()); // ok } fn qux() { - println!("{:?}", (0..13).collect()); //~ ERROR chained comparison - //~^ ERROR chained comparison + println!("{:?}", (0..13).collect()); //~ ERROR expected function, found struct `Vec` + //~^ ERROR attempted to take value of method `collect` } fn main() {} diff --git a/src/test/ui/did_you_mean/issue-40396.stderr b/src/test/ui/did_you_mean/issue-40396.stderr index 219fd45665a94..4669a105270bd 100644 --- a/src/test/ui/did_you_mean/issue-40396.stderr +++ b/src/test/ui/did_you_mean/issue-40396.stderr @@ -1,38 +1,18 @@ -error: chained comparison operators require parentheses - --> $DIR/issue-40396.rs:12:37 +error[E0423]: expected function, found struct `Vec` + --> $DIR/issue-40396.rs:20:38 | -LL | println!("{:?}", (0..13).collect>()); //~ ERROR chained comparison - | ^^^^^^^^ - | - = help: use `::<...>` instead of `<...>` if you meant to specify type arguments - = help: or use `(...)` if you meant to specify fn arguments - -error: chained comparison operators require parentheses - --> $DIR/issue-40396.rs:16:25 - | -LL | println!("{:?}", Vec::new()); //~ ERROR chained comparison - | ^^^^^^^ - | - = help: use `::<...>` instead of `<...>` if you meant to specify type arguments - = help: or use `(...)` if you meant to specify fn arguments - -error: chained comparison operators require parentheses - --> $DIR/issue-40396.rs:20:37 - | -LL | println!("{:?}", (0..13).collect()); //~ ERROR chained comparison - | ^^^^^^^^ - | - = help: use `::<...>` instead of `<...>` if you meant to specify type arguments - = help: or use `(...)` if you meant to specify fn arguments +LL | println!("{:?}", (0..13).collect()); //~ ERROR expected function, found struct `Vec` + | ^^^^^^^^ did you mean `Vec { /* fields */ }`? -error: chained comparison operators require parentheses - --> $DIR/issue-40396.rs:20:41 +error[E0615]: attempted to take value of method `collect` on type `std::ops::Range<{integer}>` + --> $DIR/issue-40396.rs:20:30 | -LL | println!("{:?}", (0..13).collect()); //~ ERROR chained comparison - | ^^^^^^ +LL | println!("{:?}", (0..13).collect()); //~ ERROR expected function, found struct `Vec` + | ^^^^^^^ | - = help: use `::<...>` instead of `<...>` if you meant to specify type arguments - = help: or use `(...)` if you meant to specify fn arguments + = help: maybe a `()` to call it is missing? -error: aborting due to 4 previous errors +error: aborting due to 2 previous errors +Some errors occurred: E0423, E0615. +For more information about an error, try `rustc --explain E0423`. diff --git a/src/test/ui/issue-20616-2.rs b/src/test/ui/issue-20616-2.rs deleted file mode 100644 index 1ec7a74559a6e..0000000000000 --- a/src/test/ui/issue-20616-2.rs +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// We need all these 9 issue-20616-N.rs files -// because we can only catch one parsing error at a time - - - -type Type_1_<'a, T> = &'a T; - - -//type Type_1<'a T> = &'a T; // error: expected `,` or `>` after lifetime name, found `T` - - -type Type_2 = Type_1_<'static ()>; //~ error: expected one of `,` or `>`, found `(` - - -//type Type_3 = Box; // error: expected type, found `,` - - -//type Type_4 = Type_1_<'static,, T>; // error: expected type, found `,` - - -type Type_5_<'a> = Type_1_<'a, ()>; - - -//type Type_5<'a> = Type_1_<'a, (),,>; // error: expected type, found `,` - - -//type Type_6 = Type_5_<'a,,>; // error: expected type, found `,` - - -//type Type_7 = Box<(),,>; // error: expected type, found `,` - - -//type Type_8<'a,,> = &'a (); // error: expected ident, found `,` - - -//type Type_9 = Box; // error: expected ident, found `,` diff --git a/src/test/ui/issue-20616-2.stderr b/src/test/ui/issue-20616-2.stderr deleted file mode 100644 index 1c103b21a181e..0000000000000 --- a/src/test/ui/issue-20616-2.stderr +++ /dev/null @@ -1,8 +0,0 @@ -error: expected one of `,` or `>`, found `(` - --> $DIR/issue-20616-2.rs:22:31 - | -LL | type Type_2 = Type_1_<'static ()>; //~ error: expected one of `,` or `>`, found `(` - | ^ expected one of `,` or `>` here - -error: aborting due to previous error - diff --git a/src/test/ui/issue-20616-3.rs b/src/test/ui/issue-20616-3.rs deleted file mode 100644 index 885fd24654731..0000000000000 --- a/src/test/ui/issue-20616-3.rs +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// We need all these 9 issue-20616-N.rs files -// because we can only catch one parsing error at a time - - - -type Type_1_<'a, T> = &'a T; - - -//type Type_1<'a T> = &'a T; // error: expected `,` or `>` after lifetime name, found `T` - - -//type Type_2 = Type_1_<'static ()>; // error: expected `,` or `>` after lifetime name, found `(` - - -type Type_3 = Box; //~ error: expected one of `>`, identifier, lifetime, or type, found `,` - - -//type Type_4 = Type_1_<'static,, T>; // error: expected type, found `,` - - -type Type_5_<'a> = Type_1_<'a, ()>; - - -//type Type_5<'a> = Type_1_<'a, (),,>; // error: expected type, found `,` - - -//type Type_6 = Type_5_<'a,,>; // error: expected type, found `,` - - -//type Type_7 = Box<(),,>; // error: expected type, found `,` - - -//type Type_8<'a,,> = &'a (); // error: expected ident, found `,` - - -//type Type_9 = Box; // error: expected ident, found `,` diff --git a/src/test/ui/issue-20616-3.stderr b/src/test/ui/issue-20616-3.stderr deleted file mode 100644 index b4b40b3637db7..0000000000000 --- a/src/test/ui/issue-20616-3.stderr +++ /dev/null @@ -1,8 +0,0 @@ -error: expected one of `>`, identifier, lifetime, or type, found `,` - --> $DIR/issue-20616-3.rs:25:24 - | -LL | type Type_3 = Box; //~ error: expected one of `>`, identifier, lifetime, or type, found `,` - | ^ expected one of `>`, identifier, lifetime, or type here - -error: aborting due to previous error - diff --git a/src/test/ui/issue-20616-4.rs b/src/test/ui/issue-20616-4.rs deleted file mode 100644 index 0dbe92fc1bcb3..0000000000000 --- a/src/test/ui/issue-20616-4.rs +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// We need all these 9 issue-20616-N.rs files -// because we can only catch one parsing error at a time - - - -type Type_1_<'a, T> = &'a T; - - -//type Type_1<'a T> = &'a T; // error: expected `,` or `>` after lifetime name, found `T` - - -//type Type_2 = Type_1_<'static ()>; // error: expected `,` or `>` after lifetime name, found `(` - - -//type Type_3 = Box; // error: expected type, found `,` - - -type Type_4 = Type_1_<'static,, T>; -//~^ error: expected one of `>`, identifier, lifetime, or type, found `,` - - -type Type_5_<'a> = Type_1_<'a, ()>; - - -//type Type_5<'a> = Type_1_<'a, (),,>; // error: expected type, found `,` - - -//type Type_6 = Type_5_<'a,,>; // error: expected type, found `,` - - -//type Type_7 = Box<(),,>; // error: expected type, found `,` - - -//type Type_8<'a,,> = &'a (); // error: expected ident, found `,` - - -//type Type_9 = Box; // error: expected ident, found `,` diff --git a/src/test/ui/issue-20616-4.stderr b/src/test/ui/issue-20616-4.stderr deleted file mode 100644 index 0a734e4fdcdbe..0000000000000 --- a/src/test/ui/issue-20616-4.stderr +++ /dev/null @@ -1,8 +0,0 @@ -error: expected one of `>`, identifier, lifetime, or type, found `,` - --> $DIR/issue-20616-4.rs:28:34 - | -LL | type Type_4 = Type_1_<'static,, T>; - | ^ expected one of `>`, identifier, lifetime, or type here - -error: aborting due to previous error - diff --git a/src/test/ui/issue-20616-5.rs b/src/test/ui/issue-20616-5.rs deleted file mode 100644 index 794e5178f4b2c..0000000000000 --- a/src/test/ui/issue-20616-5.rs +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// We need all these 9 issue-20616-N.rs files -// because we can only catch one parsing error at a time - - - -type Type_1_<'a, T> = &'a T; - - -//type Type_1<'a T> = &'a T; // error: expected `,` or `>` after lifetime name, found `T` - - -//type Type_2 = Type_1_<'static ()>; // error: expected `,` or `>` after lifetime name, found `(` - - -//type Type_3 = Box; // error: expected type, found `,` - - -//type Type_4 = Type_1_<'static,, T>; // error: expected type, found `,` - - -type Type_5_<'a> = Type_1_<'a, ()>; - - -type Type_5<'a> = Type_1_<'a, (),,>; -//~^ error: expected one of `>`, identifier, lifetime, or type, found `,` - - -//type Type_6 = Type_5_<'a,,>; // error: expected type, found `,` - - -//type Type_7 = Box<(),,>; // error: expected type, found `,` - - -//type Type_8<'a,,> = &'a (); // error: expected ident, found `,` - - -//type Type_9 = Box; // error: expected ident, found `,` diff --git a/src/test/ui/issue-20616-5.stderr b/src/test/ui/issue-20616-5.stderr deleted file mode 100644 index 504be1632ba5b..0000000000000 --- a/src/test/ui/issue-20616-5.stderr +++ /dev/null @@ -1,8 +0,0 @@ -error: expected one of `>`, identifier, lifetime, or type, found `,` - --> $DIR/issue-20616-5.rs:34:34 - | -LL | type Type_5<'a> = Type_1_<'a, (),,>; - | ^ expected one of `>`, identifier, lifetime, or type here - -error: aborting due to previous error - diff --git a/src/test/ui/issue-20616-6.rs b/src/test/ui/issue-20616-6.rs deleted file mode 100644 index fe91751a4a06b..0000000000000 --- a/src/test/ui/issue-20616-6.rs +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// We need all these 9 issue-20616-N.rs files -// because we can only catch one parsing error at a time - - - -type Type_1_<'a, T> = &'a T; - - -//type Type_1<'a T> = &'a T; // error: expected `,` or `>` after lifetime name, found `T` - - -//type Type_2 = Type_1_<'static ()>; // error: expected `,` or `>` after lifetime name, found `(` - - -//type Type_3 = Box; // error: expected type, found `,` - - -//type Type_4 = Type_1_<'static,, T>; // error: expected type, found `,` - - -type Type_5_<'a> = Type_1_<'a, ()>; - - -//type Type_5<'a> = Type_1_<'a, (),,>; // error: expected type, found `,` - - -type Type_6 = Type_5_<'a,,>; -//~^ error: expected one of `>`, identifier, lifetime, or type, found `,` - - -//type Type_7 = Box<(),,>; // error: expected type, found `,` - - -//type Type_8<'a,,> = &'a (); // error: expected ident, found `,` - - -//type Type_9 = Box; // error: expected ident, found `,` diff --git a/src/test/ui/issue-20616-6.stderr b/src/test/ui/issue-20616-6.stderr deleted file mode 100644 index 41dea4137afd8..0000000000000 --- a/src/test/ui/issue-20616-6.stderr +++ /dev/null @@ -1,8 +0,0 @@ -error: expected one of `>`, identifier, lifetime, or type, found `,` - --> $DIR/issue-20616-6.rs:37:26 - | -LL | type Type_6 = Type_5_<'a,,>; - | ^ expected one of `>`, identifier, lifetime, or type here - -error: aborting due to previous error - diff --git a/src/test/ui/issue-20616-7.rs b/src/test/ui/issue-20616-7.rs deleted file mode 100644 index 184ad02710268..0000000000000 --- a/src/test/ui/issue-20616-7.rs +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// We need all these 9 issue-20616-N.rs files -// because we can only catch one parsing error at a time - - - -type Type_1_<'a, T> = &'a T; - - -//type Type_1<'a T> = &'a T; // error: expected `,` or `>` after lifetime name, found `T` - - -//type Type_2 = Type_1_<'static ()>; // error: expected `,` or `>` after lifetime name, found `(` - - -//type Type_3 = Box; // error: expected type, found `,` - - -//type Type_4 = Type_1_<'static,, T>; // error: expected type, found `,` - - -type Type_5_<'a> = Type_1_<'a, ()>; - - -//type Type_5<'a> = Type_1_<'a, (),,>; // error: expected type, found `,` - - -//type Type_6 = Type_5_<'a,,>; // error: expected type, found `,` - - -type Type_7 = Box<(),,>; //~ error: expected one of `>`, identifier, lifetime, or type, found `,` - - -//type Type_8<'a,,> = &'a (); // error: expected ident, found `,` - - -//type Type_9 = Box; // error: expected ident, found `,` diff --git a/src/test/ui/issue-20616-7.stderr b/src/test/ui/issue-20616-7.stderr deleted file mode 100644 index caf66895fabbf..0000000000000 --- a/src/test/ui/issue-20616-7.stderr +++ /dev/null @@ -1,8 +0,0 @@ -error: expected one of `>`, identifier, lifetime, or type, found `,` - --> $DIR/issue-20616-7.rs:40:22 - | -LL | type Type_7 = Box<(),,>; //~ error: expected one of `>`, identifier, lifetime, or type, found `,` - | ^ expected one of `>`, identifier, lifetime, or type here - -error: aborting due to previous error - diff --git a/src/test/ui/issue-6596-2.stderr b/src/test/ui/issue-6596-2.stderr index f2ed17f35e697..c34b053653649 100644 --- a/src/test/ui/issue-6596-2.stderr +++ b/src/test/ui/issue-6596-2.stderr @@ -7,11 +7,11 @@ LL | { $inp $nonexistent } LL | g!(foo); | -------- in this macro invocation -error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `nonexistent` +error: expected one of `!`, `.`, `::`, `;`, `<`, `?`, `{`, `}`, or an operator, found `nonexistent` --> $DIR/issue-6596-2.rs:15:16 | LL | { $inp $nonexistent } - | ^^^^^^^^^^^^ expected one of 8 possible tokens here + | ^^^^^^^^^^^^ expected one of 9 possible tokens here ... LL | g!(foo); | -------- in this macro invocation diff --git a/src/test/ui/macro_backtrace/main.stderr b/src/test/ui/macro_backtrace/main.stderr index 10eabca63538d..54dfd35121d3b 100644 --- a/src/test/ui/macro_backtrace/main.stderr +++ b/src/test/ui/macro_backtrace/main.stderr @@ -1,21 +1,21 @@ -error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `error` +error: expected one of `!`, `.`, `::`, `;`, `<`, `?`, `{`, `}`, or an operator, found `error` --> $DIR/main.rs:19:20 | LL | / macro_rules! pong { LL | | () => { syntax error }; - | | ^^^^^ expected one of 8 possible tokens here + | | ^^^^^ expected one of 9 possible tokens here LL | | } | |_- in this expansion of `pong!` ... LL | pong!(); | -------- in this macro invocation -error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `error` +error: expected one of `!`, `.`, `::`, `;`, `<`, `?`, `{`, `}`, or an operator, found `error` --> $DIR/main.rs:19:20 | LL | / macro_rules! pong { LL | | () => { syntax error }; - | | ^^^^^ expected one of 8 possible tokens here + | | ^^^^^ expected one of 9 possible tokens here LL | | } | |_- in this expansion of `pong!` ... @@ -30,12 +30,12 @@ LL | ( ) => { pong ! ( ) ; } | | in this macro invocation | in this expansion of `ping!` -error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `error` +error: expected one of `!`, `.`, `::`, `;`, `<`, `?`, `{`, `}`, or an operator, found `error` --> $DIR/main.rs:19:20 | LL | / macro_rules! pong { LL | | () => { syntax error }; - | | ^^^^^ expected one of 8 possible tokens here + | | ^^^^^ expected one of 9 possible tokens here LL | | } | |_- in this expansion of `pong!` (#5) ... diff --git a/src/test/ui/raw-literal-keywords.stderr b/src/test/ui/raw-literal-keywords.stderr index 022f80ae8a4ec..143ef7cc03ba6 100644 --- a/src/test/ui/raw-literal-keywords.stderr +++ b/src/test/ui/raw-literal-keywords.stderr @@ -1,20 +1,20 @@ -error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `true` +error: expected one of `!`, `.`, `::`, `;`, `<`, `?`, `{`, `}`, or an operator, found `true` --> $DIR/raw-literal-keywords.rs:16:10 | LL | r#if true { } //~ ERROR found `true` - | ^^^^ expected one of 8 possible tokens here + | ^^^^ expected one of 9 possible tokens here -error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `Test` +error: expected one of `!`, `.`, `::`, `;`, `<`, `?`, `{`, `}`, or an operator, found `Test` --> $DIR/raw-literal-keywords.rs:20:14 | LL | r#struct Test; //~ ERROR found `Test` - | ^^^^ expected one of 8 possible tokens here + | ^^^^ expected one of 9 possible tokens here -error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `Test` +error: expected one of `!`, `.`, `::`, `;`, `<`, `?`, `{`, `}`, or an operator, found `Test` --> $DIR/raw-literal-keywords.rs:24:13 | LL | r#union Test; //~ ERROR found `Test` - | ^^^^ expected one of 8 possible tokens here + | ^^^^ expected one of 9 possible tokens here error: aborting due to 3 previous errors