Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Switch the compiler over to using ~[] notation instead of []/~. Closes

  • Loading branch information...
commit 98e161f00e8850b0f5c6a3a9f1b22b222c2355b7 1 parent e6baf44
@msullivan msullivan authored
Showing with 3,732 additions and 3,733 deletions.
  1. +57 −57 src/cargo/cargo.rs
  2. +6 −6 src/cargo/pgp.rs
  3. +15 −14 src/compiletest/compiletest.rs
  4. +5 −5 src/compiletest/errors.rs
  5. +6 −6 src/compiletest/header.rs
  6. +5 −5 src/compiletest/procsrv.rs
  7. +24 −24 src/compiletest/runtest.rs
  8. +6 −6 src/fuzzer/ast_match.rs
  9. +6 −6 src/fuzzer/cycles.rs
  10. +32 −32 src/fuzzer/fuzzer.rs
  11. +27 −27 src/fuzzer/ivec_fuzz.rs
  12. +11 −11 src/fuzzer/rand_util.rs
  13. +6 −6 src/libcore/arc.rs
  14. +1 −1  src/libcore/comm.rs
  15. +13 −13 src/libcore/dvec.rs
  16. +20 −20 src/libcore/either.rs
  17. +10 −10 src/libcore/extfmt.rs
  18. +4 −4 src/libcore/float.rs
  19. +2 −2 src/libcore/int-template.rs
  20. +1 −1  src/libcore/int-template/int.rs
  21. +63 −63 src/libcore/io.rs
  22. +4 −4 src/libcore/iter-trait.rs
  23. +32 −32 src/libcore/iter.rs
  24. +12 −12 src/libcore/os.rs
  25. +10 −10 src/libcore/path.rs
  26. +3 −3 src/libcore/ptr.rs
  27. +32 −32 src/libcore/rand.rs
  28. +6 −6 src/libcore/result.rs
  29. +22 −22 src/libcore/run.rs
  30. +131 −131 src/libcore/str.rs
  31. +7 −7 src/libcore/to_str.rs
  32. +2 −2 src/libcore/uint-template.rs
  33. +1 −1  src/libcore/unsafe.rs
  34. +292 −292 src/libcore/vec.rs
  35. +2 −2 src/libstd/arena.rs
  36. +46 −46 src/libstd/bitv.rs
  37. +3 −3 src/libstd/deque.rs
  38. +18 −18 src/libstd/ebml.rs
  39. +98 −98 src/libstd/getopts.rs
  40. +44 −44 src/libstd/json.rs
  41. +12 −12 src/libstd/list.rs
  42. +12 −12 src/libstd/map.rs
  43. +3 −3 src/libstd/md4.rs
  44. +22 −22 src/libstd/net_tcp.rs
  45. +17 −17 src/libstd/par.rs
  46. +9 −9 src/libstd/rope.rs
  47. +4 −4 src/libstd/serialization.rs
  48. +27 −27 src/libstd/sha1.rs
  49. +44 −44 src/libstd/sort.rs
  50. +5 −5 src/libstd/term.rs
  51. +21 −21 src/libstd/test.rs
  52. +22 −22 src/libstd/time.rs
  53. +2 −2 src/libstd/timer.rs
  54. +9 −9 src/libstd/uv_ll.rs
  55. +61 −61 src/libsyntax/ast.rs
  56. +5 −5 src/libsyntax/ast_map.rs
  57. +14 −14 src/libsyntax/ast_util.rs
  58. +27 −27 src/libsyntax/attr.rs
  59. +4 −4 src/libsyntax/codemap.rs
  60. +102 −102 src/libsyntax/ext/auto_serialize.rs
  61. +7 −7 src/libsyntax/ext/base.rs
  62. +12 −12 src/libsyntax/ext/build.rs
  63. +2 −2 src/libsyntax/ext/concat_idents.rs
  64. +13 −13 src/libsyntax/ext/earley_parser.rs
  65. +2 −2 src/libsyntax/ext/expand.rs
  66. +10 −10 src/libsyntax/ext/fmt.rs
  67. +1 −1  src/libsyntax/ext/log_syntax.rs
  68. +31 −31 src/libsyntax/ext/qquote.rs
  69. +29 −29 src/libsyntax/ext/simplext.rs
  70. +6 −6 src/libsyntax/fold.rs
  71. +2 −2 src/libsyntax/parse.rs
  72. +11 −11 src/libsyntax/parse/attr.rs
  73. +12 −12 src/libsyntax/parse/comments.rs
  74. +9 −9 src/libsyntax/parse/common.rs
  75. +12 −12 src/libsyntax/parse/eval.rs
  76. +2 −2 src/libsyntax/parse/lexer.rs
  77. +100 −100 src/libsyntax/parse/parser.rs
  78. +4 −4 src/libsyntax/parse/token.rs
  79. +16 −16 src/libsyntax/print/pp.rs
  80. +33 −33 src/libsyntax/print/pprust.rs
  81. +15 −15 src/libsyntax/visit.rs
  82. +9 −9 src/rustc/back/link.rs
  83. +21 −21 src/rustc/back/rpath.rs
  84. +1 −1  src/rustc/back/target_strs.rs
  85. +26 −26 src/rustc/back/upcall.rs
  86. +1 −1  src/rustc/back/x86.rs
  87. +1 −1  src/rustc/back/x86_64.rs
  88. +11 −11 src/rustc/driver/driver.rs
  89. +3 −5 src/rustc/driver/rustc.rs
  90. +15 −15 src/rustc/driver/session.rs
  91. +3 −3 src/rustc/front/config.rs
  92. +5 −5 src/rustc/front/core_inject.rs
  93. +2 −2 src/rustc/front/intrinsic_inject.rs
  94. +37 −37 src/rustc/front/test.rs
  95. +5 −5 src/rustc/lib/llvm.rs
  96. +15 −15 src/rustc/metadata/astencode.rs
  97. +12 −12 src/rustc/metadata/creader.rs
  98. +11 −11 src/rustc/metadata/csearch.rs
  99. +14 −14 src/rustc/metadata/cstore.rs
  100. +46 −46 src/rustc/metadata/decoder.rs
  101. +53 −53 src/rustc/metadata/encoder.rs
  102. +8 −8 src/rustc/metadata/filesearch.rs
  103. +14 −14 src/rustc/metadata/loader.rs
  104. +14 −14 src/rustc/metadata/tydecode.rs
  105. +1 −1  src/rustc/metadata/tyencode.rs
  106. +6 −6 src/rustc/middle/astencode.rs
  107. +1 −1  src/rustc/middle/borrowck.rs
  108. +5 −5 src/rustc/middle/borrowck/check_loans.rs
  109. +2 −2 src/rustc/middle/borrowck/gather_loans.rs
  110. +2 −2 src/rustc/middle/capture.rs
  111. +13 −13 src/rustc/middle/check_alt.rs
  112. +2 −2 src/rustc/middle/freevars.rs
  113. +2 −2 src/rustc/middle/kind.rs
  114. +4 −4 src/rustc/middle/lint.rs
  115. +12 −12 src/rustc/middle/liveness.rs
  116. +2 −2 src/rustc/middle/pat_util.rs
  117. +3 −3 src/rustc/middle/region.rs
  118. +59 −59 src/rustc/middle/resolve.rs
  119. +53 −53 src/rustc/middle/trans/alt.rs
  120. +178 −178 src/rustc/middle/trans/base.rs
  121. +14 −14 src/rustc/middle/trans/build.rs
  122. +42 −42 src/rustc/middle/trans/closure.rs
  123. +44 −44 src/rustc/middle/trans/common.rs
  124. +31 −31 src/rustc/middle/trans/debuginfo.rs
  125. +61 −61 src/rustc/middle/trans/foreign.rs
  126. +12 −12 src/rustc/middle/trans/impl.rs
  127. +1 −1  src/rustc/middle/trans/reachable.rs
  128. +40 −40 src/rustc/middle/trans/reflect.rs
  129. +76 −76 src/rustc/middle/trans/shape.rs
  130. +29 −29 src/rustc/middle/trans/tvec.rs
  131. +15 −15 src/rustc/middle/trans/type_of.rs
  132. +2 −2 src/rustc/middle/trans/type_use.rs
  133. +2 −2 src/rustc/middle/trans/uniq.rs
  134. +7 −7 src/rustc/middle/tstate/annotate.rs
  135. +56 −56 src/rustc/middle/tstate/auxiliary.rs
  136. +3 −3 src/rustc/middle/tstate/bitvectors.rs
  137. +3 −3 src/rustc/middle/tstate/collect_locals.rs
  138. +31 −31 src/rustc/middle/tstate/pre_post_conditions.rs
  139. +5 −5 src/rustc/middle/tstate/states.rs
  140. +2 −2 src/rustc/middle/tstate/tritv.rs
  141. +59 −59 src/rustc/middle/ty.rs
  142. +6 −6 src/rustc/middle/typeck.rs
  143. +3 −3 src/rustc/middle/typeck/astconv.rs
  144. +46 −46 src/rustc/middle/typeck/check.rs
  145. +3 −3 src/rustc/middle/typeck/check/alt.rs
  146. +2 −2 src/rustc/middle/typeck/check/method.rs
  147. +1 −1  src/rustc/middle/typeck/check/regionmanip.rs
  148. +7 −7 src/rustc/middle/typeck/check/vtable.rs
  149. +1 −1  src/rustc/middle/typeck/check/writeback.rs
  150. +24 −24 src/rustc/middle/typeck/collect.rs
  151. +24 −24 src/rustc/middle/typeck/infer.rs
  152. +2 −2 src/rustc/util/common.rs
  153. +9 −9 src/rustc/util/ppaux.rs
  154. +6 −6 src/rustdoc/attr_parser.rs
  155. +4 −4 src/rustdoc/attr_pass.rs
  156. +38 −38 src/rustdoc/config.rs
  157. +2 −2 src/rustdoc/demo.rs
  158. +6 −6 src/rustdoc/desc_to_brief_pass.rs
  159. +29 −29 src/rustdoc/doc.rs
  160. +11 −11 src/rustdoc/extract.rs
  161. +1 −1  src/rustdoc/markdown_index_pass.rs
  162. +10 −10 src/rustdoc/markdown_pass.rs
  163. +4 −4 src/rustdoc/markdown_writer.rs
  164. +2 −2 src/rustdoc/page_pass.rs
  165. +5 −5 src/rustdoc/par.rs
  166. +2 −2 src/rustdoc/parse.rs
  167. +7 −7 src/rustdoc/path_pass.rs
  168. +1 −1  src/rustdoc/prune_hidden_pass.rs
  169. +8 −8 src/rustdoc/prune_unexported_pass.rs
  170. +23 −23 src/rustdoc/reexport_pass.rs
  171. +12 −12 src/rustdoc/rustdoc.rs
  172. +5 −5 src/rustdoc/sectionalize_pass.rs
  173. +2 −2 src/rustdoc/text_pass.rs
  174. +2 −2 src/rustdoc/tystr_pass.rs
  175. +1 −1  src/rustdoc/unindent_pass.rs
  176. +3 −3 src/test/auxiliary/cci_class_6.rs
  177. +1 −1  src/test/auxiliary/cci_iter_lib.rs
  178. +1 −1  src/test/auxiliary/cci_no_inline_lib.rs
  179. +1 −1  src/test/auxiliary/issue2378a.rs
  180. +1 −1  src/test/auxiliary/issue2378b.rs
  181. +6 −6 src/test/bench/core-std.rs
  182. +3 −3 src/test/bench/core-uint-to-str.rs
  183. +6 −6 src/test/bench/core-vec-append.rs
  184. +11 −11 src/test/bench/graph500-bfs.rs
  185. +6 −6 src/test/bench/msgsend-ring-new.rs
  186. +6 −6 src/test/bench/msgsend-ring.rs
  187. +5 −5 src/test/bench/msgsend.rs
  188. +3 −3 src/test/bench/shootout-ackermann.rs
  189. +3 −3 src/test/bench/shootout-binarytrees.rs
  190. +3 −3 src/test/bench/shootout-fannkuchredux.rs
  191. +16 −16 src/test/bench/shootout-fasta.rs
  192. +3 −3 src/test/bench/shootout-fibo.rs
  193. +19 −19 src/test/bench/shootout-k-nucleotide.rs
  194. +7 −7 src/test/bench/shootout-mandelbrot.rs
  195. +10 −10 src/test/bench/shootout-nbody.rs
  196. +7 −7 src/test/bench/shootout-pfib.rs
  197. +6 −6 src/test/bench/shootout-spectralnorm.rs
  198. +3 −3 src/test/bench/shootout-threadring.rs
  199. +3 −3 src/test/bench/std-smallintmap.rs
  200. +4 −4 src/test/bench/sudoku.rs
  201. +3 −3 src/test/bench/task-perf-alloc-unwind.rs
  202. +4 −4 src/test/bench/task-perf-one-million.rs
  203. +3 −3 src/test/bench/task-perf-spawnalot.rs
  204. +8 −8 src/test/bench/task-perf-word-count-generic.rs
  205. +8 −8 src/test/bench/task-perf-word-count.rs
  206. +3 −3 src/test/compile-fail/ambig_impl_unify.rs
  207. +2 −2 src/test/compile-fail/assign-super.rs
  208. +1 −1  src/test/compile-fail/bad-expr-path.rs
  209. +1 −1  src/test/compile-fail/bad-expr-path2.rs
  210. +1 −1  src/test/compile-fail/bad-main.rs
  211. +1 −1  src/test/compile-fail/bad-module.rs
  212. +1 −1  src/test/compile-fail/block-arg-as-stmt-with-value.rs
  213. +1 −1  src/test/compile-fail/block-must-not-have-result-for.rs
  214. +4 −4 src/test/compile-fail/borrowck-assign-comp-idx.rs
  215. +2 −2 src/test/compile-fail/borrowck-binding-mutbl.rs
  216. +3 −3 src/test/compile-fail/borrowck-loan-vec-content.rs
  217. +3 −3 src/test/compile-fail/borrowck-mut-vec-as-imm-slice-bad.rs
  218. +1 −1  src/test/compile-fail/empty-vec-trailing-comma.rs
  219. +4 −4 src/test/compile-fail/evec-subtyping.rs
  220. +1 −1  src/test/compile-fail/fail-type-err.rs
  221. +1 −1  src/test/compile-fail/import.rs
  222. +1 −1  src/test/compile-fail/import2.rs
  223. +1 −1  src/test/compile-fail/import3.rs
  224. +1 −1  src/test/compile-fail/import4.rs
  225. +2 −2 src/test/compile-fail/infinite-vec-type-recursion.rs
  226. +2 −2 src/test/compile-fail/issue-1655.rs
  227. +2 −2 src/test/compile-fail/issue-2149.rs
  228. +1 −1  src/test/compile-fail/issue-2150.rs
  229. +1 −1  src/test/compile-fail/issue-2509-a.rs
  230. +2 −2 src/test/compile-fail/liveness-issue-2163.rs
  231. +1 −1  src/test/compile-fail/liveness-use-in-index-lvalue.rs
  232. +2 −2 src/test/compile-fail/lub-in-args.rs
  233. +3 −3 src/test/compile-fail/mutable-huh-variance-box.rs
  234. +2 −2 src/test/compile-fail/mutable-huh-variance-deep.rs
  235. +4 −4 src/test/compile-fail/mutable-huh-variance-ptr.rs
  236. +3 −3 src/test/compile-fail/mutable-huh-variance-rec.rs
  237. +3 −3 src/test/compile-fail/mutable-huh-variance-unique.rs
  238. +3 −3 src/test/compile-fail/mutable-huh-variance-vec1.rs
  239. +3 −3 src/test/compile-fail/mutable-huh-variance-vec2.rs
  240. +2 −2 src/test/compile-fail/mutable-huh-variance-vec3.rs
  241. +9 −9 src/test/compile-fail/mutable-huh-variance-vec4.rs
  242. +2 −2 src/test/compile-fail/mutable-huh-vec-assign.rs
  243. +1 −1  src/test/compile-fail/nested-ty-params.rs
  244. +1 −1  src/test/compile-fail/no-capture-arc.rs
  245. +1 −1  src/test/compile-fail/no-reuse-move-arc.rs
  246. +2 −2 src/test/compile-fail/non-const.rs
  247. +1 −1  src/test/compile-fail/non-copyable-void.rs
  248. +3 −3 src/test/compile-fail/nonsense-constraints.rs
  249. +1 −1  src/test/compile-fail/pattern-tyvar-2.rs
  250. +1 −1  src/test/compile-fail/pattern-tyvar.rs
  251. +1 −1  src/test/compile-fail/qquote-1.rs
  252. +1 −1  src/test/compile-fail/qquote-2.rs
  253. +2 −2 src/test/compile-fail/regions-escape-loop-via-vec.rs
  254. +1 −1  src/test/compile-fail/regions-out-of-scope-slice.rs
  255. +1 −1  src/test/compile-fail/seq-args.rs
  256. +1 −1  src/test/compile-fail/tag-that-dare-not-speak-its-name.rs
  257. +1 −1  src/test/compile-fail/tstate-unsat-in-called-fn-expr.rs
  258. +1 −1  src/test/compile-fail/tstate-unsat-in-fn-expr.rs
  259. +3 −3 src/test/compile-fail/unique-vec-res.rs
  260. +25 −25 src/test/compile-fail/vec-add.rs
  261. +3 −3 src/test/compile-fail/vec-concat-bug.rs
  262. +1 −1  src/test/compile-fail/vec-field.rs
  263. +2 −2 src/test/compile-fail/vec-res-add.rs
  264. +1 −1  src/test/compile-fail/vector-no-ann.rs
  265. +2 −2 src/test/pretty/blank-lines.rs
  266. +2 −2 src/test/pretty/block-disambig.rs
  267. +8 −8 src/test/pretty/vec-comments.rs
  268. +2 −2 src/test/pretty/vec-type.rs
  269. +1 −1  src/test/run-fail/bug-2470-bounds-check-overflow-2.rs
  270. +2 −2 src/test/run-fail/bug-2470-bounds-check-overflow-3.rs
  271. +1 −1  src/test/run-fail/bug-2470-bounds-check-overflow.rs
  272. +1 −1  src/test/run-fail/unwind-box-vec.rs
  273. +2 −2 src/test/run-fail/unwind-interleaved.rs
  274. +6 −6 src/test/run-fail/unwind-misc-1.rs
  275. +1 −1  src/test/run-fail/unwind-partial-box.rs
  276. +1 −1  src/test/run-fail/unwind-partial-unique.rs
  277. +2 −2 src/test/run-fail/unwind-partial-vec.rs
  278. +1 −1  src/test/run-fail/unwind-rec.rs
  279. +3 −3 src/test/run-fail/unwind-rec2.rs
  280. +1 −1  src/test/run-fail/unwind-tup.rs
  281. +3 −3 src/test/run-fail/unwind-tup2.rs
  282. +1 −1  src/test/run-fail/vec-overrun.rs
  283. +1 −1  src/test/run-fail/vec-underrun.rs
  284. +4 −4 src/test/run-fail/zip-different-lengths.rs
  285. +1 −1  src/test/run-pass-fulldeps/issue-1926.rs
  286. +1 −1  src/test/run-pass-fulldeps/qquote.rs
  287. +3 −3 src/test/run-pass/alloca-from-derived-tydesc.rs
  288. +2 −2 src/test/run-pass/alt-join.rs
  289. +3 −3 src/test/run-pass/argv.rs
  290. +1 −1  src/test/run-pass/auto-loop.rs
  291. +3 −3 src/test/run-pass/auto_serialize.rs
  292. +4 −4 src/test/run-pass/autobind.rs
  293. +1 −1  src/test/run-pass/block-arg-can-be-followed-by-binop.rs
  294. +1 −1  src/test/run-pass/block-arg-can-be-followed-by-block-arg.rs
  295. +1 −1  src/test/run-pass/block-arg-can-be-followed-by-call.rs
  296. +8 −8 src/test/run-pass/block-arg-in-parentheses.rs
  297. +1 −1  src/test/run-pass/block-arg.rs
  298. +2 −2 src/test/run-pass/block-iter-1.rs
  299. +2 −2 src/test/run-pass/block-iter-2.rs
  300. +3 −3 src/test/run-pass/block-vec-map2.rs
