提交 ca49fd40 编写于 作者: T Tim Chevalier

wip

上级 e16dbb78
......@@ -40,15 +40,15 @@
#[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 @@
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 @@
#[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 @@
#[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 @@
#[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;
......
......@@ -7,9 +7,18 @@
#[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
......
......@@ -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) {
......
......@@ -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;
}
......
......@@ -10,8 +10,8 @@
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(
......
......@@ -26,7 +26,7 @@
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 @@ fn parse_ty(colons_before_params: bool) -> @ty {
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 @@ fn parse_tt_tok(p: parser, delim_ok: bool) -> token_tree {
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 @@ fn parse_matchers() -> ~[matcher] {
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")
}
......
......@@ -230,7 +230,7 @@ fn to_str(in: @ident_interner, t: token) -> ~str {
}
/// 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,
......
......@@ -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) => ~"++",
......
......@@ -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);
......
......@@ -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,
......
......@@ -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('='),
......
......@@ -396,10 +396,10 @@ impl bckerr : cmp::Eq {
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
}
......
......@@ -529,8 +529,7 @@ fn check_call(expr: @ast::expr,
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 {
......
......@@ -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);
......
......@@ -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,
......
......@@ -398,8 +398,8 @@ fn add_last_use(expr_id: node_id, var: Variable) {
(*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 @@ fn merge_from_succ(ln: LiveNode, succ_ln: LiveNode,
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 @@ fn merge_from_succ(ln: LiveNode, succ_ln: LiveNode,
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 @@ fn propagate_through_fn_block(decl: fn_decl, blk: blk) -> LiveNode {
// 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 @@ fn warn_about_unused_args(sp: span, decl: fn_decl, entry_ln: LiveNode) {
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);
}
......
......@@ -523,9 +523,6 @@ fn cat_def(id: ast::node_id,
// 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))}
}
......
......@@ -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 => {
......
......@@ -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);
}
......
......@@ -208,7 +208,6 @@ fn visit_ty(t: ty::t) {
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
}
......
......@@ -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;
}
......@@ -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 => {}
}
}
}
......
......@@ -3,7 +3,6 @@
use common::*;
use build::*;
use base::*;
use shape::llsize_of;
use datum::immediate_rvalue;
export make_free_glue, autoderef, duplicate;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册