Skip to content

Commit

Permalink
auto merge of #13443 : alexcrichton/rust/rollup, r=alexcrichton
Browse files Browse the repository at this point in the history
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>.)
  • Loading branch information
bors committed Apr 10, 2014
2 parents 5bcb761 + 1f2c18a commit 0156af1
Show file tree
Hide file tree
Showing 107 changed files with 1,127 additions and 648 deletions.
1 change: 1 addition & 0 deletions mk/docs.mk
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,7 @@ LIB_DOC_DEP_$(1) = $$(CRATEFILE_$(1)) $$(RSINPUTS_$(1))
endif

$(2) += doc/$(1)/index.html
doc/$(1)/index.html: CFG_COMPILER_HOST_TRIPLE = $(CFG_TARGET)
doc/$(1)/index.html: $$(LIB_DOC_DEP_$(1))
@$$(call E, rustdoc $$@)
$$(Q)$$(RUSTDOC) --cfg dox --cfg stage2 $$<
Expand Down
4 changes: 0 additions & 4 deletions mk/main.mk
Original file line number Diff line number Diff line change
Expand Up @@ -358,17 +358,13 @@ CFGFLAG$(1)_T_$(2)_H_$(3) = stage1
endif
endif

ifdef CFG_DISABLE_RPATH
ifeq ($$(OSTYPE_$(3)),apple-darwin)
RPATH_VAR$(1)_T_$(2)_H_$(3) := \
DYLD_LIBRARY_PATH="$$$$DYLD_LIBRARY_PATH:$$(CURDIR)/$$(HLIB$(1)_H_$(3))"
else
RPATH_VAR$(1)_T_$(2)_H_$(3) := \
LD_LIBRARY_PATH="$$$$LD_LIBRARY_PATH:$$(CURDIR)/$$(HLIB$(1)_H_$(3))"
endif
else
RPATH_VAR$(1)_T_$(2)_H_$(3) :=
endif

STAGE$(1)_T_$(2)_H_$(3) := \
$$(Q)$$(RPATH_VAR$(1)_T_$(2)_H_$(3)) \
Expand Down
2 changes: 1 addition & 1 deletion src/compiletest/runtest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ fn run_debuginfo_test(config: &config, props: &TestProps, testfile: &Path) {
let options_to_remove = [~"-O", ~"-g", ~"--debuginfo"];
let new_options = split_maybe_args(options).move_iter()
.filter(|x| !options_to_remove.contains(x))
.collect::<~[~str]>()
.collect::<Vec<~str>>()
.connect(" ");
Some(new_options)
}
Expand Down
4 changes: 2 additions & 2 deletions src/libflate/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,13 +117,13 @@ mod tests {
words.push(r.gen_vec::<u8>(range));
}
for _ in range(0, 20) {
let mut input = ~[];
let mut input = vec![];
for _ in range(0, 2000) {
input.push_all(r.choose(words.as_slice()).as_slice());
}
debug!("de/inflate of {} bytes of random word-sequences",
input.len());
let cmp = deflate_bytes(input).expect("deflation failed");
let cmp = deflate_bytes(input.as_slice()).expect("deflation failed");
let out = inflate_bytes(cmp.as_slice()).expect("inflation failed");
debug!("{} bytes deflated to {} ({:.1f}% size)",
input.len(), cmp.len(),
Expand Down
2 changes: 1 addition & 1 deletion src/libgetopts/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
//!
//! let program = args[0].clone();
//!
//! let opts = ~[
//! let opts = [
//! optopt("o", "", "set output file name", "NAME"),
//! optflag("h", "help", "print this help menu")
//! ];
Expand Down
12 changes: 7 additions & 5 deletions src/libglob/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
html_favicon_url = "http://www.rust-lang.org/favicon.ico",
html_root_url = "http://static.rust-lang.org/doc/master")]

#![deny(deprecated_owned_vector)]