Sorry, we could not display the entire diff because too many files (420) changed.
View
114 src/cargo/cargo.rs
@@ -21,15 +21,15 @@ type package = {
method: str,
description: str,
ref: option<str>,
- tags: [str]/~,
- versions: [(str, str)]/~
+ tags: ~[str],
+ versions: ~[(str, str)]
};
type local_package = {
name: str,
metaname: str,
version: str,
- files: [str]/~
+ files: ~[str]
};
type source = @{
@@ -38,7 +38,7 @@ type source = @{
mut method: str,
mut key: option<str>,
mut keyfp: option<str>,
- mut packages: [mut package]/~
+ mut packages: ~[mut package]
};
type cargo = {
@@ -62,21 +62,21 @@ type crate = {
desc: option<str>,
sigs: option<str>,
crate_type: option<str>,
- deps: [str]/~
+ deps: ~[str]
};
type options = {
test: bool,
mode: mode,
- free: [str]/~,
+ free: ~[str],
help: bool,
};
enum mode { system_mode, user_mode, local_mode }
-fn opts() -> [getopts::opt]/~ {
- [optflag("g"), optflag("G"), optflag("test"),
- optflag("h"), optflag("help")]/~
+fn opts() -> ~[getopts::opt] {
+ ~[optflag("g"), optflag("G"), optflag("test"),
+ optflag("h"), optflag("help")]
}
fn info(msg: str) {
@@ -216,7 +216,7 @@ fn assume_source_method(url: str) -> str {
"curl"
}
-fn load_link(mis: [@ast::meta_item]/~) -> (option<str>,
+fn load_link(mis: ~[@ast::meta_item]) -> (option<str>,
option<str>,
option<str>) {
let mut name = none;
@@ -240,7 +240,7 @@ fn load_link(mis: [@ast::meta_item]/~) -> (option<str>,
fn load_crate(filename: str) -> option<crate> {
let sess = parse::new_parse_sess(none);
- let c = parse::parse_crate_from_crate_file(filename, []/~, sess);
+ let c = parse::parse_crate_from_crate_file(filename, ~[], sess);
let mut name = none;
let mut vers = none;
@@ -275,7 +275,7 @@ fn load_crate(filename: str) -> option<crate> {
}
type env = @{
- mut deps: [str]/~
+ mut deps: ~[str]
};
fn goto_view_item(e: env, i: @ast::view_item) {
@@ -283,7 +283,7 @@ fn load_crate(filename: str) -> option<crate> {
ast::view_item_use(ident, metas, id) {
let name_items = attr::find_meta_items_by_name(metas, "name");
let m = if name_items.is_empty() {
- metas + [attr::mk_name_value_item_str(@"name", *ident)]/~
+ metas + ~[attr::mk_name_value_item_str(@"name", *ident)]
} else {
metas
};
@@ -326,7 +326,7 @@ fn load_crate(filename: str) -> option<crate> {
}
let e = @{
- mut deps: []/~
+ mut deps: ~[]
};
let v = visit::mk_simple_visitor(@{
visit_view_item: {|a|goto_view_item(e, a)},
@@ -424,7 +424,7 @@ fn parse_source(name: str, j: json::json) -> source {
mut method: method,
mut key: key,
mut keyfp: keyfp,
- mut packages: [mut]/~ };
+ mut packages: ~[mut] };
}
_ { fail "needed dict value in source"; }
};
@@ -498,7 +498,7 @@ fn load_one_source_package(src: source, p: map::hashmap<str, json::json>) {
_ { none }
};
- let mut tags = []/~;
+ let mut tags = ~[];
alt p.find("tags") {
some(json::list(js)) {
for (*js).each {|j|
@@ -528,7 +528,7 @@ fn load_one_source_package(src: source, p: map::hashmap<str, json::json>) {
description: description,
ref: ref,
tags: tags,
- versions: []/~
+ versions: ~[]
};
alt src.packages.position({ |pkg| pkg.uuid == uuid }) {
@@ -595,7 +595,7 @@ fn load_source_packages(c: cargo, src: source) {
};
}
-fn build_cargo_options(argv: [str]/~) -> options {
+fn build_cargo_options(argv: ~[str]) -> options {
let match = alt getopts::getopts(argv, opts()) {
result::ok(m) { m }
result::err(f) {
@@ -699,19 +699,19 @@ fn for_each_package(c: cargo, b: fn(source, package)) {
fn run_programs(buildpath: str) {
let newv = os::list_dir_path(buildpath);
for newv.each {|ct|
- run::run_program(ct, []/~);
+ run::run_program(ct, ~[]);
}
}
// Runs rustc in <path + subdir> with the given flags
// and returns <path + subdir>
fn run_in_buildpath(what: str, path: str, subdir: str, cf: str,
- extra_flags: [str]/~) -> option<str> {
+ extra_flags: ~[str]) -> option<str> {
let buildpath = path::connect(path, subdir);
need_dir(buildpath);
#debug("%s: %s -> %s", what, cf, buildpath);
let p = run::program_output(rustc_sysroot(),
- ["--out-dir", buildpath, cf]/~ + extra_flags);
+ ~["--out-dir", buildpath, cf] + extra_flags);
if p.status != 0 {
error(#fmt["rustc failed: %d\n%s\n%s", p.status, p.err, p.out]);
ret none;
@@ -721,7 +721,7 @@ fn run_in_buildpath(what: str, path: str, subdir: str, cf: str,
fn test_one_crate(_c: cargo, path: str, cf: str) {
let buildpath = alt run_in_buildpath("testing", path, "/test", cf,
- [ "--test"]/~) {
+ ~[ "--test"]) {
none { ret; }
some(bp) { bp }
};
@@ -730,7 +730,7 @@ fn test_one_crate(_c: cargo, path: str, cf: str) {
fn install_one_crate(c: cargo, path: str, cf: str) {
let buildpath = alt run_in_buildpath("installing", path,
- "/build", cf, []/~) {
+ "/build", cf, ~[]) {
none { ret; }
some(bp) { bp }
};
@@ -758,7 +758,7 @@ fn install_one_crate(c: cargo, path: str, cf: str) {
fn rustc_sysroot() -> str {
alt os::self_exe_path() {
some(path) {
- let path = [path, "..", "bin", "rustc"]/~;
+ let path = ~[path, "..", "bin", "rustc"];
check vec::is_not_empty(path);
let rustc = path::normalize(path::connect_many(path));
#debug(" rustc: %s", rustc);
@@ -772,7 +772,7 @@ fn install_source(c: cargo, path: str) {
#debug("source: %s", path);
os::change_dir(path);
- let mut cratefiles = []/~;
+ let mut cratefiles = ~[];
for os::walk_dir(".") {|p|
if str::ends_with(p, ".rc") {
vec::push(cratefiles, p);
@@ -811,11 +811,11 @@ fn install_source(c: cargo, path: str) {
}
fn install_git(c: cargo, wd: str, url: str, ref: option<str>) {
- run::program_output("git", ["clone", url, wd]/~);
+ run::program_output("git", ~["clone", url, wd]);
if option::is_some(ref) {
let r = option::get(ref);
os::change_dir(wd);
- run::run_program("git", ["checkout", r]/~);
+ run::run_program("git", ~["checkout", r]);
}
install_source(c, wd);
@@ -823,19 +823,19 @@ fn install_git(c: cargo, wd: str, url: str, ref: option<str>) {
fn install_curl(c: cargo, wd: str, url: str) {
let tarpath = path::connect(wd, "pkg.tar");
- let p = run::program_output("curl", ["-f", "-s", "-o",
- tarpath, url]/~);
+ let p = run::program_output("curl", ~["-f", "-s", "-o",
+ tarpath, url]);
if p.status != 0 {
fail #fmt["fetch of %s failed: %s", url, p.err];
}
- run::run_program("tar", ["-x", "--strip-components=1",
- "-C", wd, "-f", tarpath]/~);
+ run::run_program("tar", ~["-x", "--strip-components=1",
+ "-C", wd, "-f", tarpath]);
install_source(c, wd);
}
fn install_file(c: cargo, wd: str, path: str) {
- run::program_output("tar", ["-x", "--strip-components=1",
- "-C", wd, "-f", path]/~);
+ run::program_output("tar", ~["-x", "--strip-components=1",
+ "-C", wd, "-f", path]);
install_source(c, wd);
}
@@ -868,7 +868,7 @@ fn cargo_suggestion(c: cargo, fallback: fn())
}
fn install_uuid(c: cargo, wd: str, uuid: str) {
- let mut ps = []/~;
+ let mut ps = ~[];
for_each_package(c, { |s, p|
if p.uuid == uuid {
vec::grow(ps, 1u, (s.name, copy p));
@@ -892,7 +892,7 @@ fn install_uuid(c: cargo, wd: str, uuid: str) {
}
fn install_named(c: cargo, wd: str, name: str) {
- let mut ps = []/~;
+ let mut ps = ~[];
for_each_package(c, { |s, p|
if p.name == name {
vec::grow(ps, 1u, (s.name, copy p));
@@ -1082,7 +1082,7 @@ fn cmd_install(c: cargo) unsafe {
if vec::len(c.opts.free) == 2u {
let cwd = os::getcwd();
- let status = run::run_program("cp", ["-R", cwd, wd]/~);
+ let status = run::run_program("cp", ~["-R", cwd, wd]);
if status != 0 {
fail #fmt("could not copy directory: %s", cwd);
@@ -1134,8 +1134,8 @@ fn sync_one_file(c: cargo, dir: str, src: source) -> bool {
alt copy src.key {
some(u) {
- let p = run::program_output("curl", ["-f", "-s", "-o", keyfile,
- u]/~);
+ let p = run::program_output("curl", ~["-f", "-s", "-o", keyfile,
+ u]);
if p.status != 0 {
error(#fmt["fetch for source %s (key %s) failed", name, u]);
ret false;
@@ -1208,8 +1208,8 @@ fn sync_one_git(c: cargo, dir: str, src: source) -> bool {
msg(name, insecure);
}
else {
- let p = run::program_output("git", ["reset", "--hard",
- "HEAD@{1}"]/~);
+ let p = run::program_output("git", ~["reset", "--hard",
+ "HEAD@{1}"]);
if p.status != 0 {
msg(name, insecure);
@@ -1218,7 +1218,7 @@ fn sync_one_git(c: cargo, dir: str, src: source) -> bool {
}
if !os::path_exists(path::connect(dir, ".git")) {
- let p = run::program_output("git", ["clone", url, dir]/~);
+ let p = run::program_output("git", ~["clone", url, dir]);
if p.status != 0 {
error(#fmt["fetch for source %s (url %s) failed", name, url]);
@@ -1231,7 +1231,7 @@ fn sync_one_git(c: cargo, dir: str, src: source) -> bool {
ret false;
}
- let p = run::program_output("git", ["pull"]/~);
+ let p = run::program_output("git", ~["pull"]);
if p.status != 0 {
error(#fmt["fetch for source %s (url %s) failed", name, url]);
@@ -1243,8 +1243,8 @@ fn sync_one_git(c: cargo, dir: str, src: source) -> bool {
alt copy src.key {
some(u) {
- let p = run::program_output("curl", ["-f", "-s", "-o", keyfile,
- u]/~);
+ let p = run::program_output("curl", ~["-f", "-s", "-o", keyfile,
+ u]);
if p.status != 0 {
error(#fmt["fetch for source %s (key %s) failed", name, u]);
rollback(name, dir, false);
@@ -1303,7 +1303,7 @@ fn sync_one_curl(c: cargo, dir: str, src: source) -> bool {
url += "/packages.json";
}
- let p = run::program_output("curl", ["-f", "-s", "-o", pkgfile, url]/~);
+ let p = run::program_output("curl", ~["-f", "-s", "-o", pkgfile, url]);
if p.status != 0 {
error(#fmt["fetch for source %s (url %s) failed", name, url]);
@@ -1312,7 +1312,7 @@ fn sync_one_curl(c: cargo, dir: str, src: source) -> bool {
if smart {
url = src.url + "/source.json";
let p =
- run::program_output("curl", ["-f", "-s", "-o", srcfile, url]/~);
+ run::program_output("curl", ~["-f", "-s", "-o", srcfile, url]);
if p.status == 0 {
has_src_file = true;
@@ -1321,8 +1321,8 @@ fn sync_one_curl(c: cargo, dir: str, src: source) -> bool {
alt copy src.key {
some(u) {
- let p = run::program_output("curl", ["-f", "-s", "-o", keyfile,
- u]/~);
+ let p = run::program_output("curl", ~["-f", "-s", "-o", keyfile,
+ u]);
if p.status != 0 {
error(#fmt["fetch for source %s (key %s) failed", name, u]);
ret false;
@@ -1340,8 +1340,8 @@ fn sync_one_curl(c: cargo, dir: str, src: source) -> bool {
url = src.url + ".sig";
}
- let mut p = run::program_output("curl", ["-f", "-s", "-o",
- sigfile, url]/~);
+ let mut p = run::program_output("curl", ~["-f", "-s", "-o",
+ sigfile, url]);
if p.status != 0 {
error(#fmt["fetch for source %s (sig %s) failed", name, url]);
ret false;
@@ -1358,8 +1358,8 @@ fn sync_one_curl(c: cargo, dir: str, src: source) -> bool {
if smart && has_src_file {
url = src.url + "/source.json.sig";
- p = run::program_output("curl", ["-f", "-s", "-o", srcsigfile,
- url]/~);
+ p = run::program_output("curl",
+ ~["-f", "-s", "-o", srcsigfile, url]);
if p.status != 0 {
error(#fmt["fetch for source %s (sig %s) failed",
name, url]);
@@ -1424,14 +1424,14 @@ fn cmd_init(c: cargo) {
let destsrcfile = path::connect(c.root, "sources.json");
let p =
- run::program_output("curl", ["-f", "-s", "-o", srcfile, srcurl]/~);
+ run::program_output("curl", ~["-f", "-s", "-o", srcfile, srcurl]);
if p.status != 0 {
error(#fmt["fetch of sources.json failed: %s", p.out]);
ret;
}
let p =
- run::program_output("curl", ["-f", "-s", "-o", sigfile, sigurl]/~);
+ run::program_output("curl", ~["-f", "-s", "-o", sigfile, sigurl]);
if p.status != 0 {
error(#fmt["fetch of sources.json.sig failed: %s", p.out]);
ret;
@@ -1533,7 +1533,7 @@ fn cmd_search(c: cargo) {
fn install_to_dir(srcfile: str, destdir: str) {
let newfile = path::connect(destdir, path::basename(srcfile));
- let status = run::run_program("cp", ["-r", srcfile, newfile]/~);
+ let status = run::run_program("cp", ~["-r", srcfile, newfile]);
if status == 0 {
info(#fmt["installed: '%s'", newfile]);
} else {
@@ -1650,7 +1650,7 @@ fn cmd_sources(c: cargo) {
mut method: assume_source_method(url),
mut key: none,
mut keyfp: none,
- mut packages: [mut]/~
+ mut packages: ~[mut]
});
info(#fmt("added source: %s", name));
}
@@ -1868,7 +1868,7 @@ Commands:
set-method Change the method for a source.");
}
-fn main(argv: [str]/~) {
+fn main(argv: ~[str]) {
let o = build_cargo_options(argv);
if vec::len(o.free) < 2u {
View
12 src/cargo/pgp.rs
@@ -1,4 +1,4 @@
-fn gpg(args: [str]/~) -> { status: int, out: str, err: str } {
+fn gpg(args: ~[str]) -> { status: int, out: str, err: str } {
ret run::program_output("gpg", args);
}
@@ -59,7 +59,7 @@ fn signing_key_fp() -> str {
}
fn supported() -> bool {
- let r = gpg(["--version"]/~);
+ let r = gpg(~["--version"]);
r.status == 0
}
@@ -67,7 +67,7 @@ fn init(root: str) {
let p = path::connect(root, "gpg");
if !os::path_is_dir(p) {
os::make_dir(p, 0x1c0i32);
- let p = run::start_program("gpg", ["--homedir", p, "--import"]/~);
+ let p = run::start_program("gpg", ~["--homedir", p, "--import"]);
p.input().write_str(signing_key());
let s = p.finish();
if s != 0 {
@@ -79,7 +79,7 @@ fn init(root: str) {
fn add(root: str, key: str) {
let path = path::connect(root, "gpg");
let p =
- run::program_output("gpg", ["--homedir", path, "--import", key]/~);
+ run::program_output("gpg", ~["--homedir", path, "--import", key]);
if p.status != 0 {
fail "pgp add failed: " + p.out;
}
@@ -87,8 +87,8 @@ fn add(root: str, key: str) {
fn verify(root: str, data: str, sig: str, keyfp: str) -> bool {
let path = path::connect(root, "gpg");
- let p = gpg(["--homedir", path, "--with-fingerprint", "--verify", sig,
- data]/~);
+ let p = gpg(~["--homedir", path, "--with-fingerprint", "--verify", sig,
+ data]);
let res = "Primary key fingerprint: " + keyfp;
for str::split_char(p.err, '\n').each {|line|
if line == res { ret true; }
View
29 src/compiletest/compiletest.rs
@@ -21,22 +21,23 @@ import common::mode_pretty;
import common::mode;
import util::logv;
-fn main(args: [str]/~) {
+fn main(args: ~[str]) {
let config = parse_config(args);
log_config(config);
run_tests(config);
}
-fn parse_config(args: [str]/~) -> config {
+fn parse_config(args: ~[str]) -> config {
let opts =
- [getopts::reqopt("compile-lib-path"), getopts::reqopt("run-lib-path"),
- getopts::reqopt("rustc-path"), getopts::reqopt("src-base"),
- getopts::reqopt("build-base"), getopts::reqopt("aux-base"),
- getopts::reqopt("stage-id"),
- getopts::reqopt("mode"), getopts::optflag("ignored"),
- getopts::optopt("runtool"), getopts::optopt("rustcflags"),
- getopts::optflag("verbose"),
- getopts::optopt("logfile")]/~;
+ ~[getopts::reqopt("compile-lib-path"),
+ getopts::reqopt("run-lib-path"),
+ getopts::reqopt("rustc-path"), getopts::reqopt("src-base"),
+ getopts::reqopt("build-base"), getopts::reqopt("aux-base"),
+ getopts::reqopt("stage-id"),
+ getopts::reqopt("mode"), getopts::optflag("ignored"),
+ getopts::optopt("runtool"), getopts::optopt("rustcflags"),
+ getopts::optflag("verbose"),
+ getopts::optopt("logfile")];
check (vec::is_not_empty(args));
let args_ = vec::tail(args);
@@ -132,9 +133,9 @@ fn test_opts(config: config) -> test::test_opts {
}
}
-fn make_tests(config: config) -> [test::test_desc]/~ {
+fn make_tests(config: config) -> ~[test::test_desc] {
#debug("making tests from %s", config.src_base);
- let mut tests = []/~;
+ let mut tests = ~[];
for os::list_dir_path(config.src_base).each {|file|
let file = file;
#debug("inspecting file %s", file);
@@ -148,8 +149,8 @@ fn make_tests(config: config) -> [test::test_desc]/~ {
fn is_test(config: config, testfile: str) -> bool {
// Pretty-printer does not work with .rc files yet
let valid_extensions =
- alt config.mode { mode_pretty { [".rs"]/~ } _ { [".rc", ".rs"]/~ } };
- let invalid_prefixes = [".", "#", "~"]/~;
+ alt config.mode { mode_pretty { ~[".rs"] } _ { ~[".rc", ".rs"] } };
+ let invalid_prefixes = ~[".", "#", "~"];
let name = path::basename(testfile);
let mut valid = false;
View
10 src/compiletest/errors.rs
@@ -8,8 +8,8 @@ export expected_error;
type expected_error = { line: uint, kind: str, msg: str };
// Load any test directives embedded in the file
-fn load_errors(testfile: str) -> [expected_error]/~ {
- let mut error_patterns = []/~;
+fn load_errors(testfile: str) -> ~[expected_error] {
+ let mut error_patterns = ~[];
let rdr = result::get(io::file_reader(testfile));
let mut line_num = 1u;
while !rdr.eof() {
@@ -20,11 +20,11 @@ fn load_errors(testfile: str) -> [expected_error]/~ {
ret error_patterns;
}
-fn parse_expected(line_num: uint, line: str) -> [expected_error]/~ unsafe {
+fn parse_expected(line_num: uint, line: str) -> ~[expected_error] unsafe {
let error_tag = "//!";
let mut idx;
alt str::find_str(line, error_tag) {
- option::none { ret []/~; }
+ option::none { ret ~[]; }
option::some(nn) { idx = (nn as uint) + str::len(error_tag); }
}
@@ -49,5 +49,5 @@ fn parse_expected(line_num: uint, line: str) -> [expected_error]/~ unsafe {
#debug("line=%u kind=%s msg=%s", line_num - adjust_line, kind, msg);
- ret [{line: line_num - adjust_line, kind: kind, msg: msg}]/~;
+ ret ~[{line: line_num - adjust_line, kind: kind, msg: msg}];
}
View
12 src/compiletest/header.rs
@@ -10,23 +10,23 @@ export is_test_ignored;
type test_props = {
// Lines that should be expected, in order, on standard out
- error_patterns: [str]/~,
+ error_patterns: ~[str],
// Extra flags to pass to the compiler
compile_flags: option<str>,
// If present, the name of a file that this test should match when
// pretty-printed
pp_exact: option<str>,
// Modules from aux directory that should be compiled
- aux_builds: [str]/~,
+ aux_builds: ~[str],
// Environment settings to use during execution
- exec_env: [(str,str)]/~
+ exec_env: ~[(str,str)]
};
// Load any test directives embedded in the file
fn load_props(testfile: str) -> test_props {
- let mut error_patterns = []/~;
- let mut aux_builds = []/~;
- let mut exec_env = []/~;
+ let mut error_patterns = ~[];
+ let mut aux_builds = ~[];
+ let mut exec_env = ~[];
let mut compile_flags = option::none;
let mut pp_exact = option::none;
for iter_header(testfile) {|ln|
View
10 src/compiletest/procsrv.rs
@@ -5,7 +5,7 @@ import libc::{c_int, pid_t};
export run;
#[cfg(target_os = "win32")]
-fn target_env(lib_path: str, prog: str) -> [(str,str)]/~ {
+fn target_env(lib_path: str, prog: str) -> ~[(str,str)] {
let mut env = os::env();
@@ -27,16 +27,16 @@ fn target_env(lib_path: str, prog: str) -> [(str,str)]/~ {
#[cfg(target_os = "linux")]
#[cfg(target_os = "macos")]
#[cfg(target_os = "freebsd")]
-fn target_env(_lib_path: str, _prog: str) -> [(str,str)]/~ {
- []/~
+fn target_env(_lib_path: str, _prog: str) -> ~[(str,str)] {
+ ~[]
}
// FIXME (#2659): This code is duplicated in core::run::program_output
fn run(lib_path: str,
prog: str,
- args: [str]/~,
- env: [(str, str)]/~,
+ args: ~[str],
+ env: ~[(str, str)],
input: option<str>) -> {status: int, out: str, err: str} {
let pipe_in = os::pipe();
View
48 src/compiletest/runtest.rs
@@ -92,7 +92,7 @@ fn run_pretty_test(config: config, props: test_props, testfile: str) {
let rounds =
alt props.pp_exact { option::some(_) { 1 } option::none { 2 } };
- let mut srcs = [result::get(io::read_whole_file_str(testfile))]/~;
+ let mut srcs = ~[result::get(io::read_whole_file_str(testfile))];
let mut round = 0;
while round < rounds {
@@ -139,12 +139,12 @@ fn run_pretty_test(config: config, props: test_props, testfile: str) {
fn print_source(config: config, testfile: str, src: str) -> procres {
compose_and_run(config, testfile, make_pp_args(config, testfile),
- []/~, config.compile_lib_path, option::some(src))
+ ~[], config.compile_lib_path, option::some(src))
}
fn make_pp_args(config: config, _testfile: str) -> procargs {
let prog = config.rustc_path;
- let args = ["-", "--pretty", "normal"]/~;
+ let args = ~["-", "--pretty", "normal"];
ret {prog: prog, args: args};
}
@@ -178,8 +178,8 @@ actual:\n\
fn make_typecheck_args(config: config, testfile: str) -> procargs {
let prog = config.rustc_path;
- let mut args = ["-", "--no-trans", "--lib", "-L", config.build_base,
- "-L", aux_output_dir_name(config, testfile)]/~;
+ let mut args = ~["-", "--no-trans", "--lib", "-L", config.build_base,
+ "-L", aux_output_dir_name(config, testfile)];
args += split_maybe_args(config.rustcflags);
ret {prog: prog, args: args};
}
@@ -227,7 +227,7 @@ fn check_error_patterns(props: test_props,
}
}
-fn check_expected_errors(expected_errors: [errors::expected_error]/~,
+fn check_expected_errors(expected_errors: ~[errors::expected_error],
testfile: str,
procres: procres) {
@@ -286,13 +286,13 @@ fn check_expected_errors(expected_errors: [errors::expected_error]/~,
}
}
-type procargs = {prog: str, args: [str]/~};
+type procargs = {prog: str, args: ~[str]};
type procres = {status: int, stdout: str, stderr: str, cmdline: str};
fn compile_test(config: config, props: test_props,
testfile: str) -> procres {
- let link_args = ["-L", aux_output_dir_name(config, testfile)]/~;
+ let link_args = ~["-L", aux_output_dir_name(config, testfile)];
compose_and_run_compiler(
config, props, testfile,
make_compile_args(config, props, link_args,
@@ -319,14 +319,14 @@ fn compose_and_run_compiler(
ensure_dir(aux_output_dir_name(config, testfile));
}
- let extra_link_args = ["-L", aux_output_dir_name(config, testfile)]/~;
+ let extra_link_args = ~["-L", aux_output_dir_name(config, testfile)];
vec::iter(props.aux_builds) {|rel_ab|
let abs_ab = path::connect(config.aux_base, rel_ab);
let aux_args =
- make_compile_args(config, props, ["--lib"]/~ + extra_link_args,
+ make_compile_args(config, props, ~["--lib"] + extra_link_args,
{|a,b|make_lib_name(a, b, testfile)}, abs_ab);
- let auxres = compose_and_run(config, abs_ab, aux_args, []/~,
+ let auxres = compose_and_run(config, abs_ab, aux_args, ~[],
config.compile_lib_path, option::none);
if auxres.status != 0 {
fatal_procres(
@@ -335,7 +335,7 @@ fn compose_and_run_compiler(
}
}
- compose_and_run(config, testfile, args, []/~,
+ compose_and_run(config, testfile, args, ~[],
config.compile_lib_path, input)
}
@@ -348,19 +348,19 @@ fn ensure_dir(path: path) {
fn compose_and_run(config: config, testfile: str,
procargs: procargs,
- procenv: [(str, str)]/~,
+ procenv: ~[(str, str)],
lib_path: str,
input: option<str>) -> procres {
ret program_output(config, testfile, lib_path,
procargs.prog, procargs.args, procenv, input);
}
-fn make_compile_args(config: config, props: test_props, extras: [str]/~,
+fn make_compile_args(config: config, props: test_props, extras: ~[str],
xform: fn(config, str) -> str, testfile: str) ->
procargs {
let prog = config.rustc_path;
- let mut args = [testfile, "-o", xform(config, testfile),
- "-L", config.build_base]/~ + extras;
+ let mut args = ~[testfile, "-o", xform(config, testfile),
+ "-L", config.build_base] + extras;
args += split_maybe_args(config.rustcflags);
args += split_maybe_args(props.compile_flags);
ret {prog: prog, args: args};
@@ -390,12 +390,12 @@ fn make_run_args(config: config, _props: test_props, testfile: str) ->
split_maybe_args(runtool)
};
- let args = toolargs + [make_exe_name(config, testfile)]/~;
+ let args = toolargs + ~[make_exe_name(config, testfile)];
ret {prog: args[0], args: vec::slice(args, 1u, vec::len(args))};
}
-fn split_maybe_args(argstr: option<str>) -> [str]/~ {
- fn rm_whitespace(v: [str]/~) -> [str]/~ {
+fn split_maybe_args(argstr: option<str>) -> ~[str] {
+ fn rm_whitespace(v: ~[str]) -> ~[str] {
fn flt(&&s: str) -> option<str> {
if !str::is_whitespace(s) { option::some(s) } else { option::none }
}
@@ -404,12 +404,12 @@ fn split_maybe_args(argstr: option<str>) -> [str]/~ {
alt argstr {
option::some(s) { rm_whitespace(str::split_char(s, ' ')) }
- option::none { []/~ }
+ option::none { ~[] }
}
}
fn program_output(config: config, testfile: str, lib_path: str, prog: str,
- args: [str]/~, env: [(str, str)]/~,
+ args: ~[str], env: ~[(str, str)],
input: option<str>) -> procres {
let cmdline =
{
@@ -429,12 +429,12 @@ fn program_output(config: config, testfile: str, lib_path: str, prog: str,
#[cfg(target_os = "linux")]
#[cfg(target_os = "macos")]
#[cfg(target_os = "freebsd")]
-fn make_cmdline(_libpath: str, prog: str, args: [str]/~) -> str {
+fn make_cmdline(_libpath: str, prog: str, args: ~[str]) -> str {
#fmt["%s %s", prog, str::connect(args, " ")]
}
#[cfg(target_os = "win32")]
-fn make_cmdline(libpath: str, prog: str, args: [str]/~) -> str {
+fn make_cmdline(libpath: str, prog: str, args: ~[str]) -> str {
#fmt["%s %s %s", lib_path_cmd_prefix(libpath), prog,
str::connect(args, " ")]
}
@@ -454,7 +454,7 @@ fn dump_output(config: config, testfile: str, out: str, err: str) {
fn dump_output_file(config: config, testfile: str, out: str, extension: str) {
let outfile = make_out_name(config, testfile, extension);
let writer = result::get(
- io::file_writer(outfile, [io::create, io::truncate]/~));
+ io::file_writer(outfile, ~[io::create, io::truncate]));
writer.write_str(out);
}
View
12 src/fuzzer/ast_match.rs
@@ -1,7 +1,7 @@
use std;
import vec;
-fn vec_equal<T>(v: [T]/~, u: [T]/~,
+fn vec_equal<T>(v: ~[T], u: ~[T],
element_equality_test: fn@(&&T, &&T) -> bool) ->
bool {
let Lv = vec::len(v);
@@ -20,11 +20,11 @@ pure fn builtin_equal_int(&&a: int, &&b: int) -> bool { ret a == b; }
fn main() {
assert (builtin_equal(5, 5));
assert (!builtin_equal(5, 4));
- assert (!vec_equal([5, 5]/~, [5]/~, bind builtin_equal(_, _)));
- assert (!vec_equal([5, 5]/~, [5]/~, builtin_equal_int));
- assert (!vec_equal([5, 5]/~, [5, 4]/~, builtin_equal_int));
- assert (!vec_equal([5, 5]/~, [4, 5]/~, builtin_equal_int));
- assert (vec_equal([5, 5]/~, [5, 5]/~, builtin_equal_int));
+ assert (!vec_equal(~[5, 5], ~[5], bind builtin_equal(_, _)));
+ assert (!vec_equal(~[5, 5], ~[5], builtin_equal_int));
+ assert (!vec_equal(~[5, 5], ~[5, 4], builtin_equal_int));
+ assert (!vec_equal(~[5, 5], ~[4, 5], builtin_equal_int));
+ assert (vec_equal(~[5, 5], ~[5, 5], builtin_equal_int));
#error("Pass");
}
View
12 src/fuzzer/cycles.rs
@@ -8,7 +8,7 @@ fn under(r : rand::rng, n : uint) -> uint {
}
// random choice from a vec
-fn choice<T: copy>(r : rand::rng, v : [const T]/~) -> T {
+fn choice<T: copy>(r : rand::rng, v : ~[const T]) -> T {
assert vec::len(v) != 0u; v[under(r, vec::len(v))]
}
@@ -32,8 +32,8 @@ type pointy = {
mut f : fn@()->(),
mut g : fn~()->(),
- mut m : [maybe_pointy]/~,
- mut n : [mut maybe_pointy]/~,
+ mut m : ~[maybe_pointy],
+ mut n : ~[mut maybe_pointy],
mut o : {x : int, y : maybe_pointy}
};
// To add: objects; ifaces; anything type-parameterized?
@@ -47,8 +47,8 @@ fn empty_pointy() -> @pointy {
mut f : fn@()->(){},
mut g : fn~()->(){},
- mut m : []/~,
- mut n : [mut]/~,
+ mut m : ~[],
+ mut n : ~[mut],
mut o : {x : 0, y : none}
}
}
@@ -58,7 +58,7 @@ fn nop<T>(_x: T) { }
fn test_cycles(r : rand::rng, k: uint, n: uint)
{
- let v : [mut @pointy]/~ = [mut]/~;
+ let v : ~[mut @pointy] = ~[mut];
// Create a graph with no edges
range(0u, vlen) {|_i|
View
64 src/fuzzer/fuzzer.rs
@@ -10,7 +10,7 @@ type context = { mode: test_mode }; // + rng
fn write_file(filename: str, content: str) {
result::get(
- io::file_writer(filename, [io::create, io::truncate]/~))
+ io::file_writer(filename, ~[io::create, io::truncate]))
.write_str(content);
}
@@ -18,10 +18,10 @@ fn contains(haystack: str, needle: str) -> bool {
str::contains(haystack, needle)
}
-fn find_rust_files(&files: [str]/~, path: str) {
+fn find_rust_files(&files: ~[str], path: str) {
if str::ends_with(path, ".rs") && !contains(path, "utf8") {
// ignoring "utf8" tests because something is broken
- files += [path]/~;
+ files += ~[path];
} else if os::path_is_dir(path)
&& !contains(path, "compile-fail")
&& !contains(path, "build") {
@@ -32,7 +32,7 @@ fn find_rust_files(&files: [str]/~, path: str) {
}
-fn common_exprs() -> [ast::expr]/~ {
+fn common_exprs() -> ~[ast::expr] {
fn dse(e: ast::expr_) -> ast::expr {
{ id: 0, node: e, span: ast_util::dummy_sp() }
}
@@ -41,7 +41,7 @@ fn common_exprs() -> [ast::expr]/~ {
{ node: l, span: ast_util::dummy_sp() }
}
- [dse(ast::expr_break),
+ ~[dse(ast::expr_break),
dse(ast::expr_cont),
dse(ast::expr_fail(option::none)),
dse(ast::expr_fail(option::some(
@@ -54,7 +54,7 @@ fn common_exprs() -> [ast::expr]/~ {
@dse(ast::expr_lit(@dsl(ast::lit_bool(true)))))),
dse(ast::expr_unary(ast::uniq(ast::m_imm),
@dse(ast::expr_lit(@dsl(ast::lit_bool(true))))))
- ]/~
+ ]
}
pure fn safe_to_steal_expr(e: @ast::expr, tm: test_mode) -> bool {
@@ -116,16 +116,16 @@ fn safe_to_steal_ty(t: @ast::ty, tm: test_mode) -> bool {
// Not type-parameterized: https://github.com/mozilla/rust/issues/898 (FIXED)
fn stash_expr_if(c: fn@(@ast::expr, test_mode)->bool,
- es: @mut [ast::expr]/~,
+ es: @mut ~[ast::expr],
e: @ast::expr,
tm: test_mode) {
if c(e, tm) {
- *es += [*e]/~;
+ *es += ~[*e];
} else {/* now my indices are wrong :( */ }
}
fn stash_ty_if(c: fn@(@ast::ty, test_mode)->bool,
- es: @mut [ast::ty]/~,
+ es: @mut ~[ast::ty],
e: @ast::ty,
tm: test_mode) {
if c(e, tm) {
@@ -133,11 +133,11 @@ fn stash_ty_if(c: fn@(@ast::ty, test_mode)->bool,
} else {/* now my indices are wrong :( */ }
}
-type stolen_stuff = {exprs: [ast::expr]/~, tys: [ast::ty]/~};
+type stolen_stuff = {exprs: ~[ast::expr], tys: ~[ast::ty]};
fn steal(crate: ast::crate, tm: test_mode) -> stolen_stuff {
- let exprs = @mut []/~;
- let tys = @mut []/~;
+ let exprs = @mut ~[];
+ let tys = @mut ~[];
let v = visit::mk_simple_visitor(@{
visit_expr: {|a|stash_expr_if(safe_to_steal_expr, exprs, a, tm)},
visit_ty: {|a|stash_ty_if(safe_to_steal_ty, tys, a, tm)}
@@ -248,7 +248,7 @@ fn check_variants_T<T: copy>(
codemap: codemap::codemap,
filename: str,
thing_label: str,
- things: [T]/~,
+ things: ~[T],
stringifier: fn@(@T) -> str,
replacer: fn@(ast::crate, uint, T, test_mode) -> ast::crate,
cx: context
@@ -334,19 +334,19 @@ fn check_whole_compiler(code: str, suggested_filename_prefix: str,
fn removeIfExists(filename: str) {
// So sketchy!
assert !contains(filename, " ");
- run::program_output("bash", ["-c", "rm " + filename]/~);
+ run::program_output("bash", ~["-c", "rm " + filename]);
}
fn removeDirIfExists(filename: str) {
// So sketchy!
assert !contains(filename, " ");
- run::program_output("bash", ["-c", "rm -r " + filename]/~);
+ run::program_output("bash", ~["-c", "rm -r " + filename]);
}
fn check_running(exe_filename: str) -> happiness {
let p = run::program_output(
"/Users/jruderman/scripts/timed_run_rust_program.py",
- [exe_filename]/~);
+ ~[exe_filename]);
let comb = p.out + "\n" + p.err;
if str::len(comb) > 1u {
log(error, "comb comb comb: " + comb);
@@ -386,7 +386,7 @@ fn check_compiling(filename: str) -> happiness {
let p = run::program_output(
"/Users/jruderman/code/rust/build/x86_64-apple-darwin/\
stage1/bin/rustc",
- [filename]/~);
+ ~[filename]);
//#error("Status: %d", p.status);
if p.status == 0 {
@@ -420,7 +420,7 @@ fn parse_and_print(code: @str) -> str {
let sess = parse::new_parse_sess(option::none);
write_file(filename, *code);
let crate = parse::parse_crate_from_source_str(
- filename, code, []/~, sess);
+ filename, code, ~[], sess);
io::with_str_reader(*code) { |rdr|
as_str({|a|pprust::print_crate(sess.cm,
sess.span_diagnostic,
@@ -449,11 +449,11 @@ fn has_raw_pointers(c: ast::crate) -> bool {
fn content_is_dangerous_to_run(code: str) -> bool {
let dangerous_patterns =
- ["xfail-test",
+ ~["xfail-test",
"import", // espeically fs, run
"native",
"unsafe",
- "log"]/~; // python --> rust pipe deadlock?
+ "log"]; // python --> rust pipe deadlock?
for dangerous_patterns.each {|p| if contains(code, p) { ret true; } }
ret false;
@@ -461,7 +461,7 @@ fn content_is_dangerous_to_run(code: str) -> bool {
fn content_is_dangerous_to_compile(code: str) -> bool {
let dangerous_patterns =
- ["xfail-test"]/~;
+ ~["xfail-test"];
for dangerous_patterns.each {|p| if contains(code, p) { ret true; } }
ret false;
@@ -469,7 +469,7 @@ fn content_is_dangerous_to_compile(code: str) -> bool {
fn content_might_not_converge(code: str) -> bool {
let confusing_patterns =
- ["xfail-test",
+ ~["xfail-test",
"xfail-pretty",
"self", // crazy rules enforced by parser not typechecker?
"spawn", // precedence issues?
@@ -477,20 +477,20 @@ fn content_might_not_converge(code: str) -> bool {
" be ", // don't want to replace its child with a non-call:
// "Non-call expression in tail call"
"\n\n\n\n\n" // https://github.com/mozilla/rust/issues/850
- ]/~;
+ ];
for confusing_patterns.each {|p| if contains(code, p) { ret true; } }
ret false;
}
fn file_might_not_converge(filename: str) -> bool {
- let confusing_files = [
+ let confusing_files = ~[
"expr-alt.rs", // pretty-printing "(a = b) = c"
// vs "a = b = c" and wrapping
"block-arg-in-ternary.rs", // wrapping
"move-3-unique.rs", // 0 becomes (0), but both seem reasonable. wtf?
"move-3.rs" // 0 becomes (0), but both seem reasonable. wtf?
- ]/~;
+ ];
for confusing_files.each {|f| if contains(filename, f) { ret true; } }
@@ -519,13 +519,13 @@ fn check_roundtrip_convergence(code: @str, maxIters: uint) {
write_file("round-trip-a.rs", *oldv);
write_file("round-trip-b.rs", *newv);
run::run_program("diff",
- ["-w", "-u", "round-trip-a.rs",
- "round-trip-b.rs"]/~);
+ ~["-w", "-u", "round-trip-a.rs",
+ "round-trip-b.rs"]);
fail "Mismatch";
}
}
-fn check_convergence(files: [str]/~) {
+fn check_convergence(files: ~[str]) {
#error("pp convergence tests: %u files", vec::len(files));
for files.each {|file|
if !file_might_not_converge(file) {
@@ -540,7 +540,7 @@ fn check_convergence(files: [str]/~) {
}
}
-fn check_variants(files: [str]/~, cx: context) {
+fn check_variants(files: ~[str], cx: context) {
for files.each {|file|
if cx.mode == tm_converge && file_might_not_converge(file) {
#error("Skipping convergence test based on\
@@ -564,7 +564,7 @@ fn check_variants(files: [str]/~, cx: context) {
let crate =
parse::parse_crate_from_source_str(
file,
- s, []/~, sess);
+ s, ~[], sess);
io::with_str_reader(*s) { |rdr|
#error("%s",
as_str({|a|pprust::print_crate(sess.cm,
@@ -579,12 +579,12 @@ fn check_variants(files: [str]/~, cx: context) {
}
}
-fn main(args: [str]/~) {
+fn main(args: ~[str]) {
if vec::len(args) != 2u {
#error("usage: %s <testdir>", args[0]);
ret;
}
- let mut files = []/~;
+ let mut files = ~[];
let root = args[1];
find_rust_files(files, root);
View
54 src/fuzzer/ivec_fuzz.rs
@@ -8,8 +8,8 @@ Idea: provide functions for 'exhaustive' and 'random' modification of vecs.
It would be nice if this could be data-driven, so the two functions
could share information:
- type vec_modifier = rec(fn (<T> v, uint i) -> [T]/~ fun, uint lo, uint di);
- const [vec_modifier]/~ vec_modifiers = ~[rec(fun=vec_omit, 0u, 1u), ...]/~;
+ type vec_modifier = rec(fn (<T> v, uint i) -> ~[T] fun, uint lo, uint di);
+ const ~[vec_modifier] vec_modifiers = ~[rec(fun=vec_omit, 0u, 1u), ...]/~;
But that gives me "error: internal compiler error unimplemented consts
that's not a plain literal".
https://github.com/graydon/rust/issues/570
@@ -24,23 +24,23 @@ import vec::slice;
import vec::len;
import int;
-fn vec_omit<T: copy>(v: [T]/~, i: uint) -> [T]/~ {
+fn vec_omit<T: copy>(v: ~[T], i: uint) -> ~[T] {
slice(v, 0u, i) + slice(v, i + 1u, len(v))
}
-fn vec_dup<T: copy>(v: [T]/~, i: uint) -> [T]/~ {
+fn vec_dup<T: copy>(v: ~[T], i: uint) -> ~[T] {
slice(v, 0u, i) + [v[i]] + slice(v, i, len(v))
}
-fn vec_swadj<T: copy>(v: [T]/~, i: uint) -> [T]/~ {
+fn vec_swadj<T: copy>(v: ~[T], i: uint) -> ~[T] {
slice(v, 0u, i) + [v[i + 1u], v[i]] + slice(v, i + 2u, len(v))
}
-fn vec_prefix<T: copy>(v: [T]/~, i: uint) -> [T]/~ { slice(v, 0u, i) }
-fn vec_suffix<T: copy>(v: [T]/~, i: uint) -> [T]/~ { slice(v, i, len(v)) }
+fn vec_prefix<T: copy>(v: ~[T], i: uint) -> ~[T] { slice(v, 0u, i) }
+fn vec_suffix<T: copy>(v: ~[T], i: uint) -> ~[T] { slice(v, i, len(v)) }
-fn vec_poke<T: copy>(v: [T]/~, i: uint, x: T) -> [T]/~ {
- slice(v, 0u, i) + [x]/~ + slice(v, i + 1u, len(v))
+fn vec_poke<T: copy>(v: ~[T], i: uint, x: T) -> ~[T] {
+ slice(v, 0u, i) + ~[x] + slice(v, i + 1u, len(v))
}
-fn vec_insert<T: copy>(v: [T]/~, i: uint, x: T) -> [T]/~ {
- slice(v, 0u, i) + [x]/~ + slice(v, i, len(v))
+fn vec_insert<T: copy>(v: ~[T], i: uint, x: T) -> ~[T] {
+ slice(v, 0u, i) + ~[x] + slice(v, i, len(v))
}
// Iterates over 0...length, skipping the specified number on each side.
@@ -51,23 +51,23 @@ fn ix(skip_low: uint, skip_high: uint, length: uint, it: block(uint)) {
// Returns a bunch of modified versions of v, some of which introduce
// new elements (borrowed from xs).
-fn vec_edits<T: copy>(v: [T]/~, xs: [T]/~) -> [[T]/~]/~ {
- let edits: [[T]/~]/~ = []/~;
+fn vec_edits<T: copy>(v: ~[T], xs: ~[T]) -> ~[~[T]] {
+ let edits: ~[~[T]] = ~[];
let Lv: uint = len(v);
if Lv != 1u {
// When Lv == 1u, this is redundant with omit.
- vec::push(edits, []/~);
+ vec::push(edits, ~[]);
}
if Lv >= 3u {
// When Lv == 2u, this is redundant with swap.
vec::push(edits, vec::reversed(v));
}
- ix(0u, 1u, Lv) {|i| edits += [vec_omit(v, i)]/~; }
- ix(0u, 1u, Lv) {|i| edits += [vec_dup(v, i)]/~; }
- ix(0u, 2u, Lv) {|i| edits += [vec_swadj(v, i)]/~; }
- ix(1u, 2u, Lv) {|i| edits += [vec_prefix(v, i)]/~; }
- ix(2u, 1u, Lv) {|i| edits += [vec_suffix(v, i)]/~; }
+ ix(0u, 1u, Lv) {|i| edits += ~[vec_omit(v, i)]; }
+ ix(0u, 1u, Lv) {|i| edits += ~[vec_dup(v, i)]; }
+ ix(0u, 2u, Lv) {|i| edits += ~[vec_swadj(v, i)]; }
+ ix(1u, 2u, Lv) {|i| edits += ~[vec_prefix(v, i)]; }
+ ix(2u, 1u, Lv) {|i| edits += ~[vec_suffix(v, i)]; }
ix(0u, 1u, len(xs)) {|j|
ix(0u, 1u, Lv) {|i|
@@ -83,7 +83,7 @@ fn vec_edits<T: copy>(v: [T]/~, xs: [T]/~) -> [[T]/~]/~ {
// Would be nice if this were built in:
// https://github.com/graydon/rust/issues/424
-fn vec_to_str(v: [int]/~) -> str {
+fn vec_to_str(v: ~[int]) -> str {
let i = 0u;
let s = "[";
while i < len(v) {
@@ -94,19 +94,19 @@ fn vec_to_str(v: [int]/~) -> str {
ret s + "]";
}
-fn show_edits(a: [int]/~, xs: [int]/~) {
+fn show_edits(a: ~[int], xs: ~[int]) {
log(error, "=== Edits of " + vec_to_str(a) + " ===");
let b = vec_edits(a, xs);
ix(0u, 1u, len(b)) {|i| log(error, vec_to_str(b[i])); }
}
fn demo_edits() {
- let xs = [7, 8]/~;
- show_edits([]/~, xs);
- show_edits([1]/~, xs);
- show_edits([1, 2]/~, xs);
- show_edits([1, 2, 3]/~, xs);
- show_edits([1, 2, 3, 4]/~, xs);
+ let xs = ~[7, 8];
+ show_edits(~[], xs);
+ show_edits(~[1], xs);
+ show_edits(~[1, 2], xs);
+ show_edits(~[1, 2, 3], xs);
+ show_edits(~[1, 2, 3, 4], xs);
}
fn main() { demo_edits(); }
View
22 src/fuzzer/rand_util.rs
@@ -8,7 +8,7 @@ fn under(r : rand::rng, n : uint) -> uint {
}
// random choice from a vec
-fn choice<T: copy>(r : rand::rng, v : [T]/~) -> T {
+fn choice<T: copy>(r : rand::rng, v : ~[T]) -> T {
assert vec::len(v) != 0u; v[under(r, vec::len(v))]
}
@@ -16,7 +16,7 @@ fn choice<T: copy>(r : rand::rng, v : [T]/~) -> T {
fn unlikely(r : rand::rng, n : uint) -> bool { under(r, n) == 0u }
// shuffle a vec in place
-fn shuffle<T>(r : rand::rng, &v : [mut T]/~) {
+fn shuffle<T>(r : rand::rng, &v : ~[mut T]) {
let i = vec::len(v);
while i >= 2u {
// Loop invariant: elements with index >= i have been locked in place.
@@ -26,20 +26,20 @@ fn shuffle<T>(r : rand::rng, &v : [mut T]/~) {
}
// create a shuffled copy of a vec
-fn shuffled<T: copy>(r : rand::rng, v : [T]/~) -> [T]/~ {
+fn shuffled<T: copy>(r : rand::rng, v : ~[T]) -> ~[T] {
let w = vec::to_mut(v);
shuffle(r, w);
vec::from_mut(w) // Shouldn't this happen automatically?
}
// sample from a population without replacement
-//fn sample<T>(r : rand::rng, pop : [T]/~, k : uint) -> [T]/~ { fail }
+//fn sample<T>(r : rand::rng, pop : ~[T], k : uint) -> ~[T] { fail }
// Two ways to make a weighted choice.
// * weighted_choice is O(number of choices) time
// * weighted_vec is O(total weight) space
type weighted<T> = { weight: uint, item: T };
-fn weighted_choice<T: copy>(r : rand::rng, v : [weighted<T>]/~) -> T {
+fn weighted_choice<T: copy>(r : rand::rng, v : ~[weighted<T>]) -> T {
assert vec::len(v) != 0u;
let total = 0u;
for {weight: weight, item: _} in v {
@@ -57,8 +57,8 @@ fn weighted_choice<T: copy>(r : rand::rng, v : [weighted<T>]/~) -> T {
core::unreachable();
}
-fn weighted_vec<T: copy>(v : [weighted<T>]/~) -> [T]/~ {
- let r = []/~;
+fn weighted_vec<T: copy>(v : ~[weighted<T>]) -> ~[T] {
+ let r = ~[];
for {weight: weight, item: item} in v {
let i = 0u;
while i < weight {
@@ -74,19 +74,19 @@ fn main()
let r = rand::mk_rng();
log(error, under(r, 5u));
- log(error, choice(r, [10, 20, 30]/~));
+ log(error, choice(r, ~[10, 20, 30]));
log(error, if unlikely(r, 5u) { "unlikely" } else { "likely" });
- let a = [mut 1, 2, 3]/~;
+ let a = ~[mut 1, 2, 3];
shuffle(r, a);
log(error, a);
let i = 0u;
- let v = [
+ let v = ~[
{weight:1u, item:"low"},
{weight:8u, item:"middle"},
{weight:1u, item:"high"}
- ]/~;
+ ];
let w = weighted_vec(v);
while i < 1000u {
View
12 src/libcore/arc.rs
@@ -168,7 +168,7 @@ mod tests {
#[test]
fn manually_share_arc() {
- let v = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]/~;
+ let v = ~[1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
let arc_v = arc::arc(v);
let p = port();
@@ -180,7 +180,7 @@ mod tests {
let arc_v = p.recv();
- let v = *arc::get::<[int]/~>(&arc_v);
+ let v = *arc::get::<~[int]>(&arc_v);
assert v[3] == 4;
};
@@ -194,7 +194,7 @@ mod tests {
#[test]
fn auto_share_arc() {
- let v = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]/~;
+ let v = ~[1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
let (_res, arc_c) = shared_arc(v);
let p = port();
@@ -214,7 +214,7 @@ mod tests {
#[test]
#[ignore] // this can probably infinite loop too.
fn exclusive_arc() {
- let mut futures = []/~;
+ let mut futures = ~[];
let num_tasks = 10u;
let count = 1000u;
@@ -223,13 +223,13 @@ mod tests {
for uint::range(0u, num_tasks) {|_i|
let total = total.clone();
- futures += [future::spawn({||
+ futures += ~[future::spawn({||
for uint::range(0u, count) {|_i|
total.with {|_cond, count|
**count += 1u;
}
}
- })]/~;
+ })];
};
for futures.each {|f| f.get() };
View
2  src/libcore/comm.rs
@@ -217,7 +217,7 @@ fn peek_(p: *rust_port) -> bool {
#[doc = "Receive on one of two ports"]
fn select2<A: send, B: send>(p_a: port<A>, p_b: port<B>)
-> either<A, B> {
- let ports = [(**p_a).po, (**p_b).po]/~;
+ let ports = ~[(**p_a).po, (**p_b).po];
let n_ports = 2 as libc::size_t;
let yield = 0u, yieldp = ptr::addr_of(yield);
View
26 src/libcore/dvec.rs
@@ -48,26 +48,26 @@ type could only produce 47 million pushes/second.
"]
type dvec<A> = {
- mut data: [mut A]/~
+ mut data: ~[mut A]
};
#[doc = "Creates a new, empty dvec"]
fn dvec<A>() -> dvec<A> {
- {mut data: [mut]/~}
+ {mut data: ~[mut]}
}
#[doc = "Creates a new dvec with a single element"]
fn from_elt<A>(+e: A) -> dvec<A> {
- {mut data: [mut e]/~}
+ {mut data: ~[mut e]}
}
#[doc = "Creates a new dvec with the contents of a vector"]
-fn from_vec<A>(+v: [mut A]/~) -> dvec<A> {
+fn from_vec<A>(+v: ~[mut A]) -> dvec<A> {
{mut data: v}
}
#[doc = "Consumes the vector and returns its contents"]
-fn unwrap<A>(-d: dvec<A>) -> [mut A]/~ {
+fn unwrap<A>(-d: dvec<A>) -> ~[mut A] {
let {data: v} <- d;
ret v;
}
@@ -83,7 +83,7 @@ impl private_methods<A> for dvec<A> {
}
#[inline(always)]
- fn borrow<B>(f: fn(-[mut A]/~) -> B) -> B {
+ fn borrow<B>(f: fn(-~[mut A]) -> B) -> B {
unsafe {
let mut data = unsafe::reinterpret_cast(null::<()>());
data <-> self.data;
@@ -94,7 +94,7 @@ impl private_methods<A> for dvec<A> {
}
#[inline(always)]
- fn return(-data: [mut A]/~) {
+ fn return(-data: ~[mut A]) {
unsafe {
self.data <- data;
}
@@ -113,7 +113,7 @@ impl extensions<A> for dvec<A> {