Skip to content

Commit 0156af1

Browse files
committed
auto merge of #13443 : alexcrichton/rust/rollup, r=alexcrichton
Closes #13441 (debuginfo: Fixes and improvements for #12840, #12886, and #13213) Closes #13433 (Remove references to @trait from a compiler error message) Closes #13430 (Fix outdated lint warning about inner attribute) Closes #13425 (Remove a pile of (mainly) internal `~[]` uses) Closes #13419 (Stop using transmute_mut in RefCell) Closes #13417 (Remove an unnecessary file `src/libnative/io/p`.) Closes #13409 (Closing assorted resolve bugs) Closes #13406 (Generalized the pretty-print entry points to support `-o <file>`.) Closes #13403 (test: Add a test for #7663) Closes #13402 (rustdoc: Prune the paths that do not appear in the index.) Closes #13396 (rustc: Remove absolute rpaths) Closes #13371 (Rename ast::Purity and ast::Impure Function. Closes #7287) Closes #13350 (collections: replace all ~[T] with Vec<T>.)
2 parents 5bcb761 + 1f2c18a commit 0156af1

Some content is hidden

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

107 files changed

+1127
-648
lines changed

mk/docs.mk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,7 @@ LIB_DOC_DEP_$(1) = $$(CRATEFILE_$(1)) $$(RSINPUTS_$(1))
269269
endif
270270

271271
$(2) += doc/$(1)/index.html
272+
doc/$(1)/index.html: CFG_COMPILER_HOST_TRIPLE = $(CFG_TARGET)
272273
doc/$(1)/index.html: $$(LIB_DOC_DEP_$(1))
273274
@$$(call E, rustdoc $$@)
274275
$$(Q)$$(RUSTDOC) --cfg dox --cfg stage2 $$<

mk/main.mk

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -358,17 +358,13 @@ CFGFLAG$(1)_T_$(2)_H_$(3) = stage1
358358
endif
359359
endif
360360

361-
ifdef CFG_DISABLE_RPATH
362361
ifeq ($$(OSTYPE_$(3)),apple-darwin)
363362
RPATH_VAR$(1)_T_$(2)_H_$(3) := \
364363
DYLD_LIBRARY_PATH="$$$$DYLD_LIBRARY_PATH:$$(CURDIR)/$$(HLIB$(1)_H_$(3))"
365364
else
366365
RPATH_VAR$(1)_T_$(2)_H_$(3) := \
367366
LD_LIBRARY_PATH="$$$$LD_LIBRARY_PATH:$$(CURDIR)/$$(HLIB$(1)_H_$(3))"
368367
endif
369-
else
370-
RPATH_VAR$(1)_T_$(2)_H_$(3) :=
371-
endif
372368

373369
STAGE$(1)_T_$(2)_H_$(3) := \
374370
$$(Q)$$(RPATH_VAR$(1)_T_$(2)_H_$(3)) \

src/compiletest/runtest.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,7 @@ fn run_debuginfo_test(config: &config, props: &TestProps, testfile: &Path) {
451451
let options_to_remove = [~"-O", ~"-g", ~"--debuginfo"];
452452
let new_options = split_maybe_args(options).move_iter()
453453
.filter(|x| !options_to_remove.contains(x))
454-
.collect::<~[~str]>()
454+
.collect::<Vec<~str>>()
455455
.connect(" ");
456456
Some(new_options)
457457
}

src/libflate/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,13 +117,13 @@ mod tests {
117117
words.push(r.gen_vec::<u8>(range));
118118
}
119119
for _ in range(0, 20) {
120-
let mut input = ~[];
120+
let mut input = vec![];
121121
for _ in range(0, 2000) {
122122
input.push_all(r.choose(words.as_slice()).as_slice());
123123
}
124124
debug!("de/inflate of {} bytes of random word-sequences",
125125
input.len());
126-
let cmp = deflate_bytes(input).expect("deflation failed");
126+
let cmp = deflate_bytes(input.as_slice()).expect("deflation failed");
127127
let out = inflate_bytes(cmp.as_slice()).expect("inflation failed");
128128
debug!("{} bytes deflated to {} ({:.1f}% size)",
129129
input.len(), cmp.len(),

src/libgetopts/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
//!
5454
//! let program = args[0].clone();
5555
//!
56-
//! let opts = ~[
56+
//! let opts = [
5757
//! optopt("o", "", "set output file name", "NAME"),
5858
//! optflag("h", "help", "print this help menu")
5959
//! ];

src/libglob/lib.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@
3131
html_favicon_url = "http://www.rust-lang.org/favicon.ico",
3232
html_root_url = "http://static.rust-lang.org/doc/master")]
3333

34+
#![deny(deprecated_owned_vector)]
35+
3436
use std::cell::Cell;
3537
use std::{cmp, os, path};
3638
use std::io::fs;
@@ -245,26 +247,26 @@ impl Pattern {
245247
*/
246248
pub fn new(pattern: &str) -> Pattern {
247249

248-
let chars = pattern.chars().collect::<~[_]>();
250+
let chars = pattern.chars().collect::<Vec<_>>();
249251
let mut tokens = Vec::new();
250252
let mut i = 0;
251253

252254
while i < chars.len() {
253-
match chars[i] {
255+
match *chars.get(i) {
254256
'?' => {
255257
tokens.push(AnyChar);
256258
i += 1;
257259
}
258260
'*' => {
259261
// *, **, ***, ****, ... are all equivalent
260-
while i < chars.len() && chars[i] == '*' {
262+
while i < chars.len() && *chars.get(i) == '*' {
261263
i += 1;
262264
}
263265
tokens.push(AnySequence);
264266
}
265267
'[' => {
266268

267-
if i <= chars.len() - 4 && chars[i + 1] == '!' {
269+
if i <= chars.len() - 4 && *chars.get(i + 1) == '!' {
268270
match chars.slice_from(i + 3).position_elem(&']') {
269271
None => (),
270272
Some(j) => {
@@ -276,7 +278,7 @@ impl Pattern {
276278
}
277279
}
278280
}
279-
else if i <= chars.len() - 3 && chars[i + 1] != '!' {
281+
else if i <= chars.len() - 3 && *chars.get(i + 1) != '!' {
280282
match chars.slice_from(i + 2).position_elem(&']') {
281283
None => (),
282284
Some(j) => {

src/libgreen/basic.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,30 +27,30 @@ pub fn event_loop() -> ~EventLoop:Send {
2727
}
2828

2929
struct BasicLoop {
30-
work: ~[proc():Send], // pending work
30+
work: Vec<proc():Send>, // pending work
3131
idle: Option<*mut BasicPausable>, // only one is allowed
32-
remotes: ~[(uint, ~Callback:Send)],
32+
remotes: Vec<(uint, ~Callback:Send)>,
3333
next_remote: uint,
34-
messages: Exclusive<~[Message]>,
34+
messages: Exclusive<Vec<Message>>,
3535
}
3636

3737
enum Message { RunRemote(uint), RemoveRemote(uint) }
3838

3939
impl BasicLoop {
4040
fn new() -> BasicLoop {
4141
BasicLoop {
42-
work: ~[],
42+
work: vec![],
4343
idle: None,
4444
next_remote: 0,
45-
remotes: ~[],
46-
messages: Exclusive::new(~[]),
45+
remotes: vec![],
46+
messages: Exclusive::new(vec![]),
4747
}
4848
}
4949

5050
/// Process everything in the work queue (continually)
5151
fn work(&mut self) {
5252
while self.work.len() > 0 {
53-
for work in replace(&mut self.work, ~[]).move_iter() {
53+
for work in replace(&mut self.work, vec![]).move_iter() {
5454
work();
5555
}
5656
}
@@ -60,7 +60,7 @@ impl BasicLoop {
6060
let messages = unsafe {
6161
self.messages.with(|messages| {
6262
if messages.len() > 0 {
63-
Some(replace(messages, ~[]))
63+
Some(replace(messages, vec![]))
6464
} else {
6565
None
6666
}
@@ -165,12 +165,12 @@ impl EventLoop for BasicLoop {
165165
}
166166

167167
struct BasicRemote {
168-
queue: Exclusive<~[Message]>,
168+
queue: Exclusive<Vec<Message>>,
169169
id: uint,
170170
}
171171

172172
impl BasicRemote {
173-
fn new(queue: Exclusive<~[Message]>, id: uint) -> BasicRemote {
173+
fn new(queue: Exclusive<Vec<Message>>, id: uint) -> BasicRemote {
174174
BasicRemote { queue: queue, id: id }
175175
}
176176
}

src/libgreen/lib.rs

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,7 @@
195195
// NB this does *not* include globs, please keep it that way.
196196
#![feature(macro_rules, phase)]
197197
#![allow(visible_private_types)]
198+
#![deny(deprecated_owned_vector)]
198199

199200
#[cfg(test)] #[phase(syntax, link)] extern crate log;
200201
#[cfg(test)] extern crate rustuv;
@@ -209,7 +210,6 @@ use std::rt;
209210
use std::sync::atomics::{SeqCst, AtomicUint, INIT_ATOMIC_UINT};
210211
use std::sync::deque;
211212
use std::task::TaskOpts;
212-
use std::slice;
213213
use std::sync::arc::UnsafeArc;
214214

215215
use sched::{Shutdown, Scheduler, SchedHandle, TaskFromFriend, NewNeighbor};
@@ -318,9 +318,9 @@ impl PoolConfig {
318318
/// used to keep the pool alive and also reap the status from the pool.
319319
pub struct SchedPool {
320320
id: uint,
321-
threads: ~[Thread<()>],
322-
handles: ~[SchedHandle],
323-
stealers: ~[deque::Stealer<~task::GreenTask>],
321+
threads: Vec<Thread<()>>,
322+
handles: Vec<SchedHandle>,
323+
stealers: Vec<deque::Stealer<~task::GreenTask>>,
324324
next_friend: uint,
325325
stack_pool: StackPool,
326326
deque_pool: deque::BufferPool<~task::GreenTask>,
@@ -356,9 +356,9 @@ impl SchedPool {
356356
// The pool of schedulers that will be returned from this function
357357
let (p, state) = TaskState::new();
358358
let mut pool = SchedPool {
359-
threads: ~[],
360-
handles: ~[],
361-
stealers: ~[],
359+
threads: vec![],
360+
handles: vec![],
361+
stealers: vec![],
362362
id: unsafe { POOL_ID.fetch_add(1, SeqCst) },
363363
sleepers: SleeperList::new(),
364364
stack_pool: StackPool::new(),
@@ -371,8 +371,14 @@ impl SchedPool {
371371

372372
// Create a work queue for each scheduler, ntimes. Create an extra
373373
// for the main thread if that flag is set. We won't steal from it.
374-
let arr = slice::from_fn(nscheds, |_| pool.deque_pool.deque());
375-
let (workers, stealers) = slice::unzip(arr.move_iter());
374+
let mut workers = Vec::with_capacity(nscheds);
375+
let mut stealers = Vec::with_capacity(nscheds);
376+
377+
for _ in range(0, nscheds) {
378+
let (w, s) = pool.deque_pool.deque();
379+
workers.push(w);
380+
stealers.push(s);
381+
}
376382
pool.stealers = stealers;
377383

378384
// Now that we've got all our work queues, create one scheduler per
@@ -420,7 +426,7 @@ impl SchedPool {
420426
}
421427

422428
// Jettison the task away!
423-
self.handles[idx].send(TaskFromFriend(task));
429+
self.handles.get_mut(idx).send(TaskFromFriend(task));
424430
}
425431

426432
/// Spawns a new scheduler into this M:N pool. A handle is returned to the
@@ -466,7 +472,7 @@ impl SchedPool {
466472
/// This only waits for all tasks in *this pool* of schedulers to exit, any
467473
/// native tasks or extern pools will not be waited on
468474
pub fn shutdown(mut self) {
469-
self.stealers = ~[];
475+
self.stealers = vec![];
470476

471477
// Wait for everyone to exit. We may have reached a 0-task count
472478
// multiple times in the past, meaning there could be several buffered
@@ -478,10 +484,10 @@ impl SchedPool {
478484
}
479485

480486
// Now that everyone's gone, tell everything to shut down.
481-
for mut handle in replace(&mut self.handles, ~[]).move_iter() {
487+
for mut handle in replace(&mut self.handles, vec![]).move_iter() {
482488
handle.send(Shutdown);
483489
}
484-
for thread in replace(&mut self.threads, ~[]).move_iter() {
490+
for thread in replace(&mut self.threads, vec![]).move_iter() {
485491
thread.join();
486492
}
487493
}

src/libgreen/sched.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ pub struct Scheduler {
4949
work_queue: deque::Worker<~GreenTask>,
5050
/// Work queues for the other schedulers. These are created by
5151
/// cloning the core work queues.
52-
work_queues: ~[deque::Stealer<~GreenTask>],
52+
work_queues: Vec<deque::Stealer<~GreenTask>>,
5353
/// The queue of incoming messages from other schedulers.
5454
/// These are enqueued by SchedHandles after which a remote callback
5555
/// is triggered to handle the message.
@@ -125,7 +125,7 @@ impl Scheduler {
125125
pub fn new(pool_id: uint,
126126
event_loop: ~EventLoop:Send,
127127
work_queue: deque::Worker<~GreenTask>,
128-
work_queues: ~[deque::Stealer<~GreenTask>],
128+
work_queues: Vec<deque::Stealer<~GreenTask>>,
129129
sleeper_list: SleeperList,
130130
state: TaskState)
131131
-> Scheduler {
@@ -138,7 +138,7 @@ impl Scheduler {
138138
pub fn new_special(pool_id: uint,
139139
event_loop: ~EventLoop:Send,
140140
work_queue: deque::Worker<~GreenTask>,
141-
work_queues: ~[deque::Stealer<~GreenTask>],
141+
work_queues: Vec<deque::Stealer<~GreenTask>>,
142142
sleeper_list: SleeperList,
143143
run_anything: bool,
144144
friend: Option<SchedHandle>,
@@ -502,7 +502,7 @@ impl Scheduler {
502502
let len = work_queues.len();
503503
let start_index = self.rng.gen_range(0, len);
504504
for index in range(0, len).map(|i| (i + start_index) % len) {
505-
match work_queues[index].steal() {
505+
match work_queues.get_mut(index).steal() {
506506
deque::Data(task) => {
507507
rtdebug!("found task by stealing");
508508
return Some(task)
@@ -1137,7 +1137,7 @@ mod test {
11371137
let mut pool = BufferPool::new();
11381138
let (normal_worker, normal_stealer) = pool.deque();
11391139
let (special_worker, special_stealer) = pool.deque();
1140-
let queues = ~[normal_stealer, special_stealer];
1140+
let queues = vec![normal_stealer, special_stealer];
11411141
let (_p, state) = TaskState::new();
11421142

11431143
// Our normal scheduler
@@ -1326,7 +1326,7 @@ mod test {
13261326
#[test]
13271327
fn multithreading() {
13281328
run(proc() {
1329-
let mut rxs = ~[];
1329+
let mut rxs = vec![];
13301330
for _ in range(0, 10) {
13311331
let (tx, rx) = channel();
13321332
spawn(proc() {

src/libgreen/stack.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,13 +126,13 @@ impl Drop for Stack {
126126
pub struct StackPool {
127127
// Ideally this would be some datastructure that preserved ordering on
128128
// Stack.min_size.
129-
stacks: ~[Stack],
129+
stacks: Vec<Stack>,
130130
}
131131

132132
impl StackPool {
133133
pub fn new() -> StackPool {
134134
StackPool {
135-
stacks: ~[],
135+
stacks: vec![],
136136
}
137137
}
138138

src/liblibc/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ pub use types::os::arch::c95::{c_ushort, clock_t, ptrdiff_t};
146146
pub use types::os::arch::c95::{size_t, time_t};
147147
pub use types::os::arch::c99::{c_longlong, c_ulonglong, intptr_t};
148148
pub use types::os::arch::c99::{uintptr_t};
149-
pub use types::os::arch::posix88::{dev_t, dirent_t, ino_t, mode_t};
149+
pub use types::os::arch::posix88::{dev_t, ino_t, mode_t};
150150
pub use types::os::arch::posix88::{off_t, pid_t, ssize_t};
151151

152152
pub use consts::os::c95::{_IOFBF, _IOLBF, _IONBF, BUFSIZ, EOF};

src/libnative/io/file_unix.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -340,11 +340,11 @@ pub fn mkdir(p: &CString, mode: io::FilePermission) -> IoResult<()> {
340340
}))
341341
}
342342

343-
pub fn readdir(p: &CString) -> IoResult<~[Path]> {
343+
pub fn readdir(p: &CString) -> IoResult<Vec<Path>> {
344344
use libc::{dirent_t};
345345
use libc::{opendir, readdir_r, closedir};
346346

347-
fn prune(root: &CString, dirs: ~[Path]) -> ~[Path] {
347+
fn prune(root: &CString, dirs: Vec<Path>) -> Vec<Path> {
348348
let root = unsafe { CString::new(root.with_ref(|p| p), false) };
349349
let root = Path::new(root);
350350

@@ -365,7 +365,7 @@ pub fn readdir(p: &CString) -> IoResult<~[Path]> {
365365
let dir_ptr = p.with_ref(|buf| unsafe { opendir(buf) });
366366

367367
if dir_ptr as uint != 0 {
368-
let mut paths = ~[];
368+
let mut paths = vec!();
369369
let mut entry_ptr = 0 as *mut dirent_t;
370370
while unsafe { readdir_r(dir_ptr, ptr, &mut entry_ptr) == 0 } {
371371
if entry_ptr.is_null() { break }
@@ -571,4 +571,3 @@ mod tests {
571571
}
572572
}
573573
}
574-

src/libnative/io/file_win32.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -323,10 +323,10 @@ pub fn mkdir(p: &CString, _mode: io::FilePermission) -> IoResult<()> {
323323
})
324324
}
325325

326-
pub fn readdir(p: &CString) -> IoResult<~[Path]> {
327-
use rt::global_heap::malloc_raw;
326+
pub fn readdir(p: &CString) -> IoResult<Vec<Path>> {
327+
use std::rt::global_heap::malloc_raw;
328328

329-
fn prune(root: &CString, dirs: ~[Path]) -> ~[Path] {
329+
fn prune(root: &CString, dirs: Vec<Path>) -> Vec<Path> {
330330
let root = unsafe { CString::new(root.with_ref(|p| p), false) };
331331
let root = Path::new(root);
332332

@@ -346,7 +346,7 @@ pub fn readdir(p: &CString) -> IoResult<~[Path]> {
346346
let wfd_ptr = malloc_raw(rust_list_dir_wfd_size() as uint);
347347
let find_handle = libc::FindFirstFileW(path_ptr, wfd_ptr as libc::HANDLE);
348348
if find_handle as libc::c_int != libc::INVALID_HANDLE_VALUE {
349-
let mut paths = ~[];
349+
let mut paths = vec!();
350350
let mut more_files = 1 as libc::c_int;
351351
while more_files != 0 {
352352
let fp_buf = rust_list_dir_wfd_fp_buf(wfd_ptr as *c_void);

src/libnative/io/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ impl rtio::IoFactory for IoFactory {
217217
fn fs_rename(&mut self, path: &CString, to: &CString) -> IoResult<()> {
218218
file::rename(path, to)
219219
}
220-
fn fs_readdir(&mut self, path: &CString, _flags: c_int) -> IoResult<~[Path]> {
220+
fn fs_readdir(&mut self, path: &CString, _flags: c_int) -> IoResult<Vec<Path>> {
221221
file::readdir(path)
222222
}
223223
fn fs_lstat(&mut self, path: &CString) -> IoResult<io::FileStat> {

src/libnative/io/p

Whitespace-only changes.

0 commit comments

Comments
 (0)