From 116897fa6cba39ba43180debf0f9136be6a44205 Mon Sep 17 00:00:00 2001 From: Corey Richardson Date: Fri, 21 Jun 2013 18:10:23 -0400 Subject: Remove `ast::pure_fn` and all concept of `pure` from the compiler --- src/libsyntax/ast.rs | 2 -- src/libsyntax/print/pprust.rs | 25 ++++++++++++++----------- 2 files changed, 14 insertions(+), 13 deletions(-) (limited to 'src/libsyntax') diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index 1758433aa73..a3ead99a714 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -845,7 +845,6 @@ pub struct fn_decl { #[deriving(Eq, Encodable, Decodable)] pub enum purity { - pure_fn, // declared with "pure fn" unsafe_fn, // declared with "unsafe fn" impure_fn, // declared with "fn" extern_fn, // declared with "extern fn" @@ -856,7 +855,6 @@ impl ToStr for purity { match *self { impure_fn => ~"impure", unsafe_fn => ~"unsafe", - pure_fn => ~"pure", extern_fn => ~"extern" } } diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs index d73c5240a1c..e166e30bd78 100644 --- a/src/libsyntax/print/pprust.rs +++ b/src/libsyntax/print/pprust.rs @@ -2188,26 +2188,29 @@ pub fn print_fn_header_info(s: @ps, print_opt_sigil(s, opt_sigil); } -pub fn opt_sigil_to_str(opt_p: Option) -> ~str { +pub fn opt_sigil_to_str(opt_p: Option) -> &'static str { match opt_p { - None => ~"fn", - Some(p) => fmt!("fn%s", p.to_str()) + None => "fn", + Some(p) => match p { + ast::BorrowedSigil => "fn&", + ast::OwnedSigil => "fn~", + ast::ManagedSigil => "fn@" + } } } -pub fn purity_to_str(p: ast::purity) -> ~str { +pub fn purity_to_str(p: ast::purity) -> &'static str { match p { - ast::impure_fn => ~"impure", - ast::unsafe_fn => ~"unsafe", - ast::pure_fn => ~"pure", - ast::extern_fn => ~"extern" + ast::impure_fn => "impure", + ast::unsafe_fn => "unsafe", + ast::extern_fn => "extern" } } -pub fn onceness_to_str(o: ast::Onceness) -> ~str { +pub fn onceness_to_str(o: ast::Onceness) -> &'static str { match o { - ast::Once => ~"once", - ast::Many => ~"many" + ast::Once => "once", + ast::Many => "many" } } -- cgit 1.4.1-3-g733a5