Skip to content

Commit

Permalink
Tweak some ‘expected…’ error messages
Browse files Browse the repository at this point in the history
Fixes #21153.
  • Loading branch information
ftxqxd committed Feb 2, 2015
1 parent ca4b967 commit 597b4fa
Show file tree
Hide file tree
Showing 20 changed files with 100 additions and 77 deletions.
9 changes: 6 additions & 3 deletions src/libsyntax/parse/attr.rs
Expand Up @@ -13,7 +13,7 @@ use ast;
use codemap::{spanned, Spanned, mk_sp, Span};
use parse::common::*; //resolve bug?
use parse::token;
use parse::parser::Parser;
use parse::parser::{Parser, TokenType};
use ptr::P;

/// A parser that can parse attributes.
Expand Down Expand Up @@ -69,7 +69,9 @@ impl<'a> ParserAttr for Parser<'a> {
let lo = self.span.lo;
self.bump();

let style = if self.eat(&token::Not) {
if permit_inner { self.expected_tokens.push(TokenType::Token(token::Not)); }
let style = if self.token == token::Not {
self.bump();
if !permit_inner {
let span = self.span;
self.span_err(span,
Expand All @@ -96,7 +98,8 @@ impl<'a> ParserAttr for Parser<'a> {
}
};

if permit_inner && self.eat(&token::Semi) {
if permit_inner && self.token == token::Semi {
self.bump();
self.span_warn(span, "this inner attribute syntax is deprecated. \
The new syntax is `#![foo]`, with a bang and no semicolon");
style = ast::AttrInner;
Expand Down

0 comments on commit 597b4fa

Please sign in to comment.