Skip to content

Commit 7e1a5ac

Browse files
committed
---
yaml --- r: 24135 b: refs/heads/master c: 267ab11 h: refs/heads/master i: 24133: d17ee94 24131: a13c82c 24127: def1b2f v: v3
1 parent 2d96590 commit 7e1a5ac

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+134
-69
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 37aee97e4b22c58ed2c7898d666c62fb27646851
2+
refs/heads/master: 267ab11cca722c1c83dcb6df949961390af787c1
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: cd6f24f9d14ac90d167386a56e7a6ac1f0318195
55
refs/heads/try: ffbe0e0e00374358b789b0037bcb3a577cd218be

trunk/src/cargo/cargo.rc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
#[no_core];
2020
#[legacy_exports];
2121

22+
#[legacy_modes];
23+
2224
#[allow(vecs_implicitly_copyable,
2325
non_implicitly_copyable_typarams)];
2426
#[allow(non_camel_case_types)];

trunk/src/compiletest/compiletest.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use common::mode_pretty;
1212
use common::mode;
1313
use util::logv;
1414

15-
fn main(args: ~[~str]) {
15+
fn main(++args: ~[~str]) {
1616
let config = parse_config(args);
1717
log_config(config);
1818
run_tests(config);

trunk/src/libcore/pipes.rs

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -256,16 +256,31 @@ fn entangle_buffer<T: Send, Tstart: Send>(
256256
(SendPacketBuffered(p), RecvPacketBuffered(p))
257257
}
258258

259+
#[cfg(stage0)]
259260
#[abi = "rust-intrinsic"]
260261
#[doc(hidden)]
261262
extern mod rusti {
262263
#[legacy_exports];
263-
fn atomic_xchg(dst: &mut int, src: int) -> int;
264-
fn atomic_xchg_acq(dst: &mut int, src: int) -> int;
265-
fn atomic_xchg_rel(dst: &mut int, src: int) -> int;
264+
fn atomic_xchg(dst: &mut int, ++src: int) -> int;
265+
fn atomic_xchg_acq(dst: &mut int, ++src: int) -> int;
266+
fn atomic_xchg_rel(dst: &mut int, ++src: int) -> int;
266267

267-
fn atomic_xadd_acq(dst: &mut int, src: int) -> int;
268-
fn atomic_xsub_rel(dst: &mut int, src: int) -> int;
268+
fn atomic_xadd_acq(dst: &mut int, ++src: int) -> int;
269+
fn atomic_xsub_rel(dst: &mut int, ++src: int) -> int;
270+
}
271+
272+
#[cfg(stage1)]
273+
#[cfg(stage2)]
274+
#[abi = "rust-intrinsic"]
275+
#[doc(hidden)]
276+
extern mod rusti {
277+
#[legacy_exports];
278+
fn atomic_xchg(dst: &mut int, +src: int) -> int;
279+
fn atomic_xchg_acq(dst: &mut int, +src: int) -> int;
280+
fn atomic_xchg_rel(dst: &mut int, +src: int) -> int;
281+
282+
fn atomic_xadd_acq(dst: &mut int, +src: int) -> int;
283+
fn atomic_xsub_rel(dst: &mut int, +src: int) -> int;
269284
}
270285

271286
// If I call the rusti versions directly from a polymorphic function,

trunk/src/libcore/uint-template.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ pure fn to_str_bytes<U>(neg: bool, num: T, radix: uint,
240240
}
241241

242242
vec::raw::form_slice(ptr::offset(p, i),
243-
len - i, f)
243+
len - i, f)
244244
}
245245
}
246246
}

