diff options
| author | Patrick Walton <pcwalton@mimiga.net> | 2014-07-23 10:21:50 -0700 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2014-07-24 07:26:03 -0700 |
| commit | bb165eb5c21b057cb63a4421d6233e82deac4cba (patch) | |
| tree | d322e182d6fea0796e00883954cd0a250c4b7fa4 /src/libsyntax/parse/parser.rs | |
| parent | 57cade574418e9507c67ba5177bc177cc7771721 (diff) | |
| download | rust-bb165eb5c21b057cb63a4421d6233e82deac4cba.tar.gz rust-bb165eb5c21b057cb63a4421d6233e82deac4cba.zip | |
libsyntax: Remove `~self` and `mut ~self` from the language.
This eliminates the last vestige of the `~` syntax. Instead of `~self`, write `self: Box<TypeOfSelf>`; instead of `mut ~self`, write `mut self: Box<TypeOfSelf>`, replacing `TypeOfSelf` with the self-type parameter as specified in the implementation. Closes #13885. [breaking-change]
Diffstat (limited to 'src/libsyntax/parse/parser.rs')
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index bfc01afd457..ac363163673 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -45,7 +45,7 @@ use ast::{RetStyle, Return, BiShl, BiShr, Stmt, StmtDecl}; use ast::{StmtExpr, StmtSemi, StmtMac, StructDef, StructField}; use ast::{StructVariantKind, BiSub}; use ast::StrStyle; -use ast::{SelfExplicit, SelfRegion, SelfStatic, SelfUniq, SelfValue}; +use ast::{SelfExplicit, SelfRegion, SelfStatic, SelfValue}; use ast::{TokenTree, TraitMethod, TraitRef, TTDelim, TTSeq, TTTok}; use ast::{TTNonterminal, TupleVariantKind, Ty, Ty_, TyBot, TyBox}; use ast::{TypeField, TyFixedLengthVec, TyClosure, TyProc, TyBareFn}; @@ -3826,10 +3826,11 @@ impl<'a> Parser<'a> { // We need to make sure it isn't a type if self.look_ahead(1, |t| token::is_keyword(keywords::Self, t)) { self.bump(); - SelfUniq(self.expect_self_ident()) - } else { - SelfStatic + drop(self.expect_self_ident()); + let last_span = self.last_span; + self.obsolete(last_span, ObsoleteOwnedSelf) } + SelfStatic } token::IDENT(..) if self.is_self_ident() => { let self_ident = self.expect_self_ident(); @@ -3877,7 +3878,10 @@ impl<'a> Parser<'a> { self.look_ahead(2, |t| token::is_keyword(keywords::Self, t)) => { mutbl_self = self.parse_mutability(); self.bump(); - SelfUniq(self.expect_self_ident()) + drop(self.expect_self_ident()); + let last_span = self.last_span; + self.obsolete(last_span, ObsoleteOwnedSelf); + SelfStatic } _ => SelfStatic }; @@ -3921,7 +3925,6 @@ impl<'a> Parser<'a> { } SelfValue(id) => parse_remaining_arguments!(id), SelfRegion(_,_,id) => parse_remaining_arguments!(id), - SelfUniq(id) => parse_remaining_arguments!(id), SelfExplicit(_,id) => parse_remaining_arguments!(id), }; |
