From 3168fe06ff69970be329583f560a3ccd9c00c874 Mon Sep 17 00:00:00 2001 From: Niko Matsakis Date: Tue, 26 Feb 2013 14:34:00 -0500 Subject: Add manual &self/ and &static/ and /&self declarations that are currently inferred. New rules are coming that will require them to be explicit. All add some explicit self declarations. --- src/libsyntax/ext/deriving.rs | 22 ++++++++++------------ src/libsyntax/ext/expand.rs | 9 +++++---- src/libsyntax/print/pprust.rs | 4 ++-- src/libsyntax/visit.rs | 10 +++++----- 4 files changed, 22 insertions(+), 23 deletions(-) (limited to 'src/libsyntax') diff --git a/src/libsyntax/ext/deriving.rs b/src/libsyntax/ext/deriving.rs index 07896236442..8c12bbad360 100644 --- a/src/libsyntax/ext/deriving.rs +++ b/src/libsyntax/ext/deriving.rs @@ -46,18 +46,16 @@ pub impl Junction { } } -type ExpandDerivingStructDefFn = &fn(ext_ctxt, - span, - x: &struct_def, - ident, - y: &Generics) - -> @item; -type ExpandDerivingEnumDefFn = &fn(ext_ctxt, - span, - x: &enum_def, - ident, - y: &Generics) - -> @item; +type ExpandDerivingStructDefFn = &self/fn(ext_ctxt, + span, + x: &struct_def, + ident, + y: &Generics) -> @item; +type ExpandDerivingEnumDefFn = &self/fn(ext_ctxt, + span, + x: &enum_def, + ident, + y: &Generics) -> @item; pub fn expand_deriving_eq(cx: ext_ctxt, span: span, diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs index 03633a89a86..7b4f92ab3ca 100644 --- a/src/libsyntax/ext/expand.rs +++ b/src/libsyntax/ext/expand.rs @@ -442,11 +442,12 @@ pub fn core_macros() -> ~str { mod $c { fn key(_x: @::core::condition::Handler<$in,$out>) { } - pub const cond : ::core::condition::Condition<$in,$out> = + pub const cond : + ::core::condition::Condition/&static<$in,$out> = ::core::condition::Condition { - name: stringify!($c), - key: key - }; + name: stringify!($c), + key: key + }; } } ) diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs index 275f5a43397..3b4b198e595 100644 --- a/src/libsyntax/print/pprust.rs +++ b/src/libsyntax/print/pprust.rs @@ -35,8 +35,8 @@ use core::u64; use core::vec; // The @ps is stored here to prevent recursive type. -pub enum ann_node/& { - node_block(@ps, &ast::blk), +pub enum ann_node<'self> { + node_block(@ps, &'self ast::blk), node_item(@ps, @ast::item), node_expr(@ps, @ast::expr), node_pat(@ps, @ast::pat), diff --git a/src/libsyntax/visit.rs b/src/libsyntax/visit.rs index 4cc97dad97c..5e97793b480 100644 --- a/src/libsyntax/visit.rs +++ b/src/libsyntax/visit.rs @@ -28,14 +28,14 @@ use opt_vec::OptVec; // hold functions that take visitors. A vt enum is used to break the cycle. pub enum vt { mk_vt(visitor), } -pub enum fn_kind { - fk_item_fn(ident, &Generics, purity), // fn foo() - fk_method(ident, &Generics, &method), // fn foo(&self) +pub enum fn_kind<'self> { + fk_item_fn(ident, &'self Generics, purity), // fn foo() + fk_method(ident, &'self Generics, &'self method), // fn foo(&self) fk_anon(ast::Sigil), // fn@(x, y) { ... } fk_fn_block, // |x, y| ... fk_dtor( // class destructor - &Generics, - &[attribute], + &'self Generics, + &'self [attribute], node_id /* self id */, def_id /* parent class id */ ) -- cgit 1.4.1-3-g733a5