Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

use + mode for (almost) everything when not using legacy modes

  • Loading branch information...
commit 267ab11cca722c1c83dcb6df949961390af787c1 1 parent 37aee97
@nikomatsakis nikomatsakis authored
Showing with 133 additions and 68 deletions.
  1. +2 −0  src/cargo/cargo.rc
  2. +1 −1  src/compiletest/compiletest.rs
  3. +20 −5 src/libcore/pipes.rs
  4. +1 −1  src/libcore/uint-template.rs
  5. +1 −1  src/libcore/vec.rs
  6. +1 −1  src/rustc/front/intrinsic.rs
  7. +25 −5 src/rustc/middle/ty.rs
  8. +9 −2 src/rustc/middle/typeck.rs
  9. +2 −2 src/rustc/middle/typeck/check.rs
  10. +1 −1  src/test/bench/core-map.rs
  11. +1 −1  src/test/bench/core-std.rs
  12. +1 −1  src/test/bench/core-uint-to-str.rs
  13. +1 −1  src/test/bench/core-vec-append.rs
  14. +1 −1  src/test/bench/graph500-bfs.rs
  15. +1 −1  src/test/bench/msgsend-pipes-shared.rs
  16. +1 −1  src/test/bench/msgsend-pipes.rs
  17. +1 −1  src/test/bench/msgsend-ring-mutex-arcs.rs
  18. +1 −1  src/test/bench/msgsend-ring-pipes.rs
  19. +1 −1  src/test/bench/msgsend-ring-rw-arcs.rs
  20. +1 −1  src/test/bench/msgsend-ring.rs
  21. +1 −1  src/test/bench/msgsend.rs
  22. +1 −1  src/test/bench/shootout-ackermann.rs
  23. +1 −1  src/test/bench/shootout-binarytrees.rs
  24. +1 −1  src/test/bench/shootout-chameneos-redux.rs
  25. +2 −2 src/test/bench/shootout-fannkuchredux.rs
  26. +1 −1  src/test/bench/shootout-fasta.rs
  27. +1 −1  src/test/bench/shootout-fibo.rs
  28. +1 −1  src/test/bench/shootout-k-nucleotide-pipes.rs
  29. +1 −1  src/test/bench/shootout-k-nucleotide.rs
  30. +1 −1  src/test/bench/shootout-mandelbrot.rs
  31. +1 −1  src/test/bench/shootout-nbody.rs
  32. +1 −1  src/test/bench/shootout-pfib.rs
  33. +1 −1  src/test/bench/shootout-spectralnorm.rs
  34. +1 −1  src/test/bench/shootout-threadring.rs
  35. +1 −1  src/test/bench/std-smallintmap.rs
  36. +1 −1  src/test/bench/sudoku.rs
  37. +1 −1  src/test/bench/task-perf-jargon-metal-smoke.rs
  38. +1 −1  src/test/bench/task-perf-linked-failure.rs
  39. +1 −1  src/test/bench/task-perf-one-million.rs
  40. +1 −1  src/test/bench/task-perf-spawnalot.rs
  41. +1 −1  src/test/bench/task-perf-word-count-generic.rs
  42. +1 −1  src/test/compile-fail/bad-main.rs
  43. +1 −0  src/test/run-pass/alt-pattern-drop.rs
  44. +1 −1  src/test/run-pass/argv.rs
  45. +1 −1  src/test/run-pass/command-line-args.rs
  46. +1 −1  src/test/run-pass/foreign2.rs
  47. +1 −1  src/test/run-pass/import4.rs
  48. +1 −1  src/test/run-pass/import5.rs
  49. +1 −1  src/test/run-pass/import7.rs
  50. +2 −2 src/test/run-pass/issue-2834.rs
  51. +1 −1  src/test/run-pass/main-ivec.rs
  52. +20 −0 src/test/run-pass/non-legacy-modes.rs
  53. +2 −2 src/test/run-pass/option-ext.rs
  54. +1 −1  src/test/run-pass/path.rs
  55. +1 −1  src/test/run-pass/swap-2.rs
  56. +1 −1  src/test/run-pass/tag-in-block.rs
  57. +1 −1  src/test/run-pass/type-param.rs
  58. +1 −1  src/test/run-pass/type-ptr.rs
View
2  src/cargo/cargo.rc
@@ -19,6 +19,8 @@
#[no_core];
#[legacy_exports];
+#[legacy_modes];
+
#[allow(vecs_implicitly_copyable,
non_implicitly_copyable_typarams)];
#[allow(non_camel_case_types)];
View
2  src/compiletest/compiletest.rs
@@ -12,7 +12,7 @@ use common::mode_pretty;
use common::mode;
use util::logv;
-fn main(args: ~[~str]) {
+fn main(++args: ~[~str]) {
let config = parse_config(args);
log_config(config);
run_tests(config);
View
25 src/libcore/pipes.rs
@@ -256,16 +256,31 @@ fn entangle_buffer<T: Send, Tstart: Send>(
(SendPacketBuffered(p), RecvPacketBuffered(p))
}
+#[cfg(stage0)]
#[abi = "rust-intrinsic"]
#[doc(hidden)]
extern mod rusti {
#[legacy_exports];
- fn atomic_xchg(dst: &mut int, src: int) -> int;
- fn atomic_xchg_acq(dst: &mut int, src: int) -> int;
- fn atomic_xchg_rel(dst: &mut int, src: int) -> int;
+ fn atomic_xchg(dst: &mut int, ++src: int) -> int;
+ fn atomic_xchg_acq(dst: &mut int, ++src: int) -> int;
+ fn atomic_xchg_rel(dst: &mut int, ++src: int) -> int;
- fn atomic_xadd_acq(dst: &mut int, src: int) -> int;
- fn atomic_xsub_rel(dst: &mut int, src: int) -> int;
+ fn atomic_xadd_acq(dst: &mut int, ++src: int) -> int;
+ fn atomic_xsub_rel(dst: &mut int, ++src: int) -> int;
+}
+
+#[cfg(stage1)]
+#[cfg(stage2)]
+#[abi = "rust-intrinsic"]
+#[doc(hidden)]
+extern mod rusti {
+ #[legacy_exports];
+ fn atomic_xchg(dst: &mut int, +src: int) -> int;
+ fn atomic_xchg_acq(dst: &mut int, +src: int) -> int;
+ fn atomic_xchg_rel(dst: &mut int, +src: int) -> int;
+
+ fn atomic_xadd_acq(dst: &mut int, +src: int) -> int;
+ fn atomic_xsub_rel(dst: &mut int, +src: int) -> int;
}
// If I call the rusti versions directly from a polymorphic function,
View
2  src/libcore/uint-template.rs
@@ -240,7 +240,7 @@ pure fn to_str_bytes<U>(neg: bool, num: T, radix: uint,
}
vec::raw::form_slice(ptr::offset(p, i),
- len - i, f)
+ len - i, f)
}
}
}
View
2  src/libcore/vec.rs
@@ -1723,7 +1723,7 @@ mod raw {
* not bytes).
*/
#[inline(always)]
- unsafe fn form_slice<T,U>(p: *T, len: uint, f: fn(&&v: &[T]) -> U) -> U {
+ unsafe fn form_slice<T,U>(p: *T, len: uint, f: fn(v: &[T]) -> U) -> U {
let pair = (p, len * sys::size_of::<T>());
let v : *(&blk/[T]) =
::cast::reinterpret_cast(&ptr::addr_of(pair));
View
2  src/rustc/front/intrinsic.rs
@@ -116,6 +116,6 @@ mod intrinsic {
extern mod rusti {
#[legacy_exports];
fn get_tydesc<T>() -> *();
- fn visit_tydesc(td: *TyDesc, &&tv: TyVisitor);
+ fn visit_tydesc(++td: *TyDesc, &&tv: TyVisitor);
}
}
View
30 src/rustc/middle/ty.rs
@@ -133,6 +133,7 @@ export type_is_numeric;
export type_is_pod;
export type_is_scalar;
export type_is_immediate;
+export type_is_borrowed;
export type_is_sequence;
export type_is_signed;
export type_is_structural;
@@ -1090,13 +1091,21 @@ pure fn mach_sty(cfg: @session::config, t: t) -> sty {
}
fn default_arg_mode_for_ty(tcx: ctxt, ty: ty::t) -> ast::rmode {
- return if ty::type_is_immediate(ty) {
- ast::by_val
- } else if tcx.legacy_modes || type_is_fn(ty) {
- // ^^^^^^^^^^^^^^
+ return if type_is_fn(ty) {
+ // ^^^^^^^^^^^^^^
// FIXME(#2202) --- We retain by-ref by default to workaround a memory
// leak that otherwise results when @fn is upcast to &fn.
ast::by_ref
+ } else if tcx.legacy_modes {
+ if type_is_borrowed(ty) {
+ // the old mode default was ++ for things like &ptr, but to be
+ // forward-compatible with non-legacy, we should use +
+ ast::by_copy
+ } else if ty::type_is_immediate(ty) {
+ ast::by_val
+ } else {
+ ast::by_ref
+ }
} else {
ast::by_copy
};
@@ -1107,6 +1116,18 @@ fn default_arg_mode_for_ty(tcx: ctxt, ty: ty::t) -> ast::rmode {
_ => false
}
}
+
+ fn type_is_borrowed(ty: t) -> bool {
+ match ty::get(ty).sty {
+ ty::ty_rptr(*) => true,
+ ty_evec(_, vstore_slice(_)) => true,
+ ty_estr(vstore_slice(_)) => true,
+
+ // technically, we prob ought to include
+ // &fn(), but that is treated specially due to #2202
+ _ => false
+ }
+ }
}
// Returns the narrowest lifetime enclosing the evaluation of the expression
@@ -1575,7 +1596,6 @@ fn type_is_immediate(ty: t) -> bool {
type_is_unique(ty) || type_is_region_ptr(ty);
}
-
fn type_needs_drop(cx: ctxt, ty: t) -> bool {
match cx.needs_drop_cache.find(ty) {
Some(result) => return result,
View
11 src/rustc/middle/typeck.rs
@@ -256,7 +256,14 @@ fn require_same_types(
}
}
-fn arg_is_argv_ty(_tcx: ty::ctxt, a: ty::arg) -> bool {
+fn arg_is_argv_ty(tcx: ty::ctxt, a: ty::arg) -> bool {
+ match ty::resolved_mode(tcx, a.mode) {
+ ast::by_val => { /*ok*/ }
+ _ => {
+ return false;
+ }
+ }
+
match ty::get(a.ty).sty {
ty::ty_evec(mt, vstore_uniq) => {
if mt.mutbl != ast::m_imm { return false; }
@@ -300,7 +307,7 @@ fn check_main_fn_ty(ccx: @crate_ctxt,
tcx.sess.span_err(
main_span,
fmt!("Wrong type in main function: found `%s`, \
- expected `extern fn(~[str]) -> ()` \
+ expected `extern fn(++v: ~[~str]) -> ()` \
or `extern fn() -> ()`",
ty_to_str(tcx, main_t)));
}
View
4 src/rustc/middle/typeck/check.rs
@@ -2609,10 +2609,10 @@ fn check_intrinsic_type(ccx: @crate_ctxt, it: @ast::foreign_item) {
~"atomic_xchg" | ~"atomic_xadd" | ~"atomic_xsub" |
~"atomic_xchg_acq" | ~"atomic_xadd_acq" | ~"atomic_xsub_acq" |
~"atomic_xchg_rel" | ~"atomic_xadd_rel" | ~"atomic_xsub_rel" => {
- (0u, ~[arg(ast::by_val,
+ (0u, ~[arg(ast::by_copy,
ty::mk_mut_rptr(tcx, ty::re_bound(ty::br_anon(0)),
ty::mk_int(tcx))),
- arg(ast::by_val, ty::mk_int(tcx))],
+ arg(ast::by_copy, ty::mk_int(tcx))],
ty::mk_int(tcx))
}
View
2  src/test/bench/core-map.rs
@@ -142,7 +142,7 @@ fn empty_results() -> Results {
}
}
-fn main(args: ~[~str]) {
+fn main(++args: ~[~str]) {
let num_keys = {
if args.len() == 2 {
uint::from_str(args[1]).get()
View
2  src/test/bench/core-std.rs
@@ -8,7 +8,7 @@ use std::map::{Map, HashMap};
use io::{Reader, ReaderUtil};
-fn main(argv: ~[~str]) {
+fn main(++argv: ~[~str]) {
#macro[
[#bench[id],
maybe_run_test(argv, #stringify(id), id)
View
2  src/test/bench/core-uint-to-str.rs
@@ -1,4 +1,4 @@
-fn main(args: ~[~str]) {
+fn main(++args: ~[~str]) {
let args = if os::getenv(~"RUST_BENCH").is_some() {
~[~"", ~"10000000"]
} else if args.len() <= 1u {
View
2  src/test/bench/core-vec-append.rs
@@ -20,7 +20,7 @@ fn collect_dvec(num: uint) -> ~[uint] {
return dvec::unwrap(move result);
}
-fn main(args: ~[~str]) {
+fn main(++args: ~[~str]) {
let args = if os::getenv(~"RUST_BENCH").is_some() {
~[~"", ~"50000000"]
} else if args.len() <= 1u {
View
2  src/test/bench/graph500-bfs.rs
@@ -384,7 +384,7 @@ fn validate(edges: ~[(node_id, node_id)],
true
}
-fn main(args: ~[~str]) {
+fn main(++args: ~[~str]) {
let args = if os::getenv(~"RUST_BENCH").is_some() {
~[~"", ~"15", ~"48"]
} else if args.len() <= 1u {
View
2  src/test/bench/msgsend-pipes-shared.rs
@@ -90,7 +90,7 @@ fn run(args: &[~str]) {
assert result == num_bytes * size;
}
-fn main(args: ~[~str]) {
+fn main(++args: ~[~str]) {
let args = if os::getenv(~"RUST_BENCH").is_some() {
~[~"", ~"1000000", ~"10000"]
} else if args.len() <= 1u {
View
2  src/test/bench/msgsend-pipes.rs
@@ -87,7 +87,7 @@ fn run(args: &[~str]) {
assert result == num_bytes * size;
}
-fn main(args: ~[~str]) {
+fn main(++args: ~[~str]) {
let args = if os::getenv(~"RUST_BENCH").is_some() {
~[~"", ~"1000000", ~"8"]
} else if args.len() <= 1u {
View
2  src/test/bench/msgsend-ring-mutex-arcs.rs
@@ -56,7 +56,7 @@ fn thread_ring(i: uint,
};
}
-fn main(args: ~[~str]) {
+fn main(++args: ~[~str]) {
let args = if os::getenv(~"RUST_BENCH").is_some() {
~[~"", ~"100", ~"10000"]
} else if args.len() <= 1u {
View
2  src/test/bench/msgsend-ring-pipes.rs
@@ -52,7 +52,7 @@ fn thread_ring(i: uint,
};
}
-fn main(args: ~[~str]) {
+fn main(++args: ~[~str]) {
let args = if os::getenv(~"RUST_BENCH").is_some() {
~[~"", ~"100", ~"10000"]
} else if args.len() <= 1u {
View
2  src/test/bench/msgsend-ring-rw-arcs.rs
@@ -56,7 +56,7 @@ fn thread_ring(i: uint,
};
}
-fn main(args: ~[~str]) {
+fn main(++args: ~[~str]) {
let args = if os::getenv(~"RUST_BENCH").is_some() {
~[~"", ~"100", ~"10000"]
} else if args.len() <= 1u {
View
2  src/test/bench/msgsend-ring.rs
@@ -21,7 +21,7 @@ fn thread_ring(i: uint,
};
}
-fn main(args: ~[~str]) {
+fn main(++args: ~[~str]) {
let args = if os::getenv(~"RUST_BENCH").is_some() {
~[~"", ~"100", ~"10000"]
} else if args.len() <= 1u {
View
2  src/test/bench/msgsend.rs
@@ -57,7 +57,7 @@ fn run(args: ~[~str]) {
io::stdout().write_str(fmt!("Throughput=%f per sec\n", thruput));
}
-fn main(args: ~[~str]) {
+fn main(++args: ~[~str]) {
let args = if os::getenv(~"RUST_BENCH").is_some() {
~[~"", ~"1000000", ~"10000"]
} else if args.len() <= 1u {
View
2  src/test/bench/shootout-ackermann.rs
@@ -12,7 +12,7 @@ fn ack(m: int, n: int) -> int {
}
}
-fn main(args: ~[~str]) {
+fn main(++args: ~[~str]) {
let args = if os::getenv(~"RUST_BENCH").is_some() {
~[~"", ~"12"]
} else if args.len() <= 1u {
View
2  src/test/bench/shootout-binarytrees.rs
@@ -25,7 +25,7 @@ fn bottom_up_tree(arena: &r/arena::Arena,
return arena.alloc(|| nil);
}
-fn main(args: ~[~str]) {
+fn main(++args: ~[~str]) {
let args = if os::getenv(~"RUST_BENCH").is_some() {
~[~"", ~"17"]
} else if args.len() <= 1u {
View
2  src/test/bench/shootout-chameneos-redux.rs
@@ -178,7 +178,7 @@ fn rendezvous(nn: uint, set: ~[color]) {
io::println(show_number(creatures_met));
}
-fn main(args: ~[~str]) {
+fn main(++args: ~[~str]) {
let args = if os::getenv(~"RUST_BENCH").is_some() {
~[~"", ~"200000"]
} else if args.len() <= 1u {
View
4 src/test/bench/shootout-fannkuchredux.rs
@@ -5,7 +5,7 @@ fn fannkuch(n: int) -> int {
fn perm1init(i: uint) -> int { return i as int; }
let perm = vec::to_mut(vec::from_elem(n as uint, 0));
- let perm1 = vec::to_mut(vec::from_fn(n as uint, perm1init));
+ let perm1 = vec::to_mut(vec::from_fn(n as uint, |i| perm1init(i)));
let count = vec::to_mut(vec::from_elem(n as uint, 0));
let mut f = 0;
let mut i = 0;
@@ -56,7 +56,7 @@ fn fannkuch(n: int) -> int {
return flips;
}
-fn main(args: ~[~str]) {
+fn main(++args: ~[~str]) {
let args = if os::getenv(~"RUST_BENCH").is_some() {
~[~"", ~"10"]
} else if args.len() <= 1u {
View
2  src/test/bench/shootout-fasta.rs
@@ -70,7 +70,7 @@ fn make_repeat_fasta(wr: io::Writer, id: ~str, desc: ~str, s: ~str, n: int) unsa
fn acid(ch: char, prob: u32) -> aminoacids { return {ch: ch, prob: prob}; }
-fn main(args: ~[~str]) {
+fn main(++args: ~[~str]) {
let args = if os::getenv(~"RUST_BENCH").is_some() {
// alioth tests k-nucleotide with this data at 25,000,000
~[~"", ~"5000000"]
View
2  src/test/bench/shootout-fibo.rs
@@ -8,7 +8,7 @@ fn fib(n: int) -> int {
}
}
-fn main(args: ~[~str]) {
+fn main(++args: ~[~str]) {
let args = if os::getenv(~"RUST_BENCH").is_some() {
~[~"", ~"40"]
} else if args.len() <= 1u {
View
2  src/test/bench/shootout-k-nucleotide-pipes.rs
@@ -128,7 +128,7 @@ fn make_sequence_processor(sz: uint, from_parent: pipes::Port<~[u8]>,
}
// given a FASTA file on stdin, process sequence THREE
-fn main(args: ~[~str]) {
+fn main(++args: ~[~str]) {
let rdr = if os::getenv(~"RUST_BENCH").is_some() {
// FIXME: Using this compile-time env variable is a crummy way to
// get to this massive data set, but #include_bin chokes on it (#2598)
View
2  src/test/bench/shootout-k-nucleotide.rs
@@ -125,7 +125,7 @@ fn make_sequence_processor(sz: uint, from_parent: comm::Port<~[u8]>,
}
// given a FASTA file on stdin, process sequence THREE
-fn main(args: ~[~str]) {
+fn main(++args: ~[~str]) {
let rdr = if os::getenv(~"RUST_BENCH").is_some() {
// FIXME: Using this compile-time env variable is a crummy way to
// get to this massive data set, but #include_bin chokes on it (#2598)
View
2  src/test/bench/shootout-mandelbrot.rs
@@ -151,7 +151,7 @@ fn writer(path: ~str, writech: comm::Chan<comm::Chan<line>>, size: uint)
}
}
-fn main(args: ~[~str]) {
+fn main(++args: ~[~str]) {
let args = if os::getenv(~"RUST_BENCH").is_some() {
~[~"", ~"4000", ~"10"]
} else {
View
2  src/test/bench/shootout-nbody.rs
@@ -14,7 +14,7 @@ extern mod libc {
fn sqrt(n: float) -> float;
}
-fn main(args: ~[~str]) {
+fn main(++args: ~[~str]) {
let args = if os::getenv(~"RUST_BENCH").is_some() {
~[~"", ~"4000000"]
} else if args.len() <= 1u {
View
2  src/test/bench/shootout-pfib.rs
@@ -81,7 +81,7 @@ fn stress(num_tasks: int) {
for results.each |r| { future::get(r); }
}
-fn main(args: ~[~str]) {
+fn main(++args: ~[~str]) {
let args = if os::getenv(~"RUST_BENCH").is_some() {
~[~"", ~"20"]
} else if args.len() <= 1u {
View
2  src/test/bench/shootout-spectralnorm.rs
@@ -40,7 +40,7 @@ fn eval_AtA_times_u(u: ~[const float], AtAu: ~[mut float]) {
eval_At_times_u(v, AtAu);
}
-fn main(args: ~[~str]) {
+fn main(++args: ~[~str]) {
let args = if os::getenv(~"RUST_BENCH").is_some() {
~[~"", ~"2000"]
} else if args.len() <= 1u {
View
2  src/test/bench/shootout-threadring.rs
@@ -37,7 +37,7 @@ fn roundtrip(id: int, p: comm::Port<int>, ch: comm::Chan<int>) {
}
}
-fn main(args: ~[~str]) {
+fn main(++args: ~[~str]) {
let args = if os::getenv(~"RUST_BENCH").is_some() {
~[~"", ~"2000000"]
} else if args.len() <= 1u {
View
2  src/test/bench/std-smallintmap.rs
@@ -17,7 +17,7 @@ fn check_sequential(min: uint, max: uint, map: SmallIntMap<uint>) {
}
}
-fn main(args: ~[~str]) {
+fn main(++args: ~[~str]) {
let args = if os::getenv(~"RUST_BENCH").is_some() {
~[~"", ~"100000", ~"100"]
} else if args.len() <= 1u {
View
2  src/test/bench/sudoku.rs
@@ -126,7 +126,7 @@ fn write_grid(f: io::Writer, g: grid_t) {
}
}
-fn main(args: ~[~str]) {
+fn main(++args: ~[~str]) {
let grid = if vec::len(args) == 1u {
// FIXME create sudoku inline since nested vec consts dont work yet
// (#571)
View
2  src/test/bench/task-perf-jargon-metal-smoke.rs
@@ -23,7 +23,7 @@ fn child_generation(gens_left: uint, -c: pipes::Chan<()>) {
}
}
-fn main(args: ~[~str]) {
+fn main(++args: ~[~str]) {
let args = if os::getenv(~"RUST_BENCH").is_some() {
~[~"", ~"100000"]
} else if args.len() <= 1u {
View
2  src/test/bench/task-perf-linked-failure.rs
@@ -37,7 +37,7 @@ fn spawn_supervised_blocking(myname: &str, +f: fn~()) {
assert x == task::Success;
}
-fn main(args: ~[~str]) {
+fn main(++args: ~[~str]) {
let args = if os::getenv(~"RUST_BENCH").is_some() {
~[~"", ~"100000"]
} else if args.len() <= 1u {
View
2  src/test/bench/task-perf-one-million.rs
@@ -48,7 +48,7 @@ fn calc(children: uint, parent_ch: comm::Chan<msg>) {
comm::send(parent_ch, done(sum + 1));
}
-fn main(args: ~[~str]) {
+fn main(++args: ~[~str]) {
let args = if os::getenv(~"RUST_BENCH").is_some() {
~[~"", ~"100000"]
} else if args.len() <= 1u {
View
2  src/test/bench/task-perf-spawnalot.rs
@@ -8,7 +8,7 @@ fn f(&&n: uint) {
fn g() { }
-fn main(args: ~[~str]) {
+fn main(++args: ~[~str]) {
let args = if os::getenv(~"RUST_BENCH").is_some() {
~[~"", ~"400"]
} else if args.len() <= 1u {
View
2  src/test/bench/task-perf-word-count-generic.rs
@@ -289,7 +289,7 @@ mod map_reduce {
}
}
-fn main(argv: ~[~str]) {
+fn main(++argv: ~[~str]) {
if vec::len(argv) < 2u && !os::getenv(~"RUST_BENCH").is_some() {
let out = io::stdout();
View
2  src/test/compile-fail/bad-main.rs
@@ -1,3 +1,3 @@
-// error-pattern:expected `extern fn(~[str])
+// error-pattern:expected `extern fn(++v: ~[~str])
fn main(x: int) { }
View
1  src/test/run-pass/alt-pattern-drop.rs
@@ -18,6 +18,7 @@ fn foo(s: @int) {
}
log(debug, sys::refcount(s));
assert (sys::refcount(s) == count + 1u);
+ let _ = sys::refcount(s); // don't get bitten by last-use.
}
fn main() {
View
2  src/test/run-pass/argv.rs
@@ -1,4 +1,4 @@
-fn main(args: ~[~str]) {
+fn main(++args: ~[~str]) {
let vs: ~[~str] = ~[~"hi", ~"there", ~"this", ~"is", ~"a", ~"vec"];
let vvs: ~[~[~str]] = ~[args, vs];
for vvs.each |vs| { for vs.each |s| { log(debug, *s); } }
View
2  src/test/run-pass/command-line-args.rs
@@ -1,3 +1,3 @@
-fn main(args: ~[~str]) { log(debug, args[0]); }
+fn main(++args: ~[~str]) { log(debug, args[0]); }
View
2  src/test/run-pass/foreign2.rs
@@ -21,4 +21,4 @@ extern mod libc {
extern mod baz {
#[legacy_exports]; }
-fn main(args: ~[~str]) { }
+fn main() { }
View
2  src/test/run-pass/import4.rs
@@ -6,4 +6,4 @@ mod zed {
fn bar() { debug!("bar"); }
}
-fn main(args: ~[~str]) { let zed = 42; bar(); }
+fn main() { let zed = 42; bar(); }
View
2  src/test/run-pass/import5.rs
@@ -9,4 +9,4 @@ mod foo {
}
}
-fn main(args: ~[~str]) { bar(); }
+fn main() { bar(); }
View
2  src/test/run-pass/import7.rs
@@ -17,4 +17,4 @@ mod bar {
#[legacy_exports]; }
}
}
-fn main(args: ~[~str]) { baz(); }
+fn main() { baz(); }
View
4 src/test/run-pass/issue-2834.rs
@@ -14,7 +14,7 @@ fn rendezvous() {
error!("%?", streams[0]);
}
-fn main(args: ~[~str]) {
+fn main() {
//os::getenv("FOO");
rendezvous();
-}
+}
View
2  src/test/run-pass/main-ivec.rs
@@ -1 +1 @@
-fn main(args: ~[~str]) { for args.each |s| { log(debug, *s); } }
+fn main(++args: ~[~str]) { for args.each |s| { log(debug, *s); } }
View
20 src/test/run-pass/non-legacy-modes.rs
@@ -0,0 +1,20 @@
+struct X {
+ repr: int
+}
+
+fn apply<T>(x: T, f: fn(T)) {
+ f(x);
+}
+
+fn check_int(x: int) {
+ assert x == 22;
+}
+
+fn check_struct(x: X) {
+ check_int(x.repr);
+}
+
+fn main() {
+ apply(22, check_int);
+ apply(X {repr: 22}, check_struct);
+}
View
4 src/test/run-pass/option-ext.rs
@@ -1,8 +1,8 @@
-fn main(args: ~[~str]) {
+fn main() {
let thing = ~"{{ f }}";
let f = str::find_str(thing, ~"{{");
if f.is_none() {
io::println(~"None!");
}
-}
+}
View
2  src/test/run-pass/path.rs
@@ -5,4 +5,4 @@ mod foo {
fn bar(offset: uint) { }
}
-fn main(args: ~[~str]) { foo::bar(0u); }
+fn main() { foo::bar(0u); }
View
2  src/test/run-pass/swap-2.rs
@@ -1,4 +1,4 @@
-fn swap<T>(v: ~[mut T], i: int, j: int) { v[i] <-> v[j]; }
+fn swap<T>(v: &[mut T], i: int, j: int) { v[i] <-> v[j]; }
fn main() {
let a: ~[mut int] = ~[mut 0, 1, 2, 3, 4, 5, 6];
View
2  src/test/run-pass/tag-in-block.rs
@@ -6,4 +6,4 @@ fn foo() {
fn baz() { zed(nil); }
}
-fn main(args: ~[~str]) { }
+fn main() { }
View
2  src/test/run-pass/type-param.rs
@@ -2,4 +2,4 @@
type lteq<T> = extern fn(T) -> bool;
-fn main(args: ~[~str]) { }
+fn main() { }
View
2  src/test/run-pass/type-ptr.rs
@@ -2,4 +2,4 @@ fn f(a: *int) -> *int { return a; }
fn g(a: *int) -> *int { let b = f(a); return b; }
-fn main(args: ~[~str]) { return; }
+fn main() { return; }
Please sign in to comment.
Something went wrong with that request. Please try again.