From bd77e9433f5a76530c3d2acf0fa82caa5167e263 Mon Sep 17 00:00:00 2001 From: Erick Tryzelaar Date: Wed, 27 Mar 2013 07:01:45 -0700 Subject: syntax: pass some values around by reference --- src/libsyntax/ext/quote.rs | 8 ++++---- src/libsyntax/print/pprust.rs | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'src/libsyntax') diff --git a/src/libsyntax/ext/quote.rs b/src/libsyntax/ext/quote.rs index 9f3145e4e4e..a6f078d07b4 100644 --- a/src/libsyntax/ext/quote.rs +++ b/src/libsyntax/ext/quote.rs @@ -88,7 +88,7 @@ pub mod rt { } } - impl ToSource for ~[@ast::item] { + impl<'self> ToSource for &'self [@ast::item] { fn to_source(&self, cx: @ext_ctxt) -> ~str { str::connect(self.map(|i| i.to_source(cx)), ~"\n\n") } @@ -100,7 +100,7 @@ pub mod rt { } } - impl ToSource for ~[@ast::Ty] { + impl<'self> ToSource for &'self [@ast::Ty] { fn to_source(&self, cx: @ext_ctxt) -> ~str { str::connect(self.map(|i| i.to_source(cx)), ~", ") } @@ -216,7 +216,7 @@ pub mod rt { } } - impl ToTokens for ~[@ast::item] { + impl<'self> ToTokens for &'self [@ast::item] { fn to_tokens(&self, cx: @ext_ctxt) -> ~[token_tree] { cx.parse_tts(self.to_source(cx)) } @@ -228,7 +228,7 @@ pub mod rt { } } - impl ToTokens for ~[@ast::Ty] { + impl<'self> ToTokens for &'self [@ast::Ty] { fn to_tokens(&self, cx: @ext_ctxt) -> ~[token_tree] { cx.parse_tts(self.to_source(cx)) } diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs index 9a9834c488b..28b6d132842 100644 --- a/src/libsyntax/print/pprust.rs +++ b/src/libsyntax/print/pprust.rs @@ -324,7 +324,7 @@ pub fn commasep(s: @ps, b: breaks, elts: &[IN], op: &fn(@ps, IN)) { pub fn commasep_cmnt(s: @ps, b: breaks, elts: &[IN], op: &fn(@ps, IN), get_span: &fn(IN) -> codemap::span) { box(s, 0u, b); - let len = vec::len::(elts); + let len = elts.len(); let mut i = 0u; for elts.each |elt| { maybe_print_comment(s, get_span(*elt).hi); @@ -2133,7 +2133,7 @@ pub fn print_comment(s: @ps, cmnt: comments::cmnt) { } } -pub fn print_string(s: @ps, st: ~str) { +pub fn print_string(s: @ps, st: &str) { word(s.s, ~"\""); word(s.s, str::escape_default(st)); word(s.s, ~"\""); -- cgit 1.4.1-3-g733a5