From e20549ff192edec9d625f1119bcb077c3abaf070 Mon Sep 17 00:00:00 2001 From: Patrick Walton Date: Wed, 10 Jul 2013 14:43:25 -0700 Subject: librustc: Remove all uses of the `Copy` bound. --- src/libsyntax/ast_util.rs | 4 ++- src/libsyntax/ext/base.rs | 2 +- src/libsyntax/ext/expand.rs | 4 +-- src/libsyntax/parse/parser.rs | 60 +++++++++++++++++++++---------------------- 4 files changed, 36 insertions(+), 34 deletions(-) (limited to 'src/libsyntax') diff --git a/src/libsyntax/ast_util.rs b/src/libsyntax/ast_util.rs index 843fd4bdba2..d0dfb0fb06e 100644 --- a/src/libsyntax/ast_util.rs +++ b/src/libsyntax/ast_util.rs @@ -16,11 +16,13 @@ use opt_vec; use parse::token; use visit; +use std::cast::unsafe_copy; +use std::cast; use std::hashmap::HashMap; use std::int; +use std::local_data; use std::num; use std::option; -use std::local_data; pub fn path_name_i(idents: &[ident]) -> ~str { // FIXME: Bad copies (#2543 -- same for everything else that says "bad") diff --git a/src/libsyntax/ext/base.rs b/src/libsyntax/ext/base.rs index e2f37bd54bd..230640767c9 100644 --- a/src/libsyntax/ext/base.rs +++ b/src/libsyntax/ext/base.rs @@ -414,7 +414,7 @@ pub enum MapChain { // get the map from an env frame -impl MapChain{ +impl MapChain{ // Constructor. I don't think we need a zero-arg one. fn new(init: ~HashMap) -> @mut MapChain { diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs index ba8e3e72933..2f1d320fef7 100644 --- a/src/libsyntax/ext/expand.rs +++ b/src/libsyntax/ext/expand.rs @@ -693,7 +693,7 @@ pub fn inject_std_macros(parse_sess: @mut parse::ParseSess, cfg: ast::crate_cfg, c: &crate) -> @crate { let sm = match parse_item_from_source_str(@"", std_macros(), - copy cfg, + cfg.clone(), ~[], parse_sess) { Some(item) => item, @@ -708,7 +708,7 @@ pub fn inject_std_macros(parse_sess: @mut parse::ParseSess, ast::_mod { items: items, // FIXME #2543: Bad copy. - .. copy *modd + .. (*modd).clone() } }, .. *default_ast_fold() diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index f0b9258eaeb..adecbc050a3 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -473,10 +473,10 @@ impl Parser { // parse a sequence bracketed by '<' and '>', stopping // before the '>'. - pub fn parse_seq_to_before_gt(&self, - sep: Option, - f: &fn(&Parser) -> T) - -> OptVec { + pub fn parse_seq_to_before_gt(&self, + sep: Option, + f: &fn(&Parser) -> T) + -> OptVec { let mut first = true; let mut v = opt_vec::Empty; while *self.token != token::GT @@ -493,10 +493,10 @@ impl Parser { return v; } - pub fn parse_seq_to_gt(&self, - sep: Option, - f: &fn(&Parser) -> T) - -> OptVec { + pub fn parse_seq_to_gt(&self, + sep: Option, + f: &fn(&Parser) -> T) + -> OptVec { let v = self.parse_seq_to_before_gt(sep, f); self.expect_gt(); return v; @@ -505,11 +505,11 @@ impl Parser { // parse a sequence, including the closing delimiter. The function // f must consume tokens until reaching the next separator or // closing bracket. - pub fn parse_seq_to_end(&self, - ket: &token::Token, - sep: SeqSep, - f: &fn(&Parser) -> T) - -> ~[T] { + pub fn parse_seq_to_end(&self, + ket: &token::Token, + sep: SeqSep, + f: &fn(&Parser) -> T) + -> ~[T] { let val = self.parse_seq_to_before_end(ket, sep, f); self.bump(); val @@ -518,11 +518,11 @@ impl Parser { // parse a sequence, not including the closing delimiter. The function // f must consume tokens until reaching the next separator or // closing bracket. - pub fn parse_seq_to_before_end(&self, - ket: &token::Token, - sep: SeqSep, - f: &fn(&Parser) -> T) - -> ~[T] { + pub fn parse_seq_to_before_end(&self, + ket: &token::Token, + sep: SeqSep, + f: &fn(&Parser) -> T) + -> ~[T] { let mut first: bool = true; let mut v: ~[T] = ~[]; while *self.token != *ket { @@ -542,12 +542,12 @@ impl Parser { // parse a sequence, including the closing delimiter. The function // f must consume tokens until reaching the next separator or // closing bracket. - pub fn parse_unspanned_seq(&self, - bra: &token::Token, - ket: &token::Token, - sep: SeqSep, - f: &fn(&Parser) -> T) - -> ~[T] { + pub fn parse_unspanned_seq(&self, + bra: &token::Token, + ket: &token::Token, + sep: SeqSep, + f: &fn(&Parser) -> T) + -> ~[T] { self.expect(bra); let result = self.parse_seq_to_before_end(ket, sep, f); self.bump(); @@ -556,12 +556,12 @@ impl Parser { // NB: Do not use this function unless you actually plan to place the // spanned list in the AST. - pub fn parse_seq(&self, - bra: &token::Token, - ket: &token::Token, - sep: SeqSep, - f: &fn(&Parser) -> T) - -> spanned<~[T]> { + pub fn parse_seq(&self, + bra: &token::Token, + ket: &token::Token, + sep: SeqSep, + f: &fn(&Parser) -> T) + -> spanned<~[T]> { let lo = self.span.lo; self.expect(bra); let result = self.parse_seq_to_before_end(ket, sep, f); -- cgit 1.4.1-3-g733a5