about summary refs log tree commit diff
path: root/src/libsyntax
diff options
context:
space:
mode:
Diffstat (limited to 'src/libsyntax')
-rw-r--r--src/libsyntax/ast.rs2
-rw-r--r--src/libsyntax/fold.rs2
-rw-r--r--src/libsyntax/parse/obsolete.rs5
-rw-r--r--src/libsyntax/parse/parser.rs15
-rw-r--r--src/libsyntax/print/pprust.rs3
-rw-r--r--src/libsyntax/visit.rs2
6 files changed, 16 insertions, 13 deletions
diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs
index 614bbd1c3ed..f05d17569f6 100644
--- a/src/libsyntax/ast.rs
+++ b/src/libsyntax/ast.rs
@@ -955,8 +955,6 @@ pub enum ExplicitSelf_ {
     SelfValue(Ident),
     /// `&'lt self`, `&'lt mut self`
     SelfRegion(Option<Lifetime>, Mutability, Ident),
-    /// `~self`
-    SelfUniq(Ident),
     /// `self: TYPE`
     SelfExplicit(P<Ty>, Ident),
 }
diff --git a/src/libsyntax/fold.rs b/src/libsyntax/fold.rs
index 271eee7d08a..f48306bc6ee 100644
--- a/src/libsyntax/fold.rs
+++ b/src/libsyntax/fold.rs
@@ -340,7 +340,7 @@ pub trait Folder {
 
     fn fold_explicit_self_(&mut self, es: &ExplicitSelf_) -> ExplicitSelf_ {
         match *es {
-            SelfStatic | SelfValue(_) | SelfUniq(_) => *es,
+            SelfStatic | SelfValue(_) => *es,
             SelfRegion(ref lifetime, m, id) => {
                 SelfRegion(fold_opt_lifetime(lifetime, self), m, id)
             }
diff --git a/src/libsyntax/parse/obsolete.rs b/src/libsyntax/parse/obsolete.rs
index ba401d313d8..afcf84753a6 100644
--- a/src/libsyntax/parse/obsolete.rs
+++ b/src/libsyntax/parse/obsolete.rs
@@ -31,6 +31,7 @@ pub enum ObsoleteSyntax {
     ObsoleteOwnedExpr,
     ObsoleteOwnedPattern,
     ObsoleteOwnedVector,
+    ObsoleteOwnedSelf,
     ObsoleteManagedType,
     ObsoleteManagedExpr,
 }
@@ -70,6 +71,10 @@ impl<'a> ParserObsoleteMethods for parser::Parser<'a> {
                 "`~[T]` is no longer a type",
                 "use the `Vec` type instead"
             ),
+            ObsoleteOwnedSelf => (
+                "`~self` is no longer supported",
+                "write `self: Box<Self>` instead"
+            ),
             ObsoleteManagedType => (
                 "`@` notation for managed pointers",
                 "use `Gc<T>` in `std::gc` instead"
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),
         };
 
diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs
index 305e67a916e..ac835565191 100644
--- a/src/libsyntax/print/pprust.rs
+++ b/src/libsyntax/print/pprust.rs
@@ -1892,9 +1892,6 @@ impl<'a> State<'a> {
             ast::SelfValue(_) => {
                 try!(word(&mut self.s, "self"));
             }
-            ast::SelfUniq(_) => {
-                try!(word(&mut self.s, "~self"));
-            }
             ast::SelfRegion(ref lt, m, _) => {
                 try!(word(&mut self.s, "&"));
                 try!(self.print_opt_lifetime(lt));
diff --git a/src/libsyntax/visit.rs b/src/libsyntax/visit.rs
index 3c6f06ddfc3..371fae53b41 100644
--- a/src/libsyntax/visit.rs
+++ b/src/libsyntax/visit.rs
@@ -216,7 +216,7 @@ pub fn walk_explicit_self<E: Clone, V: Visitor<E>>(visitor: &mut V,
                                                    explicit_self: &ExplicitSelf,
                                                    env: E) {
     match explicit_self.node {
-        SelfStatic | SelfValue(_) | SelfUniq(_) => {},
+        SelfStatic | SelfValue(_) => {},
         SelfRegion(ref lifetime, _, _) => {
             visitor.visit_opt_lifetime_ref(explicit_self.span, lifetime, env)
         }