about summary refs log tree commit diff
path: root/src/libsyntax/parse/parser.rs
diff options
context:
space:
mode:
authorPatrick Walton <pcwalton@mimiga.net>2013-03-12 19:32:14 -0700
committerPatrick Walton <pcwalton@mimiga.net>2013-03-13 20:07:10 -0700
commit8fa66e8e07ca565119de195ceefb20cff50ae1ea (patch)
treef9ae9910b40b04ae62daff56b8de1ae002765d2e /src/libsyntax/parse/parser.rs
parenta410652bc953137c8d579f218c2e3e68a9ef8c1c (diff)
downloadrust-8fa66e8e07ca565119de195ceefb20cff50ae1ea.tar.gz
rust-8fa66e8e07ca565119de195ceefb20cff50ae1ea.zip
librustc: Remove implicit self from the language, except for old-style drop blocks.
Diffstat (limited to 'src/libsyntax/parse/parser.rs')
-rw-r--r--src/libsyntax/parse/parser.rs10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index 0f06976249b..815a8bfab5d 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -78,7 +78,7 @@ use parse::obsolete::{ObsoleteMutVector, ObsoleteTraitImplVisibility};
 use parse::obsolete::{ObsoleteRecordType, ObsoleteRecordPattern};
 use parse::obsolete::{ObsoleteAssertion, ObsoletePostFnTySigil};
 use parse::obsolete::{ObsoleteBareFnType, ObsoleteNewtypeEnum};
-use parse::obsolete::{ObsoleteMode};
+use parse::obsolete::{ObsoleteMode, ObsoleteImplicitSelf};
 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};
@@ -471,6 +471,10 @@ pub impl Parser {
             // XXX: Wrong. Shouldn't allow both static and self_ty
             let self_ty = if is_static { static_sty } else { self_ty };
 
+            if self_ty.node == sty_by_ref {
+                self.obsolete(self_ty.span, ObsoleteImplicitSelf);
+            }
+
             let hi = p.last_span.hi;
             debug!("parse_trait_methods(): trait method signature ends in \
                     `%s`",
@@ -2981,6 +2985,10 @@ pub impl Parser {
         // XXX: interaction between staticness, self_ty is broken now
         let self_ty = if is_static { static_sty} else { self_ty };
 
+        if self_ty.node == sty_by_ref {
+            self.obsolete(self_ty.span, ObsoleteImplicitSelf);
+        }
+
         let (inner_attrs, body) = self.parse_inner_attrs_and_block(true);
         let hi = body.span.hi;
         let attrs = vec::append(attrs, inner_attrs);