Skip to content

Commit 1c62f5f

Browse files
committed
Get rid of all of the remaining /~s in the code base.
1 parent 46fba10 commit 1c62f5f

File tree

17 files changed

+68
-70
lines changed

17 files changed

+68
-70
lines changed

src/etc/combine-tests.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@ def scrub(b):
3030
"xfail-fast" in s or
3131
"xfail-win32" in s):
3232
stage2_tests.append(t)
33-
if "main(args: [str]/~)" in s:
34-
take_args[t] = True
3533
if "main(args: [str])" in s:
3634
take_args[t] = True
3735
if "main(args: ~[str])" in s:

src/libcore/dvec.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export unwrap;
3232
* # WARNING
3333
*
3434
* For maximum performance, this type is implemented using some rather
35-
* unsafe code. In particular, this innocent looking `[mut A]/~` pointer
35+
* unsafe code. In particular, this innocent looking `~[mut A]` pointer
3636
* *may be null!* Therefore, it is important you not reach into the
3737
* data structure manually but instead use the provided extensions.
3838
*

src/libcore/float.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ fn to_str(num: float, digits: uint) -> str {
236236
* # Return value
237237
*
238238
* `none` if the string did not represent a valid number. Otherwise,
239-
* `some(n)` where `n` is the floating-point number represented by `[num]/~`.
239+
* `some(n)` where `n` is the floating-point number represented by `[num]`.
240240
*/
241241
fn from_str(num: str) -> option<float> {
242242
if num == "inf" {
@@ -261,7 +261,7 @@ fn from_str(num: str) -> option<float> {
261261
_ { ret none; }
262262
}
263263

264-
//Determine if first char is '-'/'+'. Set ~[pos] and ~[neg] accordingly.
264+
//Determine if first char is '-'/'+'. Set [pos] and [neg] accordingly.
265265
let mut neg = false; //Sign of the result
266266
alt str::char_at(num, 0u) {
267267
'-' {

src/libcore/result.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -247,8 +247,8 @@ impl extensions<T:copy, E:copy> for result<T,E> {
247247
* if x == uint::max_value { ret err("overflow"); }
248248
* else { ret ok(x+1u); }
249249
* }
250-
* map([1u, 2u, 3u]/~, inc_conditionally).chain {|incd|
251-
* assert incd == [2u, 3u, 4u]/~;
250+
* map(~[1u, 2u, 3u], inc_conditionally).chain {|incd|
251+
* assert incd == ~[2u, 3u, 4u];
252252
* }
253253
*/
254254
fn map_vec<T,U:copy,V:copy>(

src/libcore/unsafe.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ unsafe fn bump_box_refcount<T>(+t: @T) { forget(t); }
3939
*
4040
* # Example
4141
*
42-
* assert transmute("L") == [76u8, 0u8]/~;
42+
* assert transmute("L") == ~[76u8, 0u8];
4343
*/
4444
unsafe fn transmute<L, G>(-thing: L) -> G {
4545
let newthing = reinterpret_cast(thing);

src/libcore/vec.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -666,14 +666,14 @@ pure fn filter<T: copy>(v: &[T], f: fn(T) -> bool) -> ~[T] {
666666
*
667667
* Flattens a vector of vectors of T into a single vector of T.
668668
*/
669-
pure fn concat<T: copy>(v: &[[T]/~]) -> ~[T] {
669+
pure fn concat<T: copy>(v: &[~[T]]) -> ~[T] {
670670
let mut r = ~[];
671671
for each(v) |inner| { unsafe { push_all(r, inner); } }
672672
ret r;
673673
}
674674

675675
/// Concatenate a vector of vectors, placing a given separator between each
676-
pure fn connect<T: copy>(v: &[[T]/~], sep: T) -> ~[T] {
676+
pure fn connect<T: copy>(v: &[~[T]], sep: T) -> ~[T] {
677677
let mut r: ~[T] = ~[];
678678
let mut first = true;
679679
for each(v) |inner| {

src/libstd/getopts.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,21 +28,21 @@
2828
* }
2929
*
3030
* fn print_usage(program: str) {
31-
* io::println("Usage: " + program + " [options]/~");
31+
* io::println("Usage: " + program + " [options]");
3232
* io::println("-o\t\tOutput");
3333
* io::println("-h --help\tUsage");
3434
* }
3535
*
36-
* fn main(args: [str]/~) {
36+
* fn main(args: ~[str]) {
3737
* check vec::is_not_empty(args);
3838
*
3939
* let program : str = vec::head(args);
4040
*
41-
* let opts = [
41+
* let opts = ~[
4242
* optopt("o"),
4343
* optflag("h"),
4444
* optflag("help")
45-
* ]/~;
45+
* ];
4646
* let match = alt getopts(vec::tail(args), opts) {
4747
* result::ok(m) { m }
4848
* result::err(f) { fail fail_str(f) }

src/libstd/net_ip.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -84,12 +84,12 @@ enum ip_get_addr_err {
8484
*
8585
* # Returns
8686
*
87-
* A `result<[ip_addr]/~, ip_get_addr_err>` instance that will contain
87+
* A `result<~[ip_addr], ip_get_addr_err>` instance that will contain
8888
* a vector of `ip_addr` results, in the case of success, or an error
8989
* object in the case of failure
9090
*/
9191
fn get_addr(++node: str, iotask: iotask)
92-
-> result::result<[ip_addr]/~, ip_get_addr_err> unsafe {
92+
-> result::result<~[ip_addr], ip_get_addr_err> unsafe {
9393
do comm::listen |output_ch| {
9494
do str::unpack_slice(node) |node_ptr, len| {
9595
log(debug, #fmt("slice len %?", len));
@@ -249,7 +249,7 @@ mod v6 {
249249
}
250250

251251
type get_addr_data = {
252-
output_ch: comm::chan<result::result<[ip_addr]/~,ip_get_addr_err>>
252+
output_ch: comm::chan<result::result<~[ip_addr],ip_get_addr_err>>
253253
};
254254

255255
extern fn get_addr_cb(handle: *uv_getaddrinfo_t, status: libc::c_int,
@@ -259,7 +259,7 @@ extern fn get_addr_cb(handle: *uv_getaddrinfo_t, status: libc::c_int,
259259
*get_addr_data;
260260
if status == 0i32 {
261261
if res != (ptr::null::<addrinfo>()) {
262-
let mut out_vec = []/~;
262+
let mut out_vec = ~[];
263263
log(debug, #fmt("initial addrinfo: %?", res));
264264
let mut curr_addr = res;
265265
loop {
@@ -278,7 +278,7 @@ extern fn get_addr_cb(handle: *uv_getaddrinfo_t, status: libc::c_int,
278278
result::err(get_addr_unknown_error));
279279
break;
280280
};
281-
out_vec += [new_ip_addr]/~;
281+
out_vec += ~[new_ip_addr];
282282

283283
let next_addr = ll::get_next_addrinfo(curr_addr);
284284
if next_addr == ptr::null::<addrinfo>() as *addrinfo {

src/libstd/net_tcp.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ fn connect(-input_ip: ip::ip_addr, port: uint,
248248
* # Arguments
249249
*
250250
* * sock - a `tcp_socket` to write to
251-
* * raw_write_data - a vector of `[u8]/~` that will be written to the stream.
251+
* * raw_write_data - a vector of `~[u8]` that will be written to the stream.
252252
* This value must remain valid for the duration of the `write` call
253253
*
254254
* # Returns
@@ -284,7 +284,7 @@ fn write(sock: tcp_socket, raw_write_data: ~[u8])
284284
* # Arguments
285285
*
286286
* * sock - a `tcp_socket` to write to
287-
* * raw_write_data - a vector of `[u8]/~` that will be written to the stream.
287+
* * raw_write_data - a vector of `~[u8]` that will be written to the stream.
288288
* This value must remain valid for the duration of the `write` call
289289
*
290290
* # Returns
@@ -331,7 +331,7 @@ fn read_start(sock: tcp_socket)
331331
* * `sock` - a `net::tcp::tcp_socket` that you wish to stop reading on
332332
*/
333333
fn read_stop(sock: tcp_socket,
334-
-read_port: comm::port<result::result<[u8]/~, tcp_err_data>>) ->
334+
-read_port: comm::port<result::result<~[u8], tcp_err_data>>) ->
335335
result::result<(), tcp_err_data> unsafe {
336336
log(debug, #fmt("taking the read_port out of commission %?", read_port));
337337
let socket_data = ptr::addr_of(*sock.socket_data);
@@ -360,7 +360,7 @@ fn read(sock: tcp_socket, timeout_msecs: uint)
360360
}
361361

362362
/**
363-
* Reads a single chunk of data; returns a `future::future<[u8]/~>`
363+
* Reads a single chunk of data; returns a `future::future<~[u8]>`
364364
* immediately
365365
*
366366
* Does a non-blocking read operation for a single chunk of data from a
@@ -731,7 +731,7 @@ fn listen_common(-host_ip: ip::ip_addr, port: uint, backlog: uint,
731731
* A buffered wrapper that you can cast as an `io::reader` or `io::writer`
732732
*/
733733
fn socket_buf(-sock: tcp_socket) -> tcp_socket_buf {
734-
tcp_socket_buf(@{ sock: sock, mut buf: []/~ })
734+
tcp_socket_buf(@{ sock: sock, mut buf: ~[] })
735735
}
736736

737737
/// Convenience methods extending `net::tcp::tcp_socket`
@@ -741,7 +741,7 @@ impl tcp_socket for tcp_socket {
741741
read_start(self)
742742
}
743743
fn read_stop(-read_port:
744-
comm::port<result::result<[u8]/~, tcp_err_data>>) ->
744+
comm::port<result::result<~[u8], tcp_err_data>>) ->
745745
result::result<(), tcp_err_data> {
746746
read_stop(self, read_port)
747747
}
@@ -765,14 +765,14 @@ impl tcp_socket for tcp_socket {
765765

766766
/// Implementation of `io::reader` iface for a buffered `net::tcp::tcp_socket`
767767
impl tcp_socket_buf of io::reader for @tcp_socket_buf {
768-
fn read_bytes(amt: uint) -> [u8]/~ {
768+
fn read_bytes(amt: uint) -> ~[u8] {
769769
let has_amt_available =
770770
vec::len((*(self.data)).buf) >= amt;
771771
if has_amt_available {
772772
// no arbitrary-length shift in vec::?
773-
let mut ret_buf = []/~;
773+
let mut ret_buf = ~[];
774774
while vec::len(ret_buf) < amt {
775-
ret_buf += [vec::shift((*(self.data)).buf)]/~;
775+
ret_buf += ~[vec::shift((*(self.data)).buf)];
776776
}
777777
ret_buf
778778
}
@@ -782,7 +782,7 @@ impl tcp_socket_buf of io::reader for @tcp_socket_buf {
782782
let err_data = read_result.get_err();
783783
log(debug, #fmt("ERROR sock_buf as io::reader.read err %? %?",
784784
err_data.err_name, err_data.err_msg));
785-
[]/~
785+
~[]
786786
}
787787
else {
788788
let new_chunk = result::unwrap(read_result);
@@ -811,7 +811,7 @@ impl tcp_socket_buf of io::reader for @tcp_socket_buf {
811811

812812
/// Implementation of `io::reader` iface for a buffered `net::tcp::tcp_socket`
813813
impl tcp_socket_buf of io::writer for @tcp_socket_buf {
814-
fn write(data: [const u8]/&) unsafe {
814+
fn write(data: &[const u8]) unsafe {
815815
let socket_data_ptr =
816816
ptr::addr_of(*((*(self.data)).sock).socket_data);
817817
let w_result = write_common_impl(socket_data_ptr,
@@ -1221,7 +1221,7 @@ type tcp_socket_data = {
12211221

12221222
type tcp_buffered_socket_data = {
12231223
sock: tcp_socket,
1224-
mut buf: [u8]/~
1224+
mut buf: ~[u8]
12251225
};
12261226

12271227
//#[cfg(test)]

src/libstd/sort.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ fn qsort3<T: copy>(compare_func_lt: le<T>, compare_func_eq: le<T>,
146146
/**
147147
* Fancy quicksort. Sorts a mut vector in place.
148148
*
149-
* Based on algorithm presented by [Sedgewick and Bentley]/~
149+
* Based on algorithm presented by ~[Sedgewick and Bentley]
150150
* (http://www.cs.princeton.edu/~rs/talks/QuicksortIsOptimal.pdf).
151151
* According to these slides this is the algorithm of choice for
152152
* 'randomly ordered keys, abstract compare' & 'small number of key values'.

src/libstd/term.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const color_bright_magenta: u8 = 13u8;
2323
const color_bright_cyan: u8 = 14u8;
2424
const color_bright_white: u8 = 15u8;
2525

26-
fn esc(writer: io::writer) { writer.write([0x1bu8, '[' as u8]/~); }
26+
fn esc(writer: io::writer) { writer.write(~[0x1bu8, '[' as u8]); }
2727

2828
/// Reset the foreground and background colors to default
2929
fn reset(writer: io::writer) {

src/libstd/uv_ll.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -819,8 +819,8 @@ unsafe fn ip6_addr(ip: str, port: int)
819819
}
820820
unsafe fn ip4_name(src: &sockaddr_in) -> str {
821821
// ipv4 addr max size: 15 + 1 trailing null byte
822-
let dst: [u8]/~ = [0u8,0u8,0u8,0u8,0u8,0u8,0u8,0u8,
823-
0u8,0u8,0u8,0u8,0u8,0u8,0u8,0u8]/~;
822+
let dst: ~[u8] = ~[0u8,0u8,0u8,0u8,0u8,0u8,0u8,0u8,
823+
0u8,0u8,0u8,0u8,0u8,0u8,0u8,0u8];
824824
let size = 16 as libc::size_t;
825825
do vec::as_buf(dst) |dst_buf| {
826826
rustrt::rust_uv_ip4_name(src as *sockaddr_in,
@@ -836,12 +836,12 @@ unsafe fn ip4_name(src: &sockaddr_in) -> str {
836836
}
837837
unsafe fn ip6_name(src: &sockaddr_in6) -> str {
838838
// ipv6 addr max size: 45 + 1 trailing null byte
839-
let dst: [u8]/~ = [0u8,0u8,0u8,0u8,0u8,0u8,0u8,0u8,
839+
let dst: ~[u8] = ~[0u8,0u8,0u8,0u8,0u8,0u8,0u8,0u8,
840840
0u8,0u8,0u8,0u8,0u8,0u8,0u8,0u8,
841841
0u8,0u8,0u8,0u8,0u8,0u8,0u8,0u8,
842842
0u8,0u8,0u8,0u8,0u8,0u8,0u8,0u8,
843843
0u8,0u8,0u8,0u8,0u8,0u8,0u8,0u8,
844-
0u8,0u8,0u8,0u8,0u8,0u8]/~;
844+
0u8,0u8,0u8,0u8,0u8,0u8];
845845
let size = 46 as libc::size_t;
846846
do vec::as_buf(dst) |dst_buf| {
847847
let src_unsafe_ptr = src as *sockaddr_in6;

src/libsyntax/ext/pipes/pipec.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ impl methods for state {
162162
cx.ty_path(path(self.name).add_tys(cx.ty_vars(self.ty_params)))
163163
}
164164

165-
fn to_type_decls(cx: ext_ctxt) -> [@ast::item]/~ {
165+
fn to_type_decls(cx: ext_ctxt) -> ~[@ast::item] {
166166
// This compiles into two different type declarations. Say the
167167
// state is called ping. This will generate both `ping` and
168168
// `ping_message`. The first contains data that the user cares
@@ -171,7 +171,7 @@ impl methods for state {
171171

172172
let name = self.data_name();
173173

174-
let mut items_msg = []/~;
174+
let mut items_msg = ~[];
175175

176176
for self.messages.each |m| {
177177
let message(_, tys, this, next, next_tys) = m;
@@ -197,7 +197,7 @@ impl methods for state {
197197
~[cx.item_enum_poly(name, items_msg, self.ty_params)]
198198
}
199199

200-
fn to_endpoint_decls(cx: ext_ctxt, dir: direction) -> [@ast::item]/~ {
200+
fn to_endpoint_decls(cx: ext_ctxt, dir: direction) -> ~[@ast::item] {
201201
let dir = alt dir {
202202
send { (*self).dir }
203203
recv { (*self).dir.reverse() }
@@ -285,7 +285,7 @@ impl methods for protocol {
285285
start_state.to_ty(cx).to_source(),
286286
body.to_source()),
287287
cx.cfg(),
288-
[]/~,
288+
~[],
289289
ast::public,
290290
cx.parse_sess()).get()
291291
}
@@ -325,7 +325,7 @@ impl of to_source for @ast::item {
325325
}
326326
}
327327

328-
impl of to_source for [@ast::item]/~ {
328+
impl of to_source for ~[@ast::item] {
329329
fn to_source() -> str {
330330
str::connect(self.map(|i| i.to_source()), "\n\n")
331331
}
@@ -337,7 +337,7 @@ impl of to_source for @ast::ty {
337337
}
338338
}
339339

340-
impl of to_source for [@ast::ty]/~ {
340+
impl of to_source for ~[@ast::ty] {
341341
fn to_source() -> str {
342342
str::connect(self.map(|i| i.to_source()), ", ")
343343
}
@@ -361,7 +361,7 @@ impl parse_utils for ext_ctxt {
361361
"***protocol expansion***",
362362
@(copy s),
363363
self.cfg(),
364-
[]/~,
364+
~[],
365365
ast::public,
366366
self.parse_sess());
367367
alt res {
@@ -382,13 +382,13 @@ impl parse_utils for ext_ctxt {
382382
}
383383
}
384384

385-
impl methods<A: copy, B: copy> for ([A]/~, [B]/~) {
386-
fn zip() -> [(A, B)]/~ {
385+
impl methods<A: copy, B: copy> for (~[A], ~[B]) {
386+
fn zip() -> ~[(A, B)] {
387387
let (a, b) = self;
388388
vec::zip(a, b)
389389
}
390390

391-
fn map<C>(f: fn(A, B) -> C) -> [C]/~ {
391+
fn map<C>(f: fn(A, B) -> C) -> ~[C] {
392392
let (a, b) = self;
393393
vec::map2(a, b, f)
394394
}

0 commit comments

Comments
 (0)