diff options
| author | bors <bors@rust-lang.org> | 2013-03-22 13:00:56 -0700 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2013-03-22 13:00:56 -0700 |
| commit | e9b077c0e94f101a3121a7d615f46366ea4080bf (patch) | |
| tree | dc19fd536559f43d6ba3fbca2a83a489c421cfe1 /src/libsyntax | |
| parent | b6f9aa1fd75f0e9468b3bb9ee10a95d18c40b567 (diff) | |
| parent | 3eda11a4f79103a7f6d73c38e5e4f0880e26cc3c (diff) | |
| download | rust-e9b077c0e94f101a3121a7d615f46366ea4080bf.tar.gz rust-e9b077c0e94f101a3121a7d615f46366ea4080bf.zip | |
auto merge of #5488 : pcwalton/rust/depure, r=pcwalton
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/ast.rs | 46 | ||||
| -rw-r--r-- | src/libsyntax/ast_map.rs | 4 | ||||
| -rw-r--r-- | src/libsyntax/ast_util.rs | 47 | ||||
| -rw-r--r-- | src/libsyntax/attr.rs | 8 | ||||
| -rw-r--r-- | src/libsyntax/codemap.rs | 66 | ||||
| -rw-r--r-- | src/libsyntax/ext/auto_encode.rs | 4 | ||||
| -rw-r--r-- | src/libsyntax/ext/base.rs | 12 | ||||
| -rw-r--r-- | src/libsyntax/ext/pipes/proto.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/ext/tt/transcribe.rs | 8 | ||||
| -rw-r--r-- | src/libsyntax/opt_vec.rs | 42 | ||||
| -rw-r--r-- | src/libsyntax/parse/comments.rs | 4 | ||||
| -rw-r--r-- | src/libsyntax/parse/common.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/parse/lexer.rs | 10 | ||||
| -rw-r--r-- | src/libsyntax/parse/obsolete.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 6 | ||||
| -rw-r--r-- | src/libsyntax/parse/token.rs | 14 | ||||
| -rw-r--r-- | src/libsyntax/print/pprust.rs | 4 | ||||
| -rw-r--r-- | src/libsyntax/util/interner.rs | 6 |
18 files changed, 143 insertions, 144 deletions
diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index cbdcef3eff6..c37d9d1c1c4 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -75,7 +75,7 @@ impl<S:Encoder> Encodable<S> for ident { } impl<D:Decoder> Decodable<D> for ident { - static fn decode(d: &D) -> ident { + fn decode(d: &D) -> ident { let intr = match unsafe { task::local_data::local_data_get(interner_key!()) } { @@ -88,7 +88,7 @@ impl<D:Decoder> Decodable<D> for ident { } impl to_bytes::IterBytes for ident { - pure fn iter_bytes(&self, +lsb0: bool, f: to_bytes::Cb) { + fn iter_bytes(&self, +lsb0: bool, f: to_bytes::Cb) { self.repr.iter_bytes(lsb0, f) } } @@ -274,7 +274,7 @@ pub enum binding_mode { } impl to_bytes::IterBytes for binding_mode { - pure fn iter_bytes(&self, +lsb0: bool, f: to_bytes::Cb) { + fn iter_bytes(&self, +lsb0: bool, f: to_bytes::Cb) { match *self { bind_by_copy => 0u8.iter_bytes(lsb0, f), @@ -320,7 +320,7 @@ pub enum pat_ { pub enum mutability { m_mutbl, m_imm, m_const, } impl to_bytes::IterBytes for mutability { - pure fn iter_bytes(&self, +lsb0: bool, f: to_bytes::Cb) { + fn iter_bytes(&self, +lsb0: bool, f: to_bytes::Cb) { (*self as u8).iter_bytes(lsb0, f) } } @@ -333,13 +333,13 @@ pub enum Abi { } impl to_bytes::IterBytes for Abi { - pure fn iter_bytes(&self, +lsb0: bool, f: to_bytes::Cb) { + fn iter_bytes(&self, +lsb0: bool, f: to_bytes::Cb) { (*self as uint).iter_bytes(lsb0, f) } } impl ToStr for Abi { - pure fn to_str(&self) -> ~str { + fn to_str(&self) -> ~str { match *self { RustAbi => ~"\"rust\"" } @@ -356,13 +356,13 @@ pub enum Sigil { } impl to_bytes::IterBytes for Sigil { - pure fn iter_bytes(&self, +lsb0: bool, f: to_bytes::Cb) { + fn iter_bytes(&self, +lsb0: bool, f: to_bytes::Cb) { (*self as uint).iter_bytes(lsb0, f) } } impl ToStr for Sigil { - pure fn to_str(&self) -> ~str { + fn to_str(&self) -> ~str { match *self { BorrowedSigil => ~"&", OwnedSigil => ~"~", @@ -440,7 +440,7 @@ pub enum inferable<T> { } impl<T:to_bytes::IterBytes> to_bytes::IterBytes for inferable<T> { - pure fn iter_bytes(&self, +lsb0: bool, f: to_bytes::Cb) { + fn iter_bytes(&self, +lsb0: bool, f: to_bytes::Cb) { match *self { expl(ref t) => to_bytes::iter_bytes_2(&0u8, t, lsb0, f), @@ -458,7 +458,7 @@ impl<T:to_bytes::IterBytes> to_bytes::IterBytes for inferable<T> { pub enum rmode { by_ref, by_copy } impl to_bytes::IterBytes for rmode { - pure fn iter_bytes(&self, +lsb0: bool, f: to_bytes::Cb) { + fn iter_bytes(&self, +lsb0: bool, f: to_bytes::Cb) { (*self as u8).iter_bytes(lsb0, f) } } @@ -796,13 +796,13 @@ pub enum trait_method { pub enum int_ty { ty_i, ty_char, ty_i8, ty_i16, ty_i32, ty_i64, } impl ToStr for int_ty { - pure fn to_str(&self) -> ~str { + fn to_str(&self) -> ~str { ::ast_util::int_ty_to_str(*self) } } impl to_bytes::IterBytes for int_ty { - pure fn iter_bytes(&self, +lsb0: bool, f: to_bytes::Cb) { + fn iter_bytes(&self, +lsb0: bool, f: to_bytes::Cb) { (*self as u8).iter_bytes(lsb0, f) } } @@ -813,13 +813,13 @@ impl to_bytes::IterBytes for int_ty { pub enum uint_ty { ty_u, ty_u8, ty_u16, ty_u32, ty_u64, } impl ToStr for uint_ty { - pure fn to_str(&self) -> ~str { + fn to_str(&self) -> ~str { ::ast_util::uint_ty_to_str(*self) } } impl to_bytes::IterBytes for uint_ty { - pure fn iter_bytes(&self, +lsb0: bool, f: to_bytes::Cb) { + fn iter_bytes(&self, +lsb0: bool, f: to_bytes::Cb) { (*self as u8).iter_bytes(lsb0, f) } } @@ -830,13 +830,13 @@ impl to_bytes::IterBytes for uint_ty { pub enum float_ty { ty_f, ty_f32, ty_f64, } impl ToStr for float_ty { - pure fn to_str(&self) -> ~str { + fn to_str(&self) -> ~str { ::ast_util::float_ty_to_str(*self) } } impl to_bytes::IterBytes for float_ty { - pure fn iter_bytes(&self, +lsb0: bool, f: to_bytes::Cb) { + fn iter_bytes(&self, +lsb0: bool, f: to_bytes::Cb) { (*self as u8).iter_bytes(lsb0, f) } } @@ -872,7 +872,7 @@ pub enum Onceness { } impl ToStr for Onceness { - pure fn to_str(&self) -> ~str { + fn to_str(&self) -> ~str { match *self { Once => ~"once", Many => ~"many" @@ -881,7 +881,7 @@ impl ToStr for Onceness { } impl to_bytes::IterBytes for Onceness { - pure fn iter_bytes(&self, +lsb0: bool, f: to_bytes::Cb) { + fn iter_bytes(&self, +lsb0: bool, f: to_bytes::Cb) { (*self as uint).iter_bytes(lsb0, f); } } @@ -930,7 +930,7 @@ pub enum ty_ { } impl to_bytes::IterBytes for Ty { - pure fn iter_bytes(&self, +lsb0: bool, f: to_bytes::Cb) { + fn iter_bytes(&self, +lsb0: bool, f: to_bytes::Cb) { to_bytes::iter_bytes_2(&self.span.lo, &self.span.hi, lsb0, f); } } @@ -966,7 +966,7 @@ pub enum purity { } impl ToStr for purity { - pure fn to_str(&self) -> ~str { + fn to_str(&self) -> ~str { match *self { impure_fn => ~"impure", unsafe_fn => ~"unsafe", @@ -977,7 +977,7 @@ impl ToStr for purity { } impl to_bytes::IterBytes for purity { - pure fn iter_bytes(&self, +lsb0: bool, f: to_bytes::Cb) { + fn iter_bytes(&self, +lsb0: bool, f: to_bytes::Cb) { (*self as u8).iter_bytes(lsb0, f) } } @@ -992,7 +992,7 @@ pub enum ret_style { } impl to_bytes::IterBytes for ret_style { - pure fn iter_bytes(&self, +lsb0: bool, f: to_bytes::Cb) { + fn iter_bytes(&self, +lsb0: bool, f: to_bytes::Cb) { (*self as u8).iter_bytes(lsb0, f) } } @@ -1278,7 +1278,7 @@ pub enum item_ { pub enum struct_mutability { struct_mutable, struct_immutable } impl to_bytes::IterBytes for struct_mutability { - pure fn iter_bytes(&self, +lsb0: bool, f: to_bytes::Cb) { + fn iter_bytes(&self, +lsb0: bool, f: to_bytes::Cb) { (*self as u8).iter_bytes(lsb0, f) } } diff --git a/src/libsyntax/ast_map.rs b/src/libsyntax/ast_map.rs index 9371055556e..8989bb88cd7 100644 --- a/src/libsyntax/ast_map.rs +++ b/src/libsyntax/ast_map.rs @@ -33,7 +33,7 @@ pub enum path_elt { } impl cmp::Eq for path_elt { - pure fn eq(&self, other: &path_elt) -> bool { + fn eq(&self, other: &path_elt) -> bool { match (*self) { path_mod(e0a) => { match (*other) { @@ -49,7 +49,7 @@ impl cmp::Eq for path_elt { } } } - pure fn ne(&self, other: &path_elt) -> bool { !(*self).eq(other) } + fn ne(&self, other: &path_elt) -> bool { !(*self).eq(other) } } pub type path = ~[path_elt]; diff --git a/src/libsyntax/ast_util.rs b/src/libsyntax/ast_util.rs index 1225e71cb8c..764393e0feb 100644 --- a/src/libsyntax/ast_util.rs +++ b/src/libsyntax/ast_util.rs @@ -24,22 +24,21 @@ use core::str; use core::to_bytes; use core::vec; -pub pure fn path_name_i(idents: &[ident], intr: @token::ident_interner) - -> ~str { +pub fn path_name_i(idents: &[ident], intr: @token::ident_interner) -> ~str { // FIXME: Bad copies (#2543 -- same for everything else that says "bad") str::connect(idents.map(|i| copy *intr.get(*i)), ~"::") } -pub pure fn path_to_ident(p: @path) -> ident { copy *p.idents.last() } +pub fn path_to_ident(p: @path) -> ident { copy *p.idents.last() } -pub pure fn local_def(id: node_id) -> def_id { +pub fn local_def(id: node_id) -> def_id { ast::def_id { crate: local_crate, node: id } } -pub pure fn is_local(did: ast::def_id) -> bool { did.crate == local_crate } +pub fn is_local(did: ast::def_id) -> bool { did.crate == local_crate } -pub pure fn stmt_id(s: stmt) -> node_id { +pub fn stmt_id(s: stmt) -> node_id { match s.node { stmt_decl(_, id) => id, stmt_expr(_, id) => id, @@ -57,7 +56,7 @@ pub fn variant_def_ids(d: def) -> (def_id, def_id) { } } -pub pure fn def_id_of_def(d: def) -> def_id { +pub fn def_id_of_def(d: def) -> def_id { match d { def_fn(id, _) | def_static_method(id, _, _) | def_mod(id) | def_foreign_mod(id) | def_const(id) | @@ -75,7 +74,7 @@ pub pure fn def_id_of_def(d: def) -> def_id { } } -pub pure fn binop_to_str(op: binop) -> ~str { +pub fn binop_to_str(op: binop) -> ~str { match op { add => return ~"+", subtract => return ~"-", @@ -98,7 +97,7 @@ pub pure fn binop_to_str(op: binop) -> ~str { } } -pub pure fn binop_to_method_name(op: binop) -> Option<~str> { +pub fn binop_to_method_name(op: binop) -> Option<~str> { match op { add => return Some(~"add"), subtract => return Some(~"sub"), @@ -120,7 +119,7 @@ pub pure fn binop_to_method_name(op: binop) -> Option<~str> { } } -pub pure fn lazy_binop(b: binop) -> bool { +pub fn lazy_binop(b: binop) -> bool { match b { and => true, or => true, @@ -128,7 +127,7 @@ pub pure fn lazy_binop(b: binop) -> bool { } } -pub pure fn is_shift_binop(b: binop) -> bool { +pub fn is_shift_binop(b: binop) -> bool { match b { shl => true, shr => true, @@ -136,7 +135,7 @@ pub pure fn is_shift_binop(b: binop) -> bool { } } -pub pure fn unop_to_str(op: unop) -> ~str { +pub fn unop_to_str(op: unop) -> ~str { match op { box(mt) => if mt == m_mutbl { ~"@mut " } else { ~"@" }, uniq(mt) => if mt == m_mutbl { ~"~mut " } else { ~"~" }, @@ -146,11 +145,11 @@ pub pure fn unop_to_str(op: unop) -> ~str { } } -pub pure fn is_path(e: @expr) -> bool { +pub fn is_path(e: @expr) -> bool { return match e.node { expr_path(_) => true, _ => false }; } -pub pure fn int_ty_to_str(t: int_ty) -> ~str { +pub fn int_ty_to_str(t: int_ty) -> ~str { match t { ty_char => ~"u8", // ??? ty_i => ~"", @@ -161,7 +160,7 @@ pub pure fn int_ty_to_str(t: int_ty) -> ~str { } } -pub pure fn int_ty_max(t: int_ty) -> u64 { +pub fn int_ty_max(t: int_ty) -> u64 { match t { ty_i8 => 0x80u64, ty_i16 => 0x8000u64, @@ -170,7 +169,7 @@ pub pure fn int_ty_max(t: int_ty) -> u64 { } } -pub pure fn uint_ty_to_str(t: uint_ty) -> ~str { +pub fn uint_ty_to_str(t: uint_ty) -> ~str { match t { ty_u => ~"u", ty_u8 => ~"u8", @@ -180,7 +179,7 @@ pub pure fn uint_ty_to_str(t: uint_ty) -> ~str { } } -pub pure fn uint_ty_max(t: uint_ty) -> u64 { +pub fn uint_ty_max(t: uint_ty) -> u64 { match t { ty_u8 => 0xffu64, ty_u16 => 0xffffu64, @@ -189,18 +188,18 @@ pub pure fn uint_ty_max(t: uint_ty) -> u64 { } } -pub pure fn float_ty_to_str(t: float_ty) -> ~str { +pub fn float_ty_to_str(t: float_ty) -> ~str { match t { ty_f => ~"f", ty_f32 => ~"f32", ty_f64 => ~"f64" } } -pub pure fn is_call_expr(e: @expr) -> bool { +pub fn is_call_expr(e: @expr) -> bool { match e.node { expr_call(_, _, _) => true, _ => false } } // This makes def_id hashable impl to_bytes::IterBytes for def_id { #[inline(always)] - pure fn iter_bytes(&self, +lsb0: bool, f: to_bytes::Cb) { + fn iter_bytes(&self, +lsb0: bool, f: to_bytes::Cb) { to_bytes::iter_bytes_2(&self.crate, &self.node, lsb0, f); } } @@ -238,14 +237,14 @@ pub fn ident_to_pat(id: node_id, s: span, +i: ident) -> @pat { span: s } } -pub pure fn is_unguarded(a: &arm) -> bool { +pub fn is_unguarded(a: &arm) -> bool { match a.guard { None => true, _ => false } } -pub pure fn unguarded_pat(a: &arm) -> Option<~[@pat]> { +pub fn unguarded_pat(a: &arm) -> Option<~[@pat]> { if is_unguarded(a) { Some(/* FIXME (#2543) */ copy a.pats) } else { None } } @@ -290,7 +289,7 @@ pub fn split_trait_methods(trait_methods: &[trait_method]) (reqd, provd) } -pub pure fn struct_field_visibility(field: ast::struct_field) -> visibility { +pub fn struct_field_visibility(field: ast::struct_field) -> visibility { match field.node.kind { ast::named_field(_, _, visibility) => visibility, ast::unnamed_field => ast::public @@ -509,7 +508,7 @@ pub fn compute_id_range_for_inlined_item(item: inlined_item) -> id_range { compute_id_range(|f| visit_ids_for_inlined_item(item, f)) } -pub pure fn is_item_impl(item: @ast::item) -> bool { +pub fn is_item_impl(item: @ast::item) -> bool { match item.node { item_impl(*) => true, _ => false diff --git a/src/libsyntax/attr.rs b/src/libsyntax/attr.rs index a410d6cf8e3..b22d71afaed 100644 --- a/src/libsyntax/attr.rs +++ b/src/libsyntax/attr.rs @@ -89,11 +89,11 @@ pub fn desugar_doc_attr(attr: &ast::attribute) -> ast::attribute { /* Accessors */ -pub pure fn get_attr_name(attr: &ast::attribute) -> @~str { +pub fn get_attr_name(attr: &ast::attribute) -> @~str { get_meta_item_name(attr.node.value) } -pub pure fn get_meta_item_name(meta: @ast::meta_item) -> @~str { +pub fn get_meta_item_name(meta: @ast::meta_item) -> @~str { match meta.node { ast::meta_word(n) => n, ast::meta_name_value(n, _) => n, @@ -333,10 +333,10 @@ pub enum inline_attr { } impl cmp::Eq for inline_attr { - pure fn eq(&self, other: &inline_attr) -> bool { + fn eq(&self, other: &inline_attr) -> bool { ((*self) as uint) == ((*other) as uint) } - pure fn ne(&self, other: &inline_attr) -> bool { !(*self).eq(other) } + fn ne(&self, other: &inline_attr) -> bool { !(*self).eq(other) } } /// True if something like #[inline] is found in the list of attrs. diff --git a/src/libsyntax/codemap.rs b/src/libsyntax/codemap.rs index c84e3abf50b..c082f4c0838 100644 --- a/src/libsyntax/codemap.rs +++ b/src/libsyntax/codemap.rs @@ -30,8 +30,8 @@ use core::uint; use std::serialize::{Encodable, Decodable, Encoder, Decoder}; pub trait Pos { - static pure fn from_uint(n: uint) -> Self; - pure fn to_uint(&self) -> uint; + fn from_uint(n: uint) -> Self; + fn to_uint(&self) -> uint; } /// A byte offset @@ -45,71 +45,71 @@ pub struct CharPos(uint); // have been unsuccessful impl Pos for BytePos { - static pure fn from_uint(n: uint) -> BytePos { BytePos(n) } - pure fn to_uint(&self) -> uint { **self } + fn from_uint(n: uint) -> BytePos { BytePos(n) } + fn to_uint(&self) -> uint { **self } } impl cmp::Eq for BytePos { - pure fn eq(&self, other: &BytePos) -> bool { **self == **other } - pure fn ne(&self, other: &BytePos) -> bool { !(*self).eq(other) } + fn eq(&self, other: &BytePos) -> bool { **self == **other } + fn ne(&self, other: &BytePos) -> bool { !(*self).eq(other) } } impl cmp::Ord for BytePos { - pure fn lt(&self, other: &BytePos) -> bool { **self < **other } - pure fn le(&self, other: &BytePos) -> bool { **self <= **other } - pure fn ge(&self, other: &BytePos) -> bool { **self >= **other } - pure fn gt(&self, other: &BytePos) -> bool { **self > **other } + fn lt(&self, other: &BytePos) -> bool { **self < **other } + fn le(&self, other: &BytePos) -> bool { **self <= **other } + fn ge(&self, other: &BytePos) -> bool { **self >= **other } + fn gt(&self, other: &BytePos) -> bool { **self > **other } } impl Add<BytePos, BytePos> for BytePos { - pure fn add(&self, rhs: &BytePos) -> BytePos { + fn add(&self, rhs: &BytePos) -> BytePos { BytePos(**self + **rhs) } } impl Sub<BytePos, BytePos> for BytePos { - pure fn sub(&self, rhs: &BytePos) -> BytePos { + fn sub(&self, rhs: &BytePos) -> BytePos { BytePos(**self - **rhs) } } impl to_bytes::IterBytes for BytePos { - pure fn iter_bytes(&self, +lsb0: bool, &&f: to_bytes::Cb) { + fn iter_bytes(&self, +lsb0: bool, &&f: to_bytes::Cb) { (**self).iter_bytes(lsb0, f) } } impl Pos for CharPos { - static pure fn from_uint(n: uint) -> CharPos { CharPos(n) } - pure fn to_uint(&self) -> uint { **self } + fn from_uint(n: uint) -> CharPos { CharPos(n) } + fn to_uint(&self) -> uint { **self } } impl cmp::Eq for CharPos { - pure fn eq(&self, other: &CharPos) -> bool { **self == **other } - pure fn ne(&self, other: &CharPos) -> bool { !(*self).eq(other) } + fn eq(&self, other: &CharPos) -> bool { **self == **other } + fn ne(&self, other: &CharPos) -> bool { !(*self).eq(other) } } impl cmp::Ord for CharPos { - pure fn lt(&self, other: &CharPos) -> bool { **self < **other } - pure fn le(&self, other: &CharPos) -> bool { **self <= **other } - pure fn ge(&self, other: &CharPos) -> bool { **self >= **other } - pure fn gt(&self, other: &CharPos) -> bool { **self > **other } + fn lt(&self, other: &CharPos) -> bool { **self < **other } + fn le(&self, other: &CharPos) -> bool { **self <= **other } + fn ge(&self, other: &CharPos) -> bool { **self >= **other } + fn gt(&self, other: &CharPos) -> bool { **self > **other } } impl to_bytes::IterBytes for CharPos { - pure fn iter_bytes(&self, +lsb0: bool, &&f: to_bytes::Cb) { + fn iter_bytes(&self, +lsb0: bool, &&f: to_bytes::Cb) { (**self).iter_bytes(lsb0, f) } } impl Add<CharPos,CharPos> for CharPos { - pure fn add(&self, rhs: &CharPos) -> CharPos { + fn add(&self, rhs: &CharPos) -> CharPos { CharPos(**self + **rhs) } } impl Sub<CharPos,CharPos> for CharPos { - pure fn sub(&self, rhs: &CharPos) -> CharPos { + fn sub(&self, rhs: &CharPos) -> CharPos { CharPos(**self - **rhs) } } @@ -132,10 +132,10 @@ pub struct span { pub struct spanned<T> { node: T, span: span } impl cmp::Eq for span { - pure fn eq(&self, other: &span) -> bool { + fn eq(&self, other: &span) -> bool { return (*self).lo == (*other).lo && (*self).hi == (*other).hi; } - pure fn ne(&self, other: &span) -> bool { !(*self).eq(other) } + fn ne(&self, other: &span) -> bool { !(*self).eq(other) } } impl<S:Encoder> Encodable<S> for span { @@ -144,30 +144,30 @@ impl<S:Encoder> Encodable<S> for span { } impl<D:Decoder> Decodable<D> for span { - static fn decode(_d: &D) -> span { + fn decode(_d: &D) -> span { dummy_sp() } } -pub pure fn spanned<T>(+lo: BytePos, +hi: BytePos, +t: T) -> spanned<T> { +pub fn spanned<T>(+lo: BytePos, +hi: BytePos, +t: T) -> spanned<T> { respan(mk_sp(lo, hi), t) } -pub pure fn respan<T>(sp: span, +t: T) -> spanned<T> { +pub fn respan<T>(sp: span, +t: T) -> spanned<T> { spanned {node: t, span: sp} } -pub pure fn dummy_spanned<T>(+t: T) -> spanned<T> { +pub fn dummy_spanned<T>(+t: T) -> spanned<T> { respan(dummy_sp(), t) } /* assuming that we're not in macro expansion */ -pub pure fn mk_sp(+lo: BytePos, +hi: BytePos) -> span { +pub fn mk_sp(+lo: BytePos, +hi: BytePos) -> span { span {lo: lo, hi: hi, expn_info: None} } // make this a const, once the compiler supports it -pub pure fn dummy_sp() -> span { return mk_sp(BytePos(0), BytePos(0)); } +pub fn dummy_sp() -> span { return mk_sp(BytePos(0), BytePos(0)); } @@ -286,7 +286,7 @@ pub struct CodeMap { } pub impl CodeMap { - static pub fn new() -> CodeMap { + pub fn new() -> CodeMap { CodeMap { files: @mut ~[], } diff --git a/src/libsyntax/ext/auto_encode.rs b/src/libsyntax/ext/auto_encode.rs index e5f818eef5c..54ca5dc0d72 100644 --- a/src/libsyntax/ext/auto_encode.rs +++ b/src/libsyntax/ext/auto_encode.rs @@ -32,7 +32,7 @@ impl<S:std::serialize::Encoder> Encodable<S> for Node { } impl<D:Decoder> Decodable for node_id { - static fn decode(d: &D) -> Node { + fn decode(d: &D) -> Node { do d.read_struct("Node", 1) { Node { id: d.read_field(~"x", 0, || decode(d)) @@ -66,7 +66,7 @@ would yield functions like: D: Decoder, T: Decodable<D> > spanned<T>: Decodable<D> { - static fn decode(d: &D) -> spanned<T> { + fn decode(d: &D) -> spanned<T> { do d.read_rec { { node: d.read_field(~"node", 0, || decode(d)), diff --git a/src/libsyntax/ext/base.rs b/src/libsyntax/ext/base.rs index 50f89d37fae..d93a997213d 100644 --- a/src/libsyntax/ext/base.rs +++ b/src/libsyntax/ext/base.rs @@ -231,7 +231,7 @@ pub trait ext_ctxt { fn span_bug(@mut self, sp: span, msg: &str) -> !; fn bug(@mut self, msg: &str) -> !; fn next_id(@mut self) -> ast::node_id; - pure fn trace_macros(@mut self) -> bool; + fn trace_macros(@mut self) -> bool; fn set_trace_macros(@mut self, x: bool); /* for unhygienic identifier transformation */ fn str_of(@mut self, id: ast::ident) -> ~str; @@ -310,7 +310,7 @@ pub fn mk_ctxt(parse_sess: @mut parse::ParseSess, +cfg: ast::crate_cfg) fn next_id(@mut self) -> ast::node_id { return parse::next_node_id(self.parse_sess); } - pure fn trace_macros(@mut self) -> bool { + fn trace_macros(@mut self) -> bool { self.trace_mac } fn set_trace_macros(@mut self, x: bool) { @@ -439,7 +439,7 @@ pub enum MapChain<K,V> { impl <K: Eq + Hash + IterBytes ,V: Copy> MapChain<K,V>{ // Constructor. I don't think we need a zero-arg one. - static fn new(+init: ~LinearMap<K,@V>) -> @mut MapChain<K,V> { + fn new(+init: ~LinearMap<K,@V>) -> @mut MapChain<K,V> { @mut BaseMapChain(init) } @@ -464,7 +464,7 @@ impl <K: Eq + Hash + IterBytes ,V: Copy> MapChain<K,V>{ // traits just don't work anywhere...? //pub impl Map<Name,SyntaxExtension> for MapChain { - pure fn contains_key (&self, key: &K) -> bool { + fn contains_key (&self, key: &K) -> bool { match *self { BaseMapChain (ref map) => map.contains_key(key), ConsMapChain (ref map,ref rest) => @@ -475,11 +475,11 @@ impl <K: Eq + Hash + IterBytes ,V: Copy> MapChain<K,V>{ // should each_key and each_value operate on shadowed // names? I think not. // delaying implementing this.... - pure fn each_key (&self, _f: &fn (&K)->bool) { + fn each_key (&self, _f: &fn (&K)->bool) { fail!(~"unimplemented 2013-02-15T10:01"); } - pure fn each_value (&self, _f: &fn (&V) -> bool) { + fn each_value (&self, _f: &fn (&V) -> bool) { fail!(~"unimplemented 2013-02-15T10:02"); } diff --git a/src/libsyntax/ext/pipes/proto.rs b/src/libsyntax/ext/pipes/proto.rs index d72da6f2d35..4a8ceedc8e3 100644 --- a/src/libsyntax/ext/pipes/proto.rs +++ b/src/libsyntax/ext/pipes/proto.rs @@ -21,7 +21,7 @@ use core::to_str::ToStr; pub enum direction { send, recv } impl ToStr for direction { - pure fn to_str(&self) -> ~str { + fn to_str(&self) -> ~str { match *self { send => ~"Send", recv => ~"Recv" diff --git a/src/libsyntax/ext/tt/transcribe.rs b/src/libsyntax/ext/tt/transcribe.rs index 0196ee6d184..49076c74972 100644 --- a/src/libsyntax/ext/tt/transcribe.rs +++ b/src/libsyntax/ext/tt/transcribe.rs @@ -79,7 +79,7 @@ pub fn new_tt_reader(sp_diag: @span_handler, return r; } -pure fn dup_tt_frame(f: @mut TtFrame) -> @mut TtFrame { +fn dup_tt_frame(f: @mut TtFrame) -> @mut TtFrame { @mut TtFrame { readme: @mut (copy *f.readme), idx: f.idx, @@ -92,7 +92,7 @@ pure fn dup_tt_frame(f: @mut TtFrame) -> @mut TtFrame { } } -pub pure fn dup_tt_reader(r: @mut TtReader) -> @mut TtReader { +pub fn dup_tt_reader(r: @mut TtReader) -> @mut TtReader { @mut TtReader { sp_diag: r.sp_diag, interner: r.interner, @@ -106,10 +106,10 @@ pub pure fn dup_tt_reader(r: @mut TtReader) -> @mut TtReader { } -pure fn lookup_cur_matched_by_matched(r: &mut TtReader, +fn lookup_cur_matched_by_matched(r: &mut TtReader, start: @named_match) -> @named_match { - pure fn red(+ad: @named_match, idx: &uint) -> @named_match { + fn red(+ad: @named_match, idx: &uint) -> @named_match { match *ad { matched_nonterminal(_) => { // end of the line; duplicate henceforth diff --git a/src/libsyntax/opt_vec.rs b/src/libsyntax/opt_vec.rs index 435bfbdad24..67c3d19dd0f 100644 --- a/src/libsyntax/opt_vec.rs +++ b/src/libsyntax/opt_vec.rs @@ -61,18 +61,18 @@ impl<T> OptVec<T> { } } - pure fn get(&self, i: uint) -> &'self T { + fn get(&self, i: uint) -> &'self T { match *self { Empty => fail!(fmt!("Invalid index %u", i)), Vec(ref v) => &v[i] } } - pure fn is_empty(&self) -> bool { + fn is_empty(&self) -> bool { self.len() == 0 } - pure fn len(&self) -> uint { + fn len(&self) -> uint { match *self { Empty => 0, Vec(ref v) => v.len() @@ -105,7 +105,7 @@ impl<T:Copy> OptVec<T> { } impl<A:Eq> Eq for OptVec<A> { - pure fn eq(&self, other: &OptVec<A>) -> bool { + fn eq(&self, other: &OptVec<A>) -> bool { // Note: cannot use #[deriving(Eq)] here because // (Empty, Vec(~[])) ought to be equal. match (self, other) { @@ -116,51 +116,51 @@ impl<A:Eq> Eq for OptVec<A> { } } - pure fn ne(&self, other: &OptVec<A>) -> bool { + fn ne(&self, other: &OptVec<A>) -> bool { !self.eq(other) } } impl<A> BaseIter<A> for OptVec<A> { - pure fn each(&self, blk: &fn(v: &A) -> bool) { + fn each(&self, blk: &fn(v: &A) -> bool) { match *self { Empty => {} Vec(ref v) => v.each(blk) } } - pure fn size_hint(&self) -> Option<uint> { + fn size_hint(&self) -> Option<uint> { Some(self.len()) } } impl<A> iter::ExtendedIter<A> for OptVec<A> { #[inline(always)] - pure fn eachi(&self, blk: &fn(+v: uint, v: &A) -> bool) { + fn eachi(&self, blk: &fn(+v: uint, v: &A) -> bool) { iter::eachi(self, blk) } #[inline(always)] - pure fn all(&self, blk: &fn(&A) -> bool) -> bool { + fn all(&self, blk: &fn(&A) -> bool) -> bool { iter::all(self, blk) } #[inline(always)] - pure fn any(&self, blk: &fn(&A) -> bool) -> bool { + fn any(&self, blk: &fn(&A) -> bool) -> bool { iter::any(self, blk) } #[inline(always)] - pure fn foldl<B>(&self, +b0: B, blk: &fn(&B, &A) -> B) -> B { + fn foldl<B>(&self, +b0: B, blk: &fn(&B, &A) -> B) -> B { iter::foldl(self, b0, blk) } #[inline(always)] - pure fn position(&self, f: &fn(&A) -> bool) -> Option<uint> { + fn position(&self, f: &fn(&A) -> bool) -> Option<uint> { iter::position(self, f) } #[inline(always)] - pure fn map_to_vec<B>(&self, op: &fn(&A) -> B) -> ~[B] { + fn map_to_vec<B>(&self, op: &fn(&A) -> B) -> ~[B] { iter::map_to_vec(self, op) } #[inline(always)] - pure fn flat_map_to_vec<B,IB:BaseIter<B>>(&self, op: &fn(&A) -> IB) + fn flat_map_to_vec<B,IB:BaseIter<B>>(&self, op: &fn(&A) -> IB) -> ~[B] { iter::flat_map_to_vec(self, op) } @@ -169,27 +169,27 @@ impl<A> iter::ExtendedIter<A> for OptVec<A> { impl<A: Eq> iter::EqIter<A> for OptVec<A> { #[inline(always)] - pure fn contains(&self, x: &A) -> bool { iter::contains(self, x) } + fn contains(&self, x: &A) -> bool { iter::contains(self, x) } #[inline(always)] - pure fn count(&self, x: &A) -> uint { iter::count(self, x) } + fn count(&self, x: &A) -> uint { iter::count(self, x) } } impl<A: Copy> iter::CopyableIter<A> for OptVec<A> { #[inline(always)] - pure fn filter_to_vec(&self, pred: &fn(&A) -> bool) -> ~[A] { + fn filter_to_vec(&self, pred: &fn(&A) -> bool) -> ~[A] { iter::filter_to_vec(self, pred) } #[inline(always)] - pure fn to_vec(&self) -> ~[A] { iter::to_vec(self) } + fn to_vec(&self) -> ~[A] { iter::to_vec(self) } #[inline(always)] - pure fn find(&self, f: &fn(&A) -> bool) -> Option<A> { + fn find(&self, f: &fn(&A) -> bool) -> Option<A> { iter::find(self, f) } } impl<A: Copy+Ord> iter::CopyableOrderedIter<A> for OptVec<A> { #[inline(always)] - pure fn min(&self) -> A { iter::min(self) } + fn min(&self) -> A { iter::min(self) } #[inline(always)] - pure fn max(&self) -> A { iter::max(self) } + fn max(&self) -> A { iter::max(self) } } diff --git a/src/libsyntax/parse/comments.rs b/src/libsyntax/parse/comments.rs index 6ebaa42357e..3f8a5588c71 100644 --- a/src/libsyntax/parse/comments.rs +++ b/src/libsyntax/parse/comments.rs @@ -35,10 +35,10 @@ pub enum cmnt_style { } impl cmp::Eq for cmnt_style { - pure fn eq(&self, other: &cmnt_style) -> bool { + fn eq(&self, other: &cmnt_style) -> bool { ((*self) as uint) == ((*other) as uint) } - pure fn ne(&self, other: &cmnt_style) -> bool { + fn ne(&self, other: &cmnt_style) -> bool { ((*self) as uint) != ((*other) as uint) } } diff --git a/src/libsyntax/parse/common.rs b/src/libsyntax/parse/common.rs index 1b64a9a6275..ea599e8290a 100644 --- a/src/libsyntax/parse/common.rs +++ b/src/libsyntax/parse/common.rs @@ -134,7 +134,7 @@ pub impl Parser { } } - pure fn token_is_word(&self, word: &~str, tok: &token::Token) -> bool { + fn token_is_word(&self, word: &~str, tok: &token::Token) -> bool { match *tok { token::IDENT(sid, false) => { *self.id_to_str(sid) == *word } _ => { false } diff --git a/src/libsyntax/parse/lexer.rs b/src/libsyntax/parse/lexer.rs index f53ac271901..ffd2a1d801c 100644 --- a/src/libsyntax/parse/lexer.rs +++ b/src/libsyntax/parse/lexer.rs @@ -32,7 +32,7 @@ pub trait reader { fn next_token(@mut self) -> TokenAndSpan; fn fatal(@mut self, ~str) -> !; fn span_diag(@mut self) -> @span_handler; - pure fn interner(@mut self) -> @token::ident_interner; + fn interner(@mut self) -> @token::ident_interner; fn peek(@mut self) -> TokenAndSpan; fn dup(@mut self) -> @reader; } @@ -122,7 +122,7 @@ impl reader for StringReader { self.span_diagnostic.span_fatal(copy self.peek_span, m) } fn span_diag(@mut self) -> @span_handler { self.span_diagnostic } - pure fn interner(@mut self) -> @token::ident_interner { self.interner } + fn interner(@mut self) -> @token::ident_interner { self.interner } fn peek(@mut self) -> TokenAndSpan { TokenAndSpan { tok: copy self.peek_tok, @@ -139,7 +139,7 @@ impl reader for TtReader { self.sp_diag.span_fatal(copy self.cur_span, m); } fn span_diag(@mut self) -> @span_handler { self.sp_diag } - pure fn interner(@mut self) -> @token::ident_interner { self.interner } + fn interner(@mut self) -> @token::ident_interner { self.interner } fn peek(@mut self) -> TokenAndSpan { TokenAndSpan { tok: copy self.cur_tok, @@ -261,7 +261,7 @@ fn consume_whitespace_and_comments(rdr: @mut StringReader) return consume_any_line_comment(rdr); } -pub pure fn is_line_non_doc_comment(s: &str) -> bool { +pub fn is_line_non_doc_comment(s: &str) -> bool { s.trim_right().all(|ch| ch == '/') } @@ -313,7 +313,7 @@ fn consume_any_line_comment(rdr: @mut StringReader) return None; } -pub pure fn is_block_non_doc_comment(s: &str) -> bool { +pub fn is_block_non_doc_comment(s: &str) -> bool { fail_unless!(s.len() >= 1u); str::all_between(s, 1u, s.len() - 1u, |ch| ch == '*') } diff --git a/src/libsyntax/parse/obsolete.rs b/src/libsyntax/parse/obsolete.rs index 5cc1ea756e4..65eb87fb83c 100644 --- a/src/libsyntax/parse/obsolete.rs +++ b/src/libsyntax/parse/obsolete.rs @@ -63,7 +63,7 @@ pub enum ObsoleteSyntax { impl to_bytes::IterBytes for ObsoleteSyntax { #[inline(always)] - pure fn iter_bytes(&self, +lsb0: bool, f: to_bytes::Cb) { + fn iter_bytes(&self, +lsb0: bool, f: to_bytes::Cb) { (*self as uint).iter_bytes(lsb0, f); } } diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 07f8c8b743b..7ee45eea0de 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -196,8 +196,8 @@ macro_rules! maybe_whole ( ) -pure fn maybe_append(+lhs: ~[attribute], rhs: Option<~[attribute]>) - -> ~[attribute] { +fn maybe_append(+lhs: ~[attribute], rhs: Option<~[attribute]>) + -> ~[attribute] { match rhs { None => lhs, Some(ref attrs) => vec::append(lhs, (*attrs)) @@ -331,7 +331,7 @@ pub impl Parser { } fn get_id(&self) -> node_id { next_node_id(self.sess) } - pure fn id_to_str(&self, id: ident) -> @~str { + fn id_to_str(&self, id: ident) -> @~str { self.sess.interner.get(id) } diff --git a/src/libsyntax/parse/token.rs b/src/libsyntax/parse/token.rs index 5a774718b7d..f5542fa81a6 100644 --- a/src/libsyntax/parse/token.rs +++ b/src/libsyntax/parse/token.rs @@ -118,7 +118,7 @@ pub enum nonterminal { nt_matchers(~[ast::matcher]) } -pub pure fn binop_to_str(o: binop) -> ~str { +pub fn binop_to_str(o: binop) -> ~str { match o { PLUS => ~"+", MINUS => ~"-", @@ -228,7 +228,7 @@ pub fn to_str(in: @ident_interner, t: &Token) -> ~str { } } -pub pure fn can_begin_expr(t: &Token) -> bool { +pub fn can_begin_expr(t: &Token) -> bool { match *t { LPAREN => true, LBRACE => true, @@ -286,22 +286,22 @@ pub fn is_lit(t: &Token) -> bool { } } -pub pure fn is_ident(t: &Token) -> bool { +pub fn is_ident(t: &Token) -> bool { match *t { IDENT(_, _) => true, _ => false } } -pub pure fn is_ident_or_path(t: &Token) -> bool { +pub fn is_ident_or_path(t: &Token) -> bool { match *t { IDENT(_, _) | INTERPOLATED(nt_path(*)) => true, _ => false } } -pub pure fn is_plain_ident(t: &Token) -> bool { +pub fn is_plain_ident(t: &Token) -> bool { match *t { IDENT(_, false) => true, _ => false } } -pub pure fn is_bar(t: &Token) -> bool { +pub fn is_bar(t: &Token) -> bool { match *t { BINOP(OR) | OROR => true, _ => false } } @@ -366,7 +366,7 @@ pub impl ident_interner { fn gensym(&self, val: @~str) -> ast::ident { ast::ident { repr: self.interner.gensym(val) } } - pure fn get(&self, idx: ast::ident) -> @~str { + fn get(&self, idx: ast::ident) -> @~str { self.interner.get(idx.repr) } fn len(&self) -> uint { diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs index 27c4763e973..ce12e0a7b87 100644 --- a/src/libsyntax/print/pprust.rs +++ b/src/libsyntax/print/pprust.rs @@ -2214,7 +2214,7 @@ pub fn opt_sigil_to_str(opt_p: Option<ast::Sigil>) -> ~str { } } -pub pure fn purity_to_str(p: ast::purity) -> ~str { +pub fn purity_to_str(p: ast::purity) -> ~str { match p { ast::impure_fn => ~"impure", ast::unsafe_fn => ~"unsafe", @@ -2223,7 +2223,7 @@ pub pure fn purity_to_str(p: ast::purity) -> ~str { } } -pub pure fn onceness_to_str(o: ast::Onceness) -> ~str { +pub fn onceness_to_str(o: ast::Onceness) -> ~str { match o { ast::Once => ~"once", ast::Many => ~"many" diff --git a/src/libsyntax/util/interner.rs b/src/libsyntax/util/interner.rs index b4a85ce1617..159a205637b 100644 --- a/src/libsyntax/util/interner.rs +++ b/src/libsyntax/util/interner.rs @@ -22,14 +22,14 @@ pub struct Interner<T> { // when traits can extend traits, we should extend index<uint,T> to get [] pub impl<T:Eq + IterBytes + Hash + Const + Copy> Interner<T> { - static fn new() -> Interner<T> { + fn new() -> Interner<T> { Interner { map: @mut LinearMap::new(), vect: @mut ~[], } } - static fn prefill(init: &[T]) -> Interner<T> { + fn prefill(init: &[T]) -> Interner<T> { let rv = Interner::new(); for init.each() |v| { rv.intern(*v); } rv @@ -61,7 +61,7 @@ pub impl<T:Eq + IterBytes + Hash + Const + Copy> Interner<T> { // this isn't "pure" in the traditional sense, because it can go from // failing to returning a value as items are interned. But for typestate, // where we first check a pred and then rely on it, ceasing to fail is ok. - pure fn get(&self, idx: uint) -> T { self.vect[idx] } + fn get(&self, idx: uint) -> T { self.vect[idx] } fn len(&self) -> uint { let vect = &*self.vect; vect.len() } } |