use std::cell::Cell;
use std::{cmp, os, path};
use std::io::fs;
Expand Down Expand Up @@ -245,26 +247,26 @@ impl Pattern {
*/
pub fn new(pattern: &str) -> Pattern {

let chars = pattern.chars().collect::<~[_]>();
let chars = pattern.chars().collect::<Vec<_>>();
let mut tokens = Vec::new();
let mut i = 0;

while i < chars.len() {
match chars[i] {
match *chars.get(i) {
'?' => {
tokens.push(AnyChar);
i += 1;
}
'*' => {
// *, **, ***, ****, ... are all equivalent
while i < chars.len() && chars[i] == '*' {
while i < chars.len() && *chars.get(i) == '*' {
i += 1;
}
tokens.push(AnySequence);
}
'[' => {

if i <= chars.len() - 4 && chars[i + 1] == '!' {
if i <= chars.len() - 4 && *chars.get(i + 1) == '!' {
match chars.slice_from(i + 3).position_elem(&']') {
None => (),
Some(j) => {
Expand All @@ -276,7 +278,7 @@ impl Pattern {
}
}
}
else if i <= chars.len() - 3 && chars[i + 1] != '!' {
else if i <= chars.len() - 3 && *chars.get(i + 1) != '!' {
match chars.slice_from(i + 2).position_elem(&']') {
None => (),
Some(j) => {
Expand Down
20 changes: 10 additions & 10 deletions src/libgreen/basic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,30 +27,30 @@ pub fn event_loop() -> ~EventLoop:Send {
}

struct BasicLoop {
work: ~[proc():Send], // pending work
work: Vec<proc():Send>, // pending work
idle: Option<*mut BasicPausable>, // only one is allowed
remotes: ~[(uint, ~Callback:Send)],
remotes: Vec<(uint, ~Callback:Send)>,
next_remote: uint,
messages: Exclusive<~[Message]>,
messages: Exclusive<Vec<Message>>,
}

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

impl BasicLoop {
fn new() -> BasicLoop {
BasicLoop {
work: ~[],
work: vec![],
idle: None,
next_remote: 0,
remotes: ~[],
messages: Exclusive::new(~[]),
remotes: vec![],
messages: Exclusive::new(vec![]),
}
}

/// Process everything in the work queue (continually)
fn work(&mut self) {
while self.work.len() > 0 {
for work in replace(&mut self.work, ~[]).move_iter() {
for work in replace(&mut self.work, vec![]).move_iter() {
work();
}
}
Expand All @@ -60,7 +60,7 @@ impl BasicLoop {
let messages = unsafe {
self.messages.with(|messages| {
if messages.len() > 0 {
Some(replace(messages, ~[]))
Some(replace(messages, vec![]))
} else {
None
}
Expand Down Expand Up @@ -165,12 +165,12 @@ impl EventLoop for BasicLoop {
}

struct BasicRemote {
queue: Exclusive<~[Message]>,
queue: Exclusive<Vec<Message>>,
id: uint,
}

impl BasicRemote {
fn new(queue: Exclusive<~[Message]>, id: uint) -> BasicRemote {
fn new(queue: Exclusive<Vec<Message>>, id: uint) -> BasicRemote {
BasicRemote { queue: queue, id: id }
}
}
Expand Down
32 changes: 19 additions & 13 deletions src/libgreen/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@
// NB this does *not* include globs, please keep it that way.
#![feature(macro_rules, phase)]
#![allow(visible_private_types)]
#![deny(deprecated_owned_vector)]

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

use sched::{Shutdown, Scheduler, SchedHandle, TaskFromFriend, NewNeighbor};
Expand Down Expand Up @@ -318,9 +318,9 @@ impl PoolConfig {
/// used to keep the pool alive and also reap the status from the pool.
pub struct SchedPool {
id: uint,
threads: ~[Thread<()>],
handles: ~[SchedHandle],
stealers: ~[deque::Stealer<~task::GreenTask>],
threads: Vec<Thread<()>>,
handles: Vec<SchedHandle>,
stealers: Vec<deque::Stealer<~task::GreenTask>>,
next_friend: uint,
stack_pool: StackPool,
deque_pool: deque::BufferPool<~task::GreenTask>,
Expand Down Expand Up @@ -356,9 +356,9 @@ impl SchedPool {
// The pool of schedulers that will be returned from this function
let (p, state) = TaskState::new();
let mut pool = SchedPool {
threads: ~[],
handles: ~[],
stealers: ~[],
threads: vec![],
handles: vec![],
stealers: vec![],
id: unsafe { POOL_ID.fetch_add(1, SeqCst) },
sleepers: SleeperList::new(),
stack_pool: StackPool::new(),
Expand All @@ -371,8 +371,14 @@ impl SchedPool {

// Create a work queue for each scheduler, ntimes. Create an extra
// for the main thread if that flag is set. We won't steal from it.
let arr = slice::from_fn(nscheds, |_| pool.deque_pool.deque());
let (workers, stealers) = slice::unzip(arr.move_iter());
let mut workers = Vec::with_capacity(nscheds);
let mut stealers = Vec::with_capacity(nscheds);

for _ in range(0, nscheds) {
let (w, s) = pool.deque_pool.deque();
workers.push(w);
stealers.push(s);
}
pool.stealers = stealers;

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

// Jettison the task away!
self.handles[idx].send(TaskFromFriend(task));
self.handles.get_mut(idx).send(TaskFromFriend(task));
}

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

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

// Now that everyone's gone, tell everything to shut down.
for mut handle in replace(&mut self.handles, ~[]).move_iter() {
for mut handle in replace(&mut self.handles, vec![]).move_iter() {
handle.send(Shutdown);
}
for thread in replace(&mut self.threads, ~[]).move_iter() {
for thread in replace(&mut self.threads, vec![]).move_iter() {
thread.join();
}
}
Expand Down
12 changes: 6 additions & 6 deletions src/libgreen/sched.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ pub struct Scheduler {
work_queue: deque::Worker<~GreenTask>,
/// Work queues for the other schedulers. These are created by
/// cloning the core work queues.
work_queues: ~[deque::Stealer<~GreenTask>],
work_queues: Vec<deque::Stealer<~GreenTask>>,
/// The queue of incoming messages from other schedulers.
/// These are enqueued by SchedHandles after which a remote callback
/// is triggered to handle the message.
Expand Down Expand Up @@ -125,7 +125,7 @@ impl Scheduler {
pub fn new(pool_id: uint,
event_loop: ~EventLoop:Send,
work_queue: deque::Worker<~GreenTask>,
work_queues: ~[deque::Stealer<~GreenTask>],
work_queues: Vec<deque::Stealer<~GreenTask>>,
sleeper_list: SleeperList,
state: TaskState)
-> Scheduler {
Expand All @@ -138,7 +138,7 @@ impl Scheduler {
pub fn new_special(pool_id: uint,
event_loop: ~EventLoop:Send,
work_queue: deque::Worker<~GreenTask>,
work_queues: ~[deque::Stealer<~GreenTask>],
work_queues: Vec<deque::Stealer<~GreenTask>>,
sleeper_list: SleeperList,
run_anything: bool,
friend: Option<SchedHandle>,
Expand Down Expand Up @@ -502,7 +502,7 @@ impl Scheduler {
let len = work_queues.len();
let start_index = self.rng.gen_range(0, len);
for index in range(0, len).map(|i| (i + start_index) % len) {
match work_queues[index].steal() {
match work_queues.get_mut(index).steal() {
deque::Data(task) => {
rtdebug!("found task by stealing");
return Some(task)
Expand Down Expand Up @@ -1137,7 +1137,7 @@ mod test {
let mut pool = BufferPool::new();
let (normal_worker, normal_stealer) = pool.deque();
let (special_worker, special_stealer) = pool.deque();
let queues = ~[normal_stealer, special_stealer];
let queues = vec![normal_stealer, special_stealer];
let (_p, state) = TaskState::new();

// Our normal scheduler
Expand Down Expand Up @@ -1326,7 +1326,7 @@ mod test {
#[test]
fn multithreading() {
run(proc() {
let mut rxs = ~[];
let mut rxs = vec![];
for _ in range(0, 10) {
let (tx, rx) = channel();
spawn(proc() {
Expand Down
4 changes: 2 additions & 2 deletions src/libgreen/stack.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,13 +126,13 @@ impl Drop for Stack {
pub struct StackPool {
// Ideally this would be some datastructure that preserved ordering on
// Stack.min_size.
stacks: ~[Stack],
stacks: Vec<Stack>,
}

impl StackPool {
pub fn new() -> StackPool {
StackPool {
stacks: ~[],
stacks: vec![],
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/liblibc/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ pub use types::os::arch::c95::{c_ushort, clock_t, ptrdiff_t};
pub use types::os::arch::c95::{size_t, time_t};
pub use types::os::arch::c99::{c_longlong, c_ulonglong, intptr_t};
pub use types::os::arch::c99::{uintptr_t};
pub use types::os::arch::posix88::{dev_t, dirent_t, ino_t, mode_t};
pub use types::os::arch::posix88::{dev_t, ino_t, mode_t};
pub use types::os::arch::posix88::{off_t, pid_t, ssize_t};

pub use consts::os::c95::{_IOFBF, _IOLBF, _IONBF, BUFSIZ, EOF};
Expand Down
7 changes: 3 additions & 4 deletions src/libnative/io/file_unix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -340,11 +340,11 @@ pub fn mkdir(p: &CString, mode: io::FilePermission) -> IoResult<()> {
}))
}

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

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

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

if dir_ptr as uint != 0 {
let mut paths = ~[];
let mut paths = vec!();
let mut entry_ptr = 0 as *mut dirent_t;
while unsafe { readdir_r(dir_ptr, ptr, &mut entry_ptr) == 0 } {
if entry_ptr.is_null() { break }
Expand Down Expand Up @@ -571,4 +571,3 @@ mod tests {
}
}
}

8 changes: 4 additions & 4 deletions src/libnative/io/file_win32.rs
Original file line number Diff line number Diff line change
Expand Up @@ -323,10 +323,10 @@ pub fn mkdir(p: &CString, _mode: io::FilePermission) -> IoResult<()> {
})
}

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

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

Expand All @@ -346,7 +346,7 @@ pub fn readdir(p: &CString) -> IoResult<~[Path]> {
let wfd_ptr = malloc_raw(rust_list_dir_wfd_size() as uint);
let find_handle = libc::FindFirstFileW(path_ptr, wfd_ptr as libc::HANDLE);
if find_handle as libc::c_int != libc::INVALID_HANDLE_VALUE {
let mut paths = ~[];
let mut paths = vec!();
let mut more_files = 1 as libc::c_int;
while more_files != 0 {
let fp_buf = rust_list_dir_wfd_fp_buf(wfd_ptr as *c_void);
Expand Down
2 changes: 1 addition & 1 deletion src/libnative/io/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ impl rtio::IoFactory for IoFactory {
fn fs_rename(&mut self, path: &CString, to: &CString) -> IoResult<()> {
file::rename(path, to)
}
fn fs_readdir(&mut self, path: &CString, _flags: c_int) -> IoResult<~[Path]> {
fn fs_readdir(&mut self, path: &CString, _flags: c_int) -> IoResult<Vec<Path>> {
file::readdir(path)
}
fn fs_lstat(&mut self, path: &CString) -> IoResult<io::FileStat> {
Expand Down
Empty file removed src/libnative/io/p
Empty file.
Loading

0 comments on commit 0156af1

Please sign in to comment.