diff options
| author | Huon Wilson <dbau.pp+github@gmail.com> | 2014-02-02 00:08:39 +1100 |
|---|---|---|
| committer | Huon Wilson <dbau.pp+github@gmail.com> | 2014-02-02 02:59:04 +1100 |
| commit | e39cd20a4311f6e1377a01462cda5a89a4e67c15 (patch) | |
| tree | 821d2b61e6eaee5b25742fbe9175cf65baf1797f /src/libsyntax/parse | |
| parent | aadcf29766553a6b6ed8a3c2f50193ebd674b7a7 (diff) | |
| download | rust-e39cd20a4311f6e1377a01462cda5a89a4e67c15.tar.gz rust-e39cd20a4311f6e1377a01462cda5a89a4e67c15.zip | |
syntax: remove the handling of @str and @[] from the parser completely.
Diffstat (limited to 'src/libsyntax/parse')
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 39 |
1 files changed, 9 insertions, 30 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index ec2a13c5a0f..aa33edf28f5 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -29,7 +29,7 @@ use ast::{ExprField, ExprFnBlock, ExprIf, ExprIndex}; use ast::{ExprLit, ExprLogLevel, ExprLoop, ExprMac}; use ast::{ExprMethodCall, ExprParen, ExprPath, ExprProc}; use ast::{ExprRepeat, ExprRet, ExprStruct, ExprTup, ExprUnary}; -use ast::{ExprVec, ExprVstore, ExprVstoreSlice, ExprVstoreBox}; +use ast::{ExprVec, ExprVstore, ExprVstoreSlice}; use ast::{ExprVstoreMutSlice, ExprWhile, ExprForLoop, ExternFn, Field, FnDecl}; use ast::{ExprVstoreUniq, Onceness, Once, Many}; use ast::{ForeignItem, ForeignItemStatic, ForeignItemFn, ForeignMod}; @@ -2291,16 +2291,18 @@ impl Parser { self.bump(); let e = self.parse_prefix_expr(); hi = e.span.hi; - // HACK: turn @[...] into a @-vec + // HACK: pretending @[] is a (removed) @-vec ex = match e.node { ExprVec(..) | ExprRepeat(..) => { self.obsolete(e.span, ObsoleteManagedVec); - ExprVstore(e, ExprVstoreBox) + // the above error means that no-one will know we're + // lying... hopefully. + ExprVstore(e, ExprVstoreUniq) } ExprLit(lit) if lit_is_str(lit) => { self.obsolete(self.last_span, ObsoleteManagedString); - ExprVstore(e, ExprVstoreBox) + ExprVstore(e, ExprVstoreUniq) } _ => self.mk_unary(UnBox, e) }; @@ -2819,34 +2821,11 @@ impl Parser { token::AT => { self.bump(); let sub = self.parse_pat(); - hi = sub.span.hi; - // HACK: parse @"..." as a literal of a vstore @str - pat = match sub.node { - PatLit(e) => { - match e.node { - ExprLit(lit) if lit_is_str(lit) => { - let vst = @Expr { - id: ast::DUMMY_NODE_ID, - node: ExprVstore(e, ExprVstoreBox), - span: mk_sp(lo, hi), - }; - PatLit(vst) - } - _ => { - self.obsolete(self.span, ObsoleteManagedPattern); - PatUniq(sub) - } - } - } - _ => { - self.obsolete(self.span, ObsoleteManagedPattern); - PatUniq(sub) - } - }; - hi = self.last_span.hi; + self.obsolete(self.span, ObsoleteManagedPattern); + let hi = self.last_span.hi; return @ast::Pat { id: ast::DUMMY_NODE_ID, - node: pat, + node: sub, span: mk_sp(lo, hi) } } |
