libsyntax: Stop parsing const
.
This commit is contained in:
parent
85c9fc6f8f
commit
68cb53672b
@ -60,6 +60,7 @@ pub enum ObsoleteSyntax {
|
||||
ObsoleteConstManagedPointer,
|
||||
ObsoletePurity,
|
||||
ObsoleteStaticMethod,
|
||||
ObsoleteConstItem,
|
||||
}
|
||||
|
||||
impl to_bytes::IterBytes for ObsoleteSyntax {
|
||||
@ -203,6 +204,11 @@ fn obsolete(&self, sp: span, kind: ObsoleteSyntax) {
|
||||
"`static` notation",
|
||||
"`static` is superfluous; remove it"
|
||||
),
|
||||
ObsoleteConstItem => (
|
||||
"`const` item",
|
||||
"`const` items are now `static` items; replace `const` with \
|
||||
`static`"
|
||||
),
|
||||
};
|
||||
|
||||
self.report(sp, kind, kind_str, desc);
|
||||
|
@ -81,6 +81,7 @@
|
||||
use parse::obsolete::{ObsoleteMode, ObsoleteImplicitSelf};
|
||||
use parse::obsolete::{ObsoleteLifetimeNotation, ObsoleteConstManagedPointer};
|
||||
use parse::obsolete::{ObsoletePurity, ObsoleteStaticMethod};
|
||||
use parse::obsolete::{ObsoleteConstItem};
|
||||
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};
|
||||
@ -3563,7 +3564,9 @@ fn parse_item_foreign_const(&self, vis: ast::visibility,
|
||||
let lo = self.span.lo;
|
||||
|
||||
// XXX: Obsolete; remove after snap.
|
||||
if !self.eat_keyword(&~"const") {
|
||||
if self.eat_keyword(&~"const") {
|
||||
self.obsolete(*self.last_span, ObsoleteConstItem);
|
||||
} else {
|
||||
self.expect_keyword(&~"static");
|
||||
}
|
||||
|
||||
@ -3959,6 +3962,9 @@ fn parse_item_or_view_item(
|
||||
(self.is_keyword(&~"static") &&
|
||||
!self.token_is_keyword(&~"fn", &self.look_ahead(1)))) {
|
||||
// CONST ITEM
|
||||
if self.is_keyword(&~"const") {
|
||||
self.obsolete(*self.span, ObsoleteConstItem);
|
||||
}
|
||||
self.bump();
|
||||
let (ident, item_, extra_attrs) = self.parse_item_const();
|
||||
return iovi_item(self.mk_item(lo, self.last_span.hi, ident, item_,
|
||||
|
Loading…
Reference in New Issue
Block a user