libsyntax: Stop parsing newtype enums
This commit is contained in:
parent
1fcb0443cf
commit
a34749c289
@ -54,6 +54,7 @@ pub enum ObsoleteSyntax {
|
||||
ObsoleteAssertion,
|
||||
ObsoletePostFnTySigil,
|
||||
ObsoleteBareFnType,
|
||||
ObsoleteNewtypeEnum,
|
||||
}
|
||||
|
||||
impl to_bytes::IterBytes for ObsoleteSyntax {
|
||||
@ -171,6 +172,10 @@ pub impl Parser {
|
||||
"bare function type",
|
||||
"use `&fn` or `extern fn` instead"
|
||||
),
|
||||
ObsoleteNewtypeEnum => (
|
||||
"newtype enum",
|
||||
"instead of `enum Foo = int`, write `struct Foo(int)`"
|
||||
),
|
||||
};
|
||||
|
||||
self.report(sp, kind, kind_str, desc);
|
||||
|
@ -76,11 +76,8 @@ use parse::obsolete::{ObsoleteUnsafeBlock, ObsoleteImplSyntax};
|
||||
use parse::obsolete::{ObsoleteTraitBoundSeparator, ObsoleteMutOwnedPointer};
|
||||
use parse::obsolete::{ObsoleteMutVector, ObsoleteTraitImplVisibility};
|
||||
use parse::obsolete::{ObsoleteRecordType, ObsoleteRecordPattern};
|
||||
<<<<<<< HEAD
|
||||
use parse::obsolete::{ObsoleteAssertion, ObsoletePostFnTySigil};
|
||||
=======
|
||||
use parse::obsolete::{ObsoleteAssertion, ObsoleteBareFnType};
|
||||
>>>>>>> libsyntax: Stop parsing bare functions in preparation for switching them over
|
||||
use parse::obsolete::{ObsoleteBareFnType, ObsoleteNewtypeEnum};
|
||||
use parse::prec::{as_prec, token_to_binop};
|
||||
use parse::token::{can_begin_expr, is_ident, is_ident_or_path};
|
||||
use parse::token::{is_plain_ident, INTERPOLATED, special_idents};
|
||||
@ -651,14 +648,9 @@ pub impl Parser {
|
||||
} else if self.eat_keyword(&~"extern") {
|
||||
self.parse_ty_bare_fn()
|
||||
} else if self.token_is_closure_keyword(© *self.token) {
|
||||
<<<<<<< HEAD
|
||||
// self.warn(fmt!("Old-school closure keyword"));
|
||||
self.parse_ty_closure(ast::BorrowedSigil, None)
|
||||
=======
|
||||
let result = self.parse_ty_closure(None, None);
|
||||
let result = self.parse_ty_closure(ast::BorrowedSigil, None);
|
||||
self.obsolete(*self.last_span, ObsoleteBareFnType);
|
||||
result
|
||||
>>>>>>> libsyntax: Stop parsing bare functions in preparation for switching them over
|
||||
} else if *self.token == token::MOD_SEP
|
||||
|| is_ident_or_path(&*self.token) {
|
||||
let path = self.parse_path_with_tps(colons_before_params);
|
||||
@ -3798,6 +3790,8 @@ pub impl Parser {
|
||||
vis: public,
|
||||
});
|
||||
|
||||
self.obsolete(*self.last_span, ObsoleteNewtypeEnum);
|
||||
|
||||
return (
|
||||
id,
|
||||
item_enum(
|
||||
|
Loading…
Reference in New Issue
Block a user