diff options
| author | Tim Chevalier <chevalier@alum.wellesley.edu> | 2012-10-05 14:27:56 -0700 |
|---|---|---|
| committer | Tim Chevalier <chevalier@alum.wellesley.edu> | 2012-10-05 15:39:12 -0700 |
| commit | ca49fd402af8e7bf613c43e996274b5a017958d2 (patch) | |
| tree | 967e847cfe10d615ebb0629da3972388ff045644 | |
| parent | e16dbb7888504ef5d0de0c14493fc8ecc492ee30 (diff) | |
| download | rust-ca49fd402af8e7bf613c43e996274b5a017958d2.tar.gz rust-ca49fd402af8e7bf613c43e996274b5a017958d2.zip | |
wip
| -rw-r--r-- | src/libcore/cmath.rs | 16 | ||||
| -rw-r--r-- | src/libstd/time.rs | 30 | ||||
| -rw-r--r-- | src/libsyntax/ast.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/parse/comments.rs | 28 | ||||
| -rw-r--r-- | src/libsyntax/parse/eval.rs | 10 | ||||
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 10 | ||||
| -rw-r--r-- | src/libsyntax/parse/token.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/print/pprust.rs | 1 | ||||
| -rw-r--r-- | src/rustc/metadata/encoder.rs | 2 | ||||
| -rw-r--r-- | src/rustc/metadata/tydecode.rs | 1 | ||||
| -rw-r--r-- | src/rustc/metadata/tyencode.rs | 1 | ||||
| -rw-r--r-- | src/rustc/middle/borrowck.rs | 6 | ||||
| -rw-r--r-- | src/rustc/middle/borrowck/check_loans.rs | 11 | ||||
| -rw-r--r-- | src/rustc/middle/borrowck/gather_loans.rs | 4 | ||||
| -rw-r--r-- | src/rustc/middle/kind.rs | 18 | ||||
| -rw-r--r-- | src/rustc/middle/liveness.rs | 29 | ||||
| -rw-r--r-- | src/rustc/middle/mem_categorization.rs | 3 | ||||
| -rw-r--r-- | src/rustc/middle/trans/base.rs | 2 | ||||
| -rw-r--r-- | src/rustc/middle/trans/callee.rs | 2 | ||||
| -rw-r--r-- | src/rustc/middle/trans/reflect.rs | 1 | ||||
| -rw-r--r-- | src/rustc/middle/trans/shape.rs | 8 | ||||
| -rw-r--r-- | src/rustc/middle/trans/type_use.rs | 2 | ||||
| -rw-r--r-- | src/rustc/middle/trans/uniq.rs | 1 |
23 files changed, 93 insertions, 97 deletions
diff --git a/src/libcore/cmath.rs b/src/libcore/cmath.rs index 9a9a7cb3112..b0aeb78afaa 100644 --- a/src/libcore/cmath.rs +++ b/src/libcore/cmath.rs @@ -40,15 +40,15 @@ pub extern mod c_double { #[link_name="fmax"] pure fn fmax(a: c_double, b: c_double) -> c_double; #[link_name="fmin"] pure fn fmin(a: c_double, b: c_double) -> c_double; pure fn nextafter(x: c_double, y: c_double) -> c_double; - pure fn frexp(n: c_double, &value: c_int) -> c_double; + pure fn frexp(n: c_double, value: &mut c_int) -> c_double; pure fn hypot(x: c_double, y: c_double) -> c_double; pure fn ldexp(x: c_double, n: c_int) -> c_double; #[cfg(unix)] #[link_name="lgamma_r"] pure fn lgamma(n: c_double, - &sign: c_int) -> c_double; + sign: &mut c_int) -> c_double; #[cfg(windows)] #[link_name="__lgamma_r"] pure fn lgamma(n: c_double, - &sign: c_int) -> c_double; + sign: &mut c_int) -> c_double; // renamed: log is a reserved keyword; ln seems more natural, too #[link_name="log"] pure fn ln(n: c_double) -> c_double; // renamed: "logb" /often/ is confused for log2 by beginners @@ -58,7 +58,7 @@ pub extern mod c_double { pure fn log10(n: c_double) -> c_double; pure fn log2(n: c_double) -> c_double; #[link_name="ilogb"] pure fn ilog_radix(n: c_double) -> c_int; - pure fn modf(n: c_double, &iptr: c_double) -> c_double; + pure fn modf(n: c_double, iptr: &mut c_double) -> c_double; pure fn pow(n: c_double, e: c_double) -> c_double; // FIXME (#1379): enable when rounding modes become available // pure fn rint(n: c_double) -> c_double; @@ -110,7 +110,7 @@ pub extern mod c_float { #[link_name="fdimf"] pure fn abs_sub(a: c_float, b: c_float) -> c_float; #[link_name="floorf"] pure fn floor(n: c_float) -> c_float; #[link_name="frexpf"] pure fn frexp(n: c_float, - &value: c_int) -> c_float; + value: &mut c_int) -> c_float; #[link_name="fmaf"] pure fn mul_add(a: c_float, b: c_float, c: c_float) -> c_float; #[link_name="fmaxf"] pure fn fmax(a: c_float, b: c_float) -> c_float; @@ -122,11 +122,11 @@ pub extern mod c_float { #[cfg(unix)] #[link_name="lgammaf_r"] pure fn lgamma(n: c_float, - &sign: c_int) -> c_float; + sign: &mut c_int) -> c_float; #[cfg(windows)] #[link_name="__lgammaf_r"] pure fn lgamma(n: c_float, - &sign: c_int) -> c_float; + sign: &mut c_int) -> c_float; #[link_name="logf"] pure fn ln(n: c_float) -> c_float; #[link_name="logbf"] pure fn log_radix(n: c_float) -> c_float; @@ -135,7 +135,7 @@ pub extern mod c_float { #[link_name="log10f"] pure fn log10(n: c_float) -> c_float; #[link_name="ilogbf"] pure fn ilog_radix(n: c_float) -> c_int; #[link_name="modff"] pure fn modf(n: c_float, - &iptr: c_float) -> c_float; + iptr: &mut c_float) -> c_float; #[link_name="powf"] pure fn pow(n: c_float, e: c_float) -> c_float; // FIXME (#1379): enable when rounding modes become available // #[link_name="rintf"] pure fn rint(n: c_float) -> c_float; diff --git a/src/libstd/time.rs b/src/libstd/time.rs index 627a3b8eeae..8fa1e0cf3f0 100644 --- a/src/libstd/time.rs +++ b/src/libstd/time.rs @@ -7,9 +7,18 @@ use result::{Result, Ok, Err}; #[abi = "cdecl"] extern mod rustrt { - #[legacy_exports]; + #[legacy_exports] + #[cfg(stage0)] fn get_time(&sec: i64, &nsec: i32); + #[cfg(stage1)] + #[cfg(stage2)] + fn get_time(sec: &mut i64, nsec: &mut i32); + + #[cfg(stage0)] fn precise_time_ns(&ns: u64); + #[cfg(stage1)] + #[cfg(stage2)] + fn precise_time_ns(ns: &mut u64); fn rust_tzset(); // FIXME: The i64 values can be passed by-val when #2064 is fixed. @@ -33,22 +42,41 @@ impl Timespec : Eq { * Returns the current time as a `timespec` containing the seconds and * nanoseconds since 1970-01-01T00:00:00Z. */ +#[cfg(stage0)] pub fn get_time() -> Timespec { let mut sec = 0i64; let mut nsec = 0i32; rustrt::get_time(sec, nsec); return {sec: sec, nsec: nsec}; } +#[cfg(stage1)] +#[cfg(stage2)] +pub fn get_time() -> Timespec { + let mut sec = 0i64; + let mut nsec = 0i32; + rustrt::get_time(&mut sec, &mut nsec); + return {sec: sec, nsec: nsec}; +} + /** * Returns the current value of a high-resolution performance counter * in nanoseconds since an unspecified epoch. */ +#[cfg(stage0)] pub fn precise_time_ns() -> u64 { let mut ns = 0u64; rustrt::precise_time_ns(ns); ns } +#[cfg(stage1)] +#[cfg(stage2)] +pub fn precise_time_ns() -> u64 { + let mut ns = 0u64; + rustrt::precise_time_ns(&mut ns); + ns +} + /** * Returns the current value of a high-resolution performance counter diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index e17b52fb27d..a50189cf598 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -574,7 +574,7 @@ impl<T:cmp::Eq> inferable<T> : cmp::Eq { // "resolved" mode: the real modes. #[auto_serialize] -enum rmode { by_ref, by_val, by_mutbl_ref, by_move, by_copy } +enum rmode { by_ref, by_val, by_move, by_copy } impl rmode : to_bytes::IterBytes { pure fn iter_bytes(+lsb0: bool, f: to_bytes::Cb) { diff --git a/src/libsyntax/parse/comments.rs b/src/libsyntax/parse/comments.rs index cb8416501b3..4f265e1919c 100644 --- a/src/libsyntax/parse/comments.rs +++ b/src/libsyntax/parse/comments.rs @@ -127,14 +127,14 @@ fn consume_non_eol_whitespace(rdr: string_reader) { } } -fn push_blank_line_comment(rdr: string_reader, &comments: ~[cmnt]) { +fn push_blank_line_comment(rdr: string_reader, comments: &mut ~[cmnt]) { debug!(">>> blank-line comment"); let v: ~[~str] = ~[]; comments.push({style: blank_line, lines: v, pos: rdr.chpos}); } fn consume_whitespace_counting_blank_lines(rdr: string_reader, - &comments: ~[cmnt]) { + comments: &mut ~[cmnt]) { while is_whitespace(rdr.curr) && !is_eof(rdr) { if rdr.col == 0u && rdr.curr == '\n' { push_blank_line_comment(rdr, comments); @@ -145,7 +145,7 @@ fn consume_whitespace_counting_blank_lines(rdr: string_reader, fn read_shebang_comment(rdr: string_reader, code_to_the_left: bool, - &comments: ~[cmnt]) { + comments: &mut ~[cmnt]) { debug!(">>> shebang comment"); let p = rdr.chpos; debug!("<<< shebang comment"); @@ -157,7 +157,7 @@ fn read_shebang_comment(rdr: string_reader, code_to_the_left: bool, } fn read_line_comments(rdr: string_reader, code_to_the_left: bool, - &comments: ~[cmnt]) { + comments: &mut ~[cmnt]) { debug!(">>> line comments"); let p = rdr.chpos; let mut lines: ~[~str] = ~[]; @@ -188,8 +188,8 @@ fn all_whitespace(s: ~str, begin: uint, end: uint) -> bool { return true; } -fn trim_whitespace_prefix_and_push_line(&lines: ~[~str], - s: ~str, col: uint) unsafe { +fn trim_whitespace_prefix_and_push_line(lines: &mut ~[~str], + s: ~str, col: uint) { let mut s1; let len = str::len(s); if all_whitespace(s, 0u, uint::min(len, col)) { @@ -202,7 +202,7 @@ fn trim_whitespace_prefix_and_push_line(&lines: ~[~str], } fn read_block_comment(rdr: string_reader, code_to_the_left: bool, - &comments: ~[cmnt]) { + comments: &mut ~[cmnt]) { debug!(">>> block comment"); let p = rdr.chpos; let mut lines: ~[~str] = ~[]; @@ -228,7 +228,7 @@ fn read_block_comment(rdr: string_reader, code_to_the_left: bool, debug!("=== block comment level %d", level); if is_eof(rdr) {(rdr as reader).fatal(~"unterminated block comment");} if rdr.curr == '\n' { - trim_whitespace_prefix_and_push_line(lines, curr_line, col); + trim_whitespace_prefix_and_push_line(&mut lines, curr_line, col); curr_line = ~""; bump(rdr); } else { @@ -248,8 +248,8 @@ fn read_block_comment(rdr: string_reader, code_to_the_left: bool, } } } - if str::len(curr_line) != 0u { - trim_whitespace_prefix_and_push_line(lines, curr_line, col); + if str::len(curr_line) != 0 { + trim_whitespace_prefix_and_push_line(&mut lines, curr_line, col); } let mut style = if code_to_the_left { trailing } else { isolated }; consume_non_eol_whitespace(rdr); @@ -267,7 +267,7 @@ fn peeking_at_comment(rdr: string_reader) -> bool { } fn consume_comment(rdr: string_reader, code_to_the_left: bool, - &comments: ~[cmnt]) { + comments: &mut ~[cmnt]) { debug!(">>> consume comment"); if rdr.curr == '/' && nextch(rdr) == '/' { read_line_comments(rdr, code_to_the_left, comments); @@ -299,11 +299,11 @@ fn gather_comments_and_literals(span_diagnostic: diagnostic::span_handler, consume_non_eol_whitespace(rdr); if rdr.curr == '\n' { code_to_the_left = false; - consume_whitespace_counting_blank_lines(rdr, comments); + consume_whitespace_counting_blank_lines(rdr, &mut comments); } while peeking_at_comment(rdr) { - consume_comment(rdr, code_to_the_left, comments); - consume_whitespace_counting_blank_lines(rdr, comments); + consume_comment(rdr, code_to_the_left, &mut comments); + consume_whitespace_counting_blank_lines(rdr, &mut comments); } break; } diff --git a/src/libsyntax/parse/eval.rs b/src/libsyntax/parse/eval.rs index 14dc490346e..c9106028491 100644 --- a/src/libsyntax/parse/eval.rs +++ b/src/libsyntax/parse/eval.rs @@ -10,8 +10,8 @@ type ctx = fn eval_crate_directives(cx: ctx, cdirs: ~[@ast::crate_directive], prefix: &Path, - &view_items: ~[@ast::view_item], - &items: ~[@ast::item]) { + view_items: &mut~[@ast::view_item], + items: &mut~[@ast::item]) { for cdirs.each |sub_cdir| { eval_crate_directive(cx, *sub_cdir, prefix, view_items, items); } @@ -24,7 +24,7 @@ fn eval_crate_directives_to_mod(cx: ctx, cdirs: ~[@ast::crate_directive], = parse_companion_mod(cx, prefix, suffix); let mut view_items: ~[@ast::view_item] = ~[]; let mut items: ~[@ast::item] = ~[]; - eval_crate_directives(cx, cdirs, prefix, view_items, items); + eval_crate_directives(cx, cdirs, prefix, &mut view_items, &mut items); return ({view_items: vec::append(view_items, cview_items), items: vec::append(items, citems)}, cattrs); @@ -82,8 +82,8 @@ fn cdir_path_opt(default: ~str, attrs: ~[ast::attribute]) -> ~str { } fn eval_crate_directive(cx: ctx, cdir: @ast::crate_directive, prefix: &Path, - &view_items: ~[@ast::view_item], - &items: ~[@ast::item]) { + view_items: &mut ~[@ast::view_item], + items: &mut ~[@ast::item]) { match cdir.node { ast::cdir_src_mod(vis, id, attrs) => { let file_path = Path(cdir_path_opt( diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 1a87d7fed69..79f7d72d2a5 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -26,7 +26,7 @@ use ast::{_mod, add, alt_check, alt_exhaustive, arg, arm, attribute, bind_by_ref, bind_by_implicit_ref, bind_by_value, bind_by_move, bitand, bitor, bitxor, blk, blk_check_mode, bound_const, bound_copy, bound_send, bound_trait, bound_owned, box, by_copy, - by_move, by_mutbl_ref, by_ref, by_val, capture_clause, + by_move, by_ref, by_val, capture_clause, capture_item, cdir_dir_mod, cdir_src_mod, cdir_view_item, class_immutable, class_mutable, crate, crate_cfg, crate_directive, decl, decl_item, decl_local, @@ -571,7 +571,7 @@ impl parser { fn parse_arg_mode() -> mode { if self.eat(token::BINOP(token::AND)) { self.warn(~"Obsolete syntax has no effect"); - expl(by_mutbl_ref) + expl(by_val) } else if self.eat(token::BINOP(token::MINUS)) { expl(by_move) } else if self.eat(token::ANDAND) { @@ -1276,7 +1276,8 @@ impl parser { return match self.token { token::LPAREN | token::LBRACE | token::LBRACKET => { - let ket = token::flip_delimiter(self.token); + // tjc: ?????? + let ket = token::flip_delimiter(copy self.token); tt_delim(vec::append( ~[parse_tt_tok(self, true)], vec::append( @@ -1297,7 +1298,8 @@ impl parser { return match self.token { token::LBRACE | token::LPAREN | token::LBRACKET => { self.parse_matcher_subseq(name_idx, copy self.token, - token::flip_delimiter(self.token)) + // tjc: not sure why we need a copy + token::flip_delimiter(copy self.token)) } _ => self.fatal(~"expected open delimiter") } diff --git a/src/libsyntax/parse/token.rs b/src/libsyntax/parse/token.rs index a328ff1bdf6..99b789cf63f 100644 --- a/src/libsyntax/parse/token.rs +++ b/src/libsyntax/parse/token.rs @@ -230,7 +230,7 @@ pure fn can_begin_expr(t: token) -> bool { } /// what's the opposite delimiter? -fn flip_delimiter(&t: token::token) -> token::token { +fn flip_delimiter(t: token::token) -> token::token { match t { token::LPAREN => token::RPAREN, token::LBRACE => token::RBRACE, diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs index d08b20eed84..bff356e5cb7 100644 --- a/src/libsyntax/print/pprust.rs +++ b/src/libsyntax/print/pprust.rs @@ -1688,7 +1688,6 @@ fn print_fn_block_args(s: ps, decl: ast::fn_decl, fn mode_to_str(m: ast::mode) -> ~str { match m { - ast::expl(ast::by_mutbl_ref) => ~"&", ast::expl(ast::by_move) => ~"-", ast::expl(ast::by_ref) => ~"&&", ast::expl(ast::by_val) => ~"++", diff --git a/src/rustc/metadata/encoder.rs b/src/rustc/metadata/encoder.rs index 87ef3b4749c..47d91c10818 100644 --- a/src/rustc/metadata/encoder.rs +++ b/src/rustc/metadata/encoder.rs @@ -116,7 +116,7 @@ fn encode_mutability(ebml_w: ebml::Writer, mt: class_mutability) { type entry<T> = {val: T, pos: uint}; fn add_to_index(ecx: @encode_ctxt, ebml_w: ebml::Writer, path: &[ident], - &index: ~[entry<~str>], name: ident) { + index: &mut ~[entry<~str>], name: ident) { let mut full_path = ~[]; full_path.push_all(path); full_path.push(name); diff --git a/src/rustc/metadata/tydecode.rs b/src/rustc/metadata/tydecode.rs index f3fa0e3f350..1375ff2d0be 100644 --- a/src/rustc/metadata/tydecode.rs +++ b/src/rustc/metadata/tydecode.rs @@ -394,7 +394,6 @@ fn parse_arg(st: @pstate, conv: conv_did) -> ty::arg { fn parse_mode(st: @pstate) -> ast::mode { let m = ast::expl(match next(st) { - '&' => ast::by_mutbl_ref, '-' => ast::by_move, '+' => ast::by_copy, '=' => ast::by_ref, diff --git a/src/rustc/metadata/tyencode.rs b/src/rustc/metadata/tyencode.rs index 88d83ca23f4..83f92b44fe8 100644 --- a/src/rustc/metadata/tyencode.rs +++ b/src/rustc/metadata/tyencode.rs @@ -332,7 +332,6 @@ fn enc_arg(w: io::Writer, cx: @ctxt, arg: ty::arg) { fn enc_mode(w: io::Writer, cx: @ctxt, m: mode) { match ty::resolved_mode(cx.tcx, m) { - by_mutbl_ref => w.write_char('&'), by_move => w.write_char('-'), by_copy => w.write_char('+'), by_ref => w.write_char('='), diff --git a/src/rustc/middle/borrowck.rs b/src/rustc/middle/borrowck.rs index 414890cbd7c..e2f7ba20642 100644 --- a/src/rustc/middle/borrowck.rs +++ b/src/rustc/middle/borrowck.rs @@ -396,10 +396,10 @@ type req_maps = { pure_map: HashMap<ast::node_id, bckerr> }; -fn save_and_restore<T:Copy,U>(&save_and_restore_t: T, f: fn() -> U) -> U { - let old_save_and_restore_t = save_and_restore_t; +fn save_and_restore<T:Copy,U>(save_and_restore_t: &mut T, f: fn() -> U) -> U { + let old_save_and_restore_t = *save_and_restore_t; let u <- f(); - save_and_restore_t = old_save_and_restore_t; + *save_and_restore_t = old_save_and_restore_t; move u } diff --git a/src/rustc/middle/borrowck/check_loans.rs b/src/rustc/middle/borrowck/check_loans.rs index 0c79c0fcd7f..51beff021fa 100644 --- a/src/rustc/middle/borrowck/check_loans.rs +++ b/src/rustc/middle/borrowck/check_loans.rs @@ -529,8 +529,7 @@ impl check_loan_ctxt { ast::by_move => { self.check_move_out(*arg); } - ast::by_mutbl_ref | ast::by_ref | - ast::by_copy | ast::by_val => { + ast::by_ref | ast::by_copy | ast::by_val => { } } } @@ -542,9 +541,9 @@ fn check_loans_in_fn(fk: visit::fn_kind, decl: ast::fn_decl, body: ast::blk, visitor: visit::vt<check_loan_ctxt>) { debug!("purity on entry=%?", copy self.declared_purity); - do save_and_restore(self.in_ctor) { - do save_and_restore(self.declared_purity) { - do save_and_restore(self.fn_args) { + do save_and_restore(&mut(self.in_ctor)) { + do save_and_restore(&mut(self.declared_purity)) { + do save_and_restore(&mut(self.fn_args)) { let is_stack_closure = self.is_stack_closure(id); let fty = ty::node_id_to_type(self.tcx(), id); self.declared_purity = ty::determine_inherited_purity( @@ -667,7 +666,7 @@ fn check_loans_in_expr(expr: @ast::expr, fn check_loans_in_block(blk: ast::blk, &&self: check_loan_ctxt, vt: visit::vt<check_loan_ctxt>) { - do save_and_restore(self.declared_purity) { + do save_and_restore(&mut(self.declared_purity)) { self.check_for_conflicting_loans(blk.node.id); match blk.node.rules { diff --git a/src/rustc/middle/borrowck/gather_loans.rs b/src/rustc/middle/borrowck/gather_loans.rs index 327db51518b..5dfde8c9af6 100644 --- a/src/rustc/middle/borrowck/gather_loans.rs +++ b/src/rustc/middle/borrowck/gather_loans.rs @@ -115,10 +115,6 @@ fn req_loans_in_expr(ex: @ast::expr, let scope_r = ty::re_scope(ex.id); for vec::each2(args, arg_tys) |arg, arg_ty| { match ty::resolved_mode(self.tcx(), arg_ty.mode) { - ast::by_mutbl_ref => { - let arg_cmt = self.bccx.cat_expr(*arg); - self.guarantee_valid(arg_cmt, m_mutbl, scope_r); - } ast::by_ref => { let arg_cmt = self.bccx.cat_expr(*arg); self.guarantee_valid(arg_cmt, m_imm, scope_r); diff --git a/src/rustc/middle/kind.rs b/src/rustc/middle/kind.rs index 9aff382775c..1da145cabc9 100644 --- a/src/rustc/middle/kind.rs +++ b/src/rustc/middle/kind.rs @@ -319,13 +319,13 @@ fn check_expr(e: @expr, cx: ctx, v: visit::vt<ctx>) { for exprs.each |expr| { maybe_copy(cx, *expr, None); } } expr_call(f, args, _) => { - let mut i = 0u; + let mut i = 0; for ty::ty_fn_args(ty::expr_ty(cx.tcx, f)).each |arg_t| { match ty::arg_mode(cx.tcx, *arg_t) { by_copy => maybe_copy(cx, args[i], None), - by_ref | by_val | by_mutbl_ref | by_move => () + by_ref | by_val | by_move => () } - i += 1u; + i += 1; } } expr_field(lhs, _, _) => { @@ -335,7 +335,7 @@ fn check_expr(e: @expr, cx: ctx, v: visit::vt<ctx>) { Some(ref mme) => { match ty::arg_mode(cx.tcx, mme.self_arg) { by_copy => maybe_copy(cx, lhs, None), - by_ref | by_val | by_mutbl_ref | by_move => () + by_ref | by_val | by_move => () } } _ => () @@ -465,18 +465,10 @@ fn check_imm_free_var(cx: ctx, def: def, sp: span) { cx.tcx.sess.span_err(sp, msg); } } - def_arg(_, mode) => { - match ty::resolved_mode(cx.tcx, mode) { - by_ref | by_val | by_move | by_copy => { /* ok */ } - by_mutbl_ref => { - cx.tcx.sess.span_err(sp, msg); - } - } - } def_upvar(_, def1, _, _) => { check_imm_free_var(cx, *def1, sp); } - def_binding(*) | def_self(*) => { /*ok*/ } + def_arg(*) | def_binding(*) | def_self(*) => { /*ok*/ } _ => { cx.tcx.sess.span_bug( sp, diff --git a/src/rustc/middle/liveness.rs b/src/rustc/middle/liveness.rs index 69b325b03a4..bdf808e8568 100644 --- a/src/rustc/middle/liveness.rs +++ b/src/rustc/middle/liveness.rs @@ -398,8 +398,8 @@ impl IrMaps { (*v).push(id); } - Arg(_, _, by_ref) | Arg(_, _, by_mutbl_ref) | - Arg(_, _, by_val) | Self | Field(_) | ImplicitRet | + Arg(_, _, by_ref) | Arg(_, _, by_val) | Self | Field(_) | + ImplicitRet | Local(LocalInfo {kind: FromMatch(bind_by_implicit_ref), _}) => { debug!("--but it is not owned"); } @@ -831,9 +831,9 @@ impl Liveness { let mut changed = false; do self.indices2(ln, succ_ln) |idx, succ_idx| { changed |= copy_if_invalid(copy self.users[succ_idx].reader, - self.users[idx].reader); + &mut self.users[idx].reader); changed |= copy_if_invalid(copy self.users[succ_idx].writer, - self.users[idx].writer); + &mut self.users[idx].writer); if self.users[succ_idx].used && !self.users[idx].used { self.users[idx].used = true; changed = true; @@ -844,10 +844,10 @@ impl Liveness { ln.to_str(), self.ln_str(succ_ln), first_merge, changed); return changed; - fn copy_if_invalid(src: LiveNode, &dst: LiveNode) -> bool { + fn copy_if_invalid(src: LiveNode, dst: &mut LiveNode) -> bool { if src.is_valid() { if !dst.is_valid() { - dst = src; + *dst = src; return true; } } @@ -919,7 +919,7 @@ impl Liveness { // inputs passed by & mode should be considered live on exit: for decl.inputs.each |arg| { match ty::resolved_mode(self.tcx, arg.mode) { - by_mutbl_ref | by_ref | by_val => { + by_ref | by_val => { // These are "non-owned" modes, so register a read at // the end. This will prevent us from moving out of // such variables but also prevent us from registering @@ -1573,7 +1573,7 @@ fn check_expr(expr: @expr, &&self: @Liveness, vt: vt<@Liveness>) { let targs = ty::ty_fn_args(ty::expr_ty(self.tcx, f)); for vec::each2(args, targs) |arg_expr, arg_ty| { match ty::resolved_mode(self.tcx, arg_ty.mode) { - by_val | by_copy | by_ref | by_mutbl_ref => {} + by_val | by_copy | by_ref => {} by_move => { self.check_move_from_expr(*arg_expr, vt); } @@ -1866,19 +1866,6 @@ impl @Liveness { for decl.inputs.each |arg| { let var = self.variable(arg.id, arg.ty.span); match ty::resolved_mode(self.tcx, arg.mode) { - by_mutbl_ref => { - // for mutable reference arguments, something like - // x = 1; - // is not worth warning about, as it has visible - // side effects outside the fn. - match self.assigned_on_entry(entry_ln, var) { - Some(_) => { /*ok*/ } - None => { - // but if it is not written, it ought to be used - self.warn_about_unused(sp, entry_ln, var); - } - } - } by_val | by_ref | by_move | by_copy => { self.warn_about_unused(sp, entry_ln, var); } diff --git a/src/rustc/middle/mem_categorization.rs b/src/rustc/middle/mem_categorization.rs index fe465db1312..dc5874ea2cf 100644 --- a/src/rustc/middle/mem_categorization.rs +++ b/src/rustc/middle/mem_categorization.rs @@ -523,9 +523,6 @@ impl &mem_categorization_ctxt { // m: mutability of the argument // lp: loan path, must be none for aliasable things let {m,lp} = match ty::resolved_mode(self.tcx, mode) { - ast::by_mutbl_ref => { - {m: m_mutbl, lp: None} - } ast::by_move | ast::by_copy => { {m: m_imm, lp: Some(@lp_arg(vid))} } diff --git a/src/rustc/middle/trans/base.rs b/src/rustc/middle/trans/base.rs index ce596586ddc..368a523306e 100644 --- a/src/rustc/middle/trans/base.rs +++ b/src/rustc/middle/trans/base.rs @@ -1503,7 +1503,7 @@ fn copy_args_to_allocas(fcx: fn_ctxt, // the event it's not truly needed. let llarg; match ty::resolved_mode(tcx, arg_ty.mode) { - ast::by_ref | ast::by_mutbl_ref => { + ast::by_ref => { llarg = raw_llarg; } ast::by_move | ast::by_copy => { diff --git a/src/rustc/middle/trans/callee.rs b/src/rustc/middle/trans/callee.rs index e7b4dd171e3..c851c5bc725 100644 --- a/src/rustc/middle/trans/callee.rs +++ b/src/rustc/middle/trans/callee.rs @@ -592,7 +592,7 @@ fn trans_arg_expr(bcx: block, DoAutorefArg => { val = arg_datum.to_ref_llval(bcx); } DontAutorefArg => { match arg_mode { - ast::by_ref | ast::by_mutbl_ref => { + ast::by_ref => { val = arg_datum.to_ref_llval(bcx); } diff --git a/src/rustc/middle/trans/reflect.rs b/src/rustc/middle/trans/reflect.rs index cdd11ee85c5..ef1cc15f5c0 100644 --- a/src/rustc/middle/trans/reflect.rs +++ b/src/rustc/middle/trans/reflect.rs @@ -208,7 +208,6 @@ impl reflector { ast::expl(e) => match e { ast::by_ref => 1u, ast::by_val => 2u, - ast::by_mutbl_ref => 3u, ast::by_move => 4u, ast::by_copy => 5u } diff --git a/src/rustc/middle/trans/shape.rs b/src/rustc/middle/trans/shape.rs index cf58b5b51c4..e7dfac42bec 100644 --- a/src/rustc/middle/trans/shape.rs +++ b/src/rustc/middle/trans/shape.rs @@ -49,12 +49,12 @@ fn mk_ctxt(llmod: ModuleRef) -> ctxt { return {mut next_tag_id: 0u16, pad: 0u16, pad2: 0u32}; } -fn add_u16(&dest: ~[u8], val: u16) { - dest += ~[(val & 0xffu16) as u8, (val >> 8u16) as u8]; +fn add_u16(dest: &mut ~[u8], val: u16) { + *dest += ~[(val & 0xffu16) as u8, (val >> 8u16) as u8]; } -fn add_substr(&dest: ~[u8], src: ~[u8]) { +fn add_substr(dest: &mut ~[u8], src: ~[u8]) { add_u16(dest, vec::len(src) as u16); - dest += src; + *dest += src; } diff --git a/src/rustc/middle/trans/type_use.rs b/src/rustc/middle/trans/type_use.rs index 6bd3c22f626..9140ea94e9c 100644 --- a/src/rustc/middle/trans/type_use.rs +++ b/src/rustc/middle/trans/type_use.rs @@ -53,7 +53,7 @@ fn type_uses_for(ccx: @crate_ctxt, fn_id: def_id, n_tps: uint) by_val | by_move | by_copy => { type_needs(cx, use_repr, arg.ty); } - by_ref | by_mutbl_ref => {} + by_ref => {} } } } diff --git a/src/rustc/middle/trans/uniq.rs b/src/rustc/middle/trans/uniq.rs index 6ab91c4a1d7..50ea363ace2 100644 --- a/src/rustc/middle/trans/uniq.rs +++ b/src/rustc/middle/trans/uniq.rs @@ -3,7 +3,6 @@ use lib::llvm::ValueRef; use common::*; use build::*; use base::*; -use shape::llsize_of; use datum::immediate_rvalue; export make_free_glue, autoderef, duplicate; |