trunk/src/libcore/vec.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1723,7 +1723,7 @@ mod raw {
17231723
* not bytes).
17241724
*/
17251725
#[inline(always)]
1726-
unsafe fn form_slice<T,U>(p: *T, len: uint, f: fn(&&v: &[T]) -> U) -> U {
1726+
unsafe fn form_slice<T,U>(p: *T, len: uint, f: fn(v: &[T]) -> U) -> U {
17271727
let pair = (p, len * sys::size_of::<T>());
17281728
let v : *(&blk/[T]) =
17291729
::cast::reinterpret_cast(&ptr::addr_of(pair));

trunk/src/rustc/front/intrinsic.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,6 @@ mod intrinsic {
116116
extern mod rusti {
117117
#[legacy_exports];
118118
fn get_tydesc<T>() -> *();
119-
fn visit_tydesc(td: *TyDesc, &&tv: TyVisitor);
119+
fn visit_tydesc(++td: *TyDesc, &&tv: TyVisitor);
120120
}
121121
}

trunk/src/rustc/middle/ty.rs

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ export type_is_numeric;
133133
export type_is_pod;
134134
export type_is_scalar;
135135
export type_is_immediate;
136+
export type_is_borrowed;
136137
export type_is_sequence;
137138
export type_is_signed;
138139
export type_is_structural;
@@ -1090,13 +1091,21 @@ pure fn mach_sty(cfg: @session::config, t: t) -> sty {
10901091
}
10911092

10921093
fn default_arg_mode_for_ty(tcx: ctxt, ty: ty::t) -> ast::rmode {
1093-
return if ty::type_is_immediate(ty) {
1094-
ast::by_val
1095-
} else if tcx.legacy_modes || type_is_fn(ty) {
1096-
// ^^^^^^^^^^^^^^
1094+
return if type_is_fn(ty) {
1095+
// ^^^^^^^^^^^^^^
10971096
// FIXME(#2202) --- We retain by-ref by default to workaround a memory
10981097
// leak that otherwise results when @fn is upcast to &fn.
10991098
ast::by_ref
1099+
} else if tcx.legacy_modes {
1100+
if type_is_borrowed(ty) {
1101+
// the old mode default was ++ for things like &ptr, but to be
1102+
// forward-compatible with non-legacy, we should use +
1103+
ast::by_copy
1104+
} else if ty::type_is_immediate(ty) {
1105+
ast::by_val
1106+
} else {
1107+
ast::by_ref
1108+
}
11001109
} else {
11011110
ast::by_copy
11021111
};
@@ -1107,6 +1116,18 @@ fn default_arg_mode_for_ty(tcx: ctxt, ty: ty::t) -> ast::rmode {
11071116
_ => false
11081117
}
11091118
}
1119+
1120+
fn type_is_borrowed(ty: t) -> bool {
1121+
match ty::get(ty).sty {
1122+
ty::ty_rptr(*) => true,
1123+
ty_evec(_, vstore_slice(_)) => true,
1124+
ty_estr(vstore_slice(_)) => true,
1125+
1126+
// technically, we prob ought to include
1127+
// &fn(), but that is treated specially due to #2202
1128+
_ => false
1129+
}
1130+
}
11101131
}
11111132

11121133
// Returns the narrowest lifetime enclosing the evaluation of the expression
@@ -1575,7 +1596,6 @@ fn type_is_immediate(ty: t) -> bool {
15751596
type_is_unique(ty) || type_is_region_ptr(ty);
15761597
}
15771598
1578-
15791599
fn type_needs_drop(cx: ctxt, ty: t) -> bool {
15801600
match cx.needs_drop_cache.find(ty) {
15811601
Some(result) => return result,

trunk/src/rustc/middle/typeck.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,14 @@ fn require_same_types(
256256
}
257257
}
258258
259-
fn arg_is_argv_ty(_tcx: ty::ctxt, a: ty::arg) -> bool {
259+
fn arg_is_argv_ty(tcx: ty::ctxt, a: ty::arg) -> bool {
260+
match ty::resolved_mode(tcx, a.mode) {
261+
ast::by_val => { /*ok*/ }
262+
_ => {
263+
return false;
264+
}
265+
}
266+
260267
match ty::get(a.ty).sty {
261268
ty::ty_evec(mt, vstore_uniq) => {
262269
if mt.mutbl != ast::m_imm { return false; }
@@ -300,7 +307,7 @@ fn check_main_fn_ty(ccx: @crate_ctxt,
300307
tcx.sess.span_err(
301308
main_span,
302309
fmt!("Wrong type in main function: found `%s`, \
303-
expected `extern fn(~[str]) -> ()` \
310+
expected `extern fn(++v: ~[~str]) -> ()` \
304311
or `extern fn() -> ()`",
305312
ty_to_str(tcx, main_t)));
306313
}

trunk/src/rustc/middle/typeck/check.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2609,10 +2609,10 @@ fn check_intrinsic_type(ccx: @crate_ctxt, it: @ast::foreign_item) {
26092609
~"atomic_xchg" | ~"atomic_xadd" | ~"atomic_xsub" |
26102610
~"atomic_xchg_acq" | ~"atomic_xadd_acq" | ~"atomic_xsub_acq" |
26112611
~"atomic_xchg_rel" | ~"atomic_xadd_rel" | ~"atomic_xsub_rel" => {
2612-
(0u, ~[arg(ast::by_val,
2612+
(0u, ~[arg(ast::by_copy,
26132613
ty::mk_mut_rptr(tcx, ty::re_bound(ty::br_anon(0)),
26142614
ty::mk_int(tcx))),
2615-
arg(ast::by_val, ty::mk_int(tcx))],
2615+
arg(ast::by_copy, ty::mk_int(tcx))],
26162616
ty::mk_int(tcx))
26172617
}
26182618

trunk/src/test/bench/core-map.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ fn empty_results() -> Results {
142142
}
143143
}
144144

145-
fn main(args: ~[~str]) {
145+
fn main(++args: ~[~str]) {
146146
let num_keys = {
147147
if args.len() == 2 {
148148
uint::from_str(args[1]).get()

trunk/src/test/bench/core-std.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use std::map::{Map, HashMap};
88

99
use io::{Reader, ReaderUtil};
1010

11-
fn main(argv: ~[~str]) {
11+
fn main(++argv: ~[~str]) {
1212
#macro[
1313
[#bench[id],
1414
maybe_run_test(argv, #stringify(id), id)

trunk/src/test/bench/core-uint-to-str.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
fn main(args: ~[~str]) {
1+
fn main(++args: ~[~str]) {
22
let args = if os::getenv(~"RUST_BENCH").is_some() {
33
~[~"", ~"10000000"]
44
} else if args.len() <= 1u {

trunk/src/test/bench/core-vec-append.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ fn collect_dvec(num: uint) -> ~[uint] {
2020
return dvec::unwrap(move result);
2121
}
2222

23-
fn main(args: ~[~str]) {
23+
fn main(++args: ~[~str]) {
2424
let args = if os::getenv(~"RUST_BENCH").is_some() {
2525
~[~"", ~"50000000"]
2626
} else if args.len() <= 1u {

trunk/src/test/bench/graph500-bfs.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ fn validate(edges: ~[(node_id, node_id)],
384384
true
385385
}
386386
387-
fn main(args: ~[~str]) {
387+
fn main(++args: ~[~str]) {
388388
let args = if os::getenv(~"RUST_BENCH").is_some() {
389389
~[~"", ~"15", ~"48"]
390390
} else if args.len() <= 1u {

trunk/src/test/bench/msgsend-pipes-shared.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ fn run(args: &[~str]) {
9090
assert result == num_bytes * size;
9191
}
9292

93-
fn main(args: ~[~str]) {
93+
fn main(++args: ~[~str]) {
9494
let args = if os::getenv(~"RUST_BENCH").is_some() {
9595
~[~"", ~"1000000", ~"10000"]
9696
} else if args.len() <= 1u {

trunk/src/test/bench/msgsend-pipes.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ fn run(args: &[~str]) {
8787
assert result == num_bytes * size;
8888
}
8989

90-
fn main(args: ~[~str]) {
90+
fn main(++args: ~[~str]) {
9191
let args = if os::getenv(~"RUST_BENCH").is_some() {
9292
~[~"", ~"1000000", ~"8"]
9393
} else if args.len() <= 1u {

trunk/src/test/bench/msgsend-ring-mutex-arcs.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ fn thread_ring(i: uint,
5656
};
5757
}
5858

59-
fn main(args: ~[~str]) {
59+
fn main(++args: ~[~str]) {
6060
let args = if os::getenv(~"RUST_BENCH").is_some() {
6161
~[~"", ~"100", ~"10000"]
6262
} else if args.len() <= 1u {

trunk/src/test/bench/msgsend-ring-pipes.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ fn thread_ring(i: uint,
5252
};
5353
}
5454

55-
fn main(args: ~[~str]) {
55+
fn main(++args: ~[~str]) {
5656
let args = if os::getenv(~"RUST_BENCH").is_some() {
5757
~[~"", ~"100", ~"10000"]
5858
} else if args.len() <= 1u {

trunk/src/test/bench/msgsend-ring-rw-arcs.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ fn thread_ring(i: uint,
5656
};
5757
}
5858

59-
fn main(args: ~[~str]) {
59+
fn main(++args: ~[~str]) {
6060
let args = if os::getenv(~"RUST_BENCH").is_some() {
6161
~[~"", ~"100", ~"10000"]
6262
} else if args.len() <= 1u {

trunk/src/test/bench/msgsend-ring.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ fn thread_ring(i: uint,
2121
};
2222
}
2323

24-
fn main(args: ~[~str]) {
24+
fn main(++args: ~[~str]) {
2525
let args = if os::getenv(~"RUST_BENCH").is_some() {
2626
~[~"", ~"100", ~"10000"]
2727
} else if args.len() <= 1u {

trunk/src/test/bench/msgsend.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ fn run(args: ~[~str]) {
5757
io::stdout().write_str(fmt!("Throughput=%f per sec\n", thruput));
5858
}
5959

60-
fn main(args: ~[~str]) {
60+
fn main(++args: ~[~str]) {
6161
let args = if os::getenv(~"RUST_BENCH").is_some() {
6262
~[~"", ~"1000000", ~"10000"]
6363
} else if args.len() <= 1u {

trunk/src/test/bench/shootout-ackermann.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ fn ack(m: int, n: int) -> int {
1212
}
1313
}
1414

15-
fn main(args: ~[~str]) {
15+
fn main(++args: ~[~str]) {
1616
let args = if os::getenv(~"RUST_BENCH").is_some() {
1717
~[~"", ~"12"]
1818
} else if args.len() <= 1u {

trunk/src/test/bench/shootout-binarytrees.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ fn bottom_up_tree(arena: &r/arena::Arena,
2525
return arena.alloc(|| nil);
2626
}
2727

28-
fn main(args: ~[~str]) {
28+
fn main(++args: ~[~str]) {
2929
let args = if os::getenv(~"RUST_BENCH").is_some() {
3030
~[~"", ~"17"]
3131
} else if args.len() <= 1u {

trunk/src/test/bench/shootout-chameneos-redux.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ fn rendezvous(nn: uint, set: ~[color]) {
178178
io::println(show_number(creatures_met));
179179
}
180180
181-
fn main(args: ~[~str]) {
181+
fn main(++args: ~[~str]) {
182182
let args = if os::getenv(~"RUST_BENCH").is_some() {
183183
~[~"", ~"200000"]
184184
} else if args.len() <= 1u {

trunk/src/test/bench/shootout-fannkuchredux.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ fn fannkuch(n: int) -> int {
55
fn perm1init(i: uint) -> int { return i as int; }
66

77
let perm = vec::to_mut(vec::from_elem(n as uint, 0));
8-
let perm1 = vec::to_mut(vec::from_fn(n as uint, perm1init));
8+
let perm1 = vec::to_mut(vec::from_fn(n as uint, |i| perm1init(i)));
99
let count = vec::to_mut(vec::from_elem(n as uint, 0));
1010
let mut f = 0;
1111
let mut i = 0;
@@ -56,7 +56,7 @@ fn fannkuch(n: int) -> int {
5656
return flips;
5757
}
5858

59-
fn main(args: ~[~str]) {
59+
fn main(++args: ~[~str]) {
6060
let args = if os::getenv(~"RUST_BENCH").is_some() {
6161
~[~"", ~"10"]
6262
} else if args.len() <= 1u {

trunk/src/test/bench/shootout-fasta.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ fn make_repeat_fasta(wr: io::Writer, id: ~str, desc: ~str, s: ~str, n: int) unsa
7070

7171
fn acid(ch: char, prob: u32) -> aminoacids { return {ch: ch, prob: prob}; }
7272

73-
fn main(args: ~[~str]) {
73+
fn main(++args: ~[~str]) {
7474
let args = if os::getenv(~"RUST_BENCH").is_some() {
7575
// alioth tests k-nucleotide with this data at 25,000,000
7676
~[~"", ~"5000000"]

trunk/src/test/bench/shootout-fibo.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ fn fib(n: int) -> int {
88
}
99
}
1010

11-
fn main(args: ~[~str]) {
11+
fn main(++args: ~[~str]) {
1212
let args = if os::getenv(~"RUST_BENCH").is_some() {
1313
~[~"", ~"40"]
1414
} else if args.len() <= 1u {

trunk/src/test/bench/shootout-k-nucleotide-pipes.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ fn make_sequence_processor(sz: uint, from_parent: pipes::Port<~[u8]>,
128128
}
129129
130130
// given a FASTA file on stdin, process sequence THREE
131-
fn main(args: ~[~str]) {
131+
fn main(++args: ~[~str]) {
132132
let rdr = if os::getenv(~"RUST_BENCH").is_some() {
133133
// FIXME: Using this compile-time env variable is a crummy way to
134134
// get to this massive data set, but #include_bin chokes on it (#2598)

trunk/src/test/bench/shootout-k-nucleotide.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ fn make_sequence_processor(sz: uint, from_parent: comm::Port<~[u8]>,
125125
}
126126
127127
// given a FASTA file on stdin, process sequence THREE
128-
fn main(args: ~[~str]) {
128+
fn main(++args: ~[~str]) {
129129
let rdr = if os::getenv(~"RUST_BENCH").is_some() {
130130
// FIXME: Using this compile-time env variable is a crummy way to
131131
// get to this massive data set, but #include_bin chokes on it (#2598)

trunk/src/test/bench/shootout-mandelbrot.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ fn writer(path: ~str, writech: comm::Chan<comm::Chan<line>>, size: uint)
151151
}
152152
}
153153

154-
fn main(args: ~[~str]) {
154+
fn main(++args: ~[~str]) {
155155
let args = if os::getenv(~"RUST_BENCH").is_some() {
156156
~[~"", ~"4000", ~"10"]
157157
} else {

trunk/src/test/bench/shootout-nbody.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ extern mod libc {
1414
fn sqrt(n: float) -> float;
1515
}
1616

17-
fn main(args: ~[~str]) {
17+
fn main(++args: ~[~str]) {
1818
let args = if os::getenv(~"RUST_BENCH").is_some() {
1919
~[~"", ~"4000000"]
2020
} else if args.len() <= 1u {

trunk/src/test/bench/shootout-pfib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ fn stress(num_tasks: int) {
8181
for results.each |r| { future::get(r); }
8282
}
8383

84-
fn main(args: ~[~str]) {
84+
fn main(++args: ~[~str]) {
8585
let args = if os::getenv(~"RUST_BENCH").is_some() {
8686
~[~"", ~"20"]
8787
} else if args.len() <= 1u {

0 commit comments

Comments
 (0)