about summary refs log tree commit diff
path: root/src/libsyntax/ext/deriving/generic
diff options
context:
space:
mode:
authorMarvin Löbel <loebel.marvin@gmail.com>2015-02-10 14:55:45 +0100
committerMarvin Löbel <loebel.marvin@gmail.com>2015-02-12 22:04:31 +0100
commit07d00deab22dc07ffc58b8e74d45596242ca8b15 (patch)
tree4171afb6d0be091c7a72224d326a558256ee30f0 /src/libsyntax/ext/deriving/generic
parentde8bc44753881aacdaf435f5ba61de3c20916761 (diff)
Made `Self` a keyword.
It is only allowed in paths now, where it will either work inside a `trait`
or `impl` item, or not resolve outside of it.

[breaking-change]

Closes #22137
Diffstat (limited to 'src/libsyntax/ext/deriving/generic')
-rw-r--r--src/libsyntax/ext/deriving/generic/mod.rs8
-rw-r--r--src/libsyntax/ext/deriving/generic/ty.rs8
2 files changed, 8 insertions, 8 deletions
diff --git a/src/libsyntax/ext/deriving/generic/mod.rs b/src/libsyntax/ext/deriving/generic/mod.rs
index d9242417e04..f878cb5ca8b 100644
--- a/src/libsyntax/ext/deriving/generic/mod.rs
+++ b/src/libsyntax/ext/deriving/generic/mod.rs
@@ -207,7 +207,7 @@ use parse::token::InternedString;
 use parse::token::special_idents;
 use ptr::P;
 
-use self::ty::{LifetimeBounds, Path, Ptr, PtrTy, Self, Ty};
+use self::ty::{LifetimeBounds, Path, Ptr, PtrTy, Self_, Ty};
 
 pub mod ty;
 
@@ -261,7 +261,7 @@ pub struct Substructure<'a> {
     pub type_ident: Ident,
     /// ident of the method
     pub method_ident: Ident,
-    /// dereferenced access to any `Self` or `Ptr(Self, _)` arguments
+    /// dereferenced access to any `Self_` or `Ptr(Self_, _)` arguments
     pub self_args: &'a [P<Expr>],
     /// verbatim access to any other arguments
     pub nonself_args: &'a [P<Expr>],
@@ -679,10 +679,10 @@ impl<'a> MethodDef<'a> {
             match *ty {
                 // for static methods, just treat any Self
                 // arguments as a normal arg
-                Self if nonstatic  => {
+                Self_ if nonstatic  => {
                     self_args.push(arg_expr);
                 }
-                Ptr(box Self, _) if nonstatic => {
+                Ptr(box Self_, _) if nonstatic => {
                     self_args.push(cx.expr_deref(trait_.span, arg_expr))
                 }
                 _ => {
diff --git a/src/libsyntax/ext/deriving/generic/ty.rs b/src/libsyntax/ext/deriving/generic/ty.rs
index bbca5c599b1..ec13b86a8ae 100644
--- a/src/libsyntax/ext/deriving/generic/ty.rs
+++ b/src/libsyntax/ext/deriving/generic/ty.rs
@@ -87,7 +87,7 @@ impl<'a> Path<'a> {
 /// A type. Supports pointers, Self, and literals
 #[derive(Clone)]
 pub enum Ty<'a> {
-    Self,
+    Self_,
     /// &/Box/ Ty
     Ptr(Box<Ty<'a>>, PtrTy<'a>),
     /// mod::mod::Type<[lifetime], [Params...]>, including a plain type
@@ -109,7 +109,7 @@ pub fn borrowed_explicit_self<'r>() -> Option<Option<PtrTy<'r>>> {
 }
 
 pub fn borrowed_self<'r>() -> Ty<'r> {
-    borrowed(box Self)
+    borrowed(box Self_)
 }
 
 pub fn nil_ty<'r>() -> Ty<'r> {
@@ -149,7 +149,7 @@ impl<'a> Ty<'a> {
                 }
             }
             Literal(ref p) => { p.to_ty(cx, span, self_ty, self_generics) }
-            Self  => {
+            Self_  => {
                 cx.ty_path(self.to_path(cx, span, self_ty, self_generics))
             }
             Tuple(ref fields) => {
@@ -168,7 +168,7 @@ impl<'a> Ty<'a> {
                    self_generics: &Generics)
                    -> ast::Path {
         match *self {
-            Self => {
+            Self_ => {
                 let self_params = self_generics.ty_params.map(|ty_param| {
                     cx.ty_ident(span, ty_param.ident)
                 });