Skip to content

sync: Bring the library up to date #12900

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 11 commits into from
1 change: 0 additions & 1 deletion src/compiletest/compiletest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
#[feature(phase)];

#[allow(non_camel_case_types)];
#[allow(deprecated_owned_vector)]; // NOTE: remove after stage0
#[deny(warnings)];

extern crate test;
Expand Down
4 changes: 2 additions & 2 deletions src/doc/guide-tasks.md
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ fn main() {

spawn(proc() {
let local_arc : Arc<~[f64]> = rx.recv();
let task_numbers = local_arc.get();
let task_numbers = &*local_arc;
println!("{}-norm = {}", num, pnorm(task_numbers, num));
});
}
Expand Down Expand Up @@ -411,7 +411,7 @@ Each task recovers the underlying data by
# let (tx, rx) = channel();
# tx.send(numbers_arc.clone());
# let local_arc : Arc<~[f64]> = rx.recv();
let task_numbers = local_arc.get();
let task_numbers = &*local_arc;
# }
~~~

Expand Down
5 changes: 0 additions & 5 deletions src/driver/driver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,4 @@ extern crate this = "rustdoc";
#[cfg(rustc)]
extern crate this = "rustc";

#[cfg(not(stage0))]
fn main() { this::main() }

#[cfg(stage0)]
#[start]
fn start(argc: int, argv: **u8) -> int { native::start(argc, argv, this::main) }
2 changes: 1 addition & 1 deletion src/etc/licenseck.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"libstd/sync/mpsc_queue.rs", # BSD
"libstd/sync/spsc_queue.rs", # BSD
"libstd/sync/mpmc_bounded_queue.rs", # BSD
"libsync/sync/mpsc_intrusive.rs", # BSD
"libsync/mpsc_intrusive.rs", # BSD
]

def check_license(name, contents):
Expand Down
10 changes: 0 additions & 10 deletions src/libgreen/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -207,16 +207,6 @@ pub mod sleeper_list;
pub mod stack;
pub mod task;

#[lang = "start"]
#[cfg(not(test), stage0)]
pub fn lang_start(main: *u8, argc: int, argv: **u8) -> int {
use std::cast;
start(argc, argv, proc() {
let main: extern "Rust" fn() = unsafe { cast::transmute(main) };
main();
})
}

/// Set up a default runtime configuration, given compiler-supplied arguments.
///
/// This function will block until the entire pool of M:N schedulers have
Expand Down
4 changes: 2 additions & 2 deletions src/libgreen/simple.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ impl Runtime for SimpleTask {
// See libnative/task.rs for what's going on here with the `awoken`
// field and the while loop around wait()
unsafe {
let mut guard = (*me).lock.lock();
let guard = (*me).lock.lock();
(*me).awoken = false;
match f(task) {
Ok(()) => {
Expand All @@ -60,7 +60,7 @@ impl Runtime for SimpleTask {
to_wake.put_runtime(self as ~Runtime);
unsafe {
cast::forget(to_wake);
let mut guard = (*me).lock.lock();
let guard = (*me).lock.lock();
(*me).awoken = true;
guard.signal();
}
Expand Down
2 changes: 1 addition & 1 deletion src/libnative/io/timer_helper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ pub fn send(req: Req) {
fn shutdown() {
// Request a shutdown, and then wait for the task to exit
unsafe {
let mut guard = TIMER_HELPER_EXIT.lock();
let guard = TIMER_HELPER_EXIT.lock();
send(Shutdown);
guard.wait();
drop(guard);
Expand Down
2 changes: 1 addition & 1 deletion src/libnative/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ static OS_DEFAULT_STACK_ESTIMATE: uint = 1 << 20;
static OS_DEFAULT_STACK_ESTIMATE: uint = 2 * (1 << 20);

#[lang = "start"]
#[cfg(not(test), not(stage0))]
#[cfg(not(test))]
pub fn lang_start(main: *u8, argc: int, argv: **u8) -> int {
use std::cast;
start(argc, argv, proc() {
Expand Down
6 changes: 3 additions & 3 deletions src/libnative/task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ impl rt::Runtime for Ops {
let task = BlockedTask::block(cur_task);

if times == 1 {
let mut guard = (*me).lock.lock();
let guard = (*me).lock.lock();
(*me).awoken = false;
match f(task) {
Ok(()) => {
Expand All @@ -202,7 +202,7 @@ impl rt::Runtime for Ops {
}
} else {
let mut iter = task.make_selectable(times);
let mut guard = (*me).lock.lock();
let guard = (*me).lock.lock();
(*me).awoken = false;
let success = iter.all(|task| {
match f(task) {
Expand Down Expand Up @@ -232,7 +232,7 @@ impl rt::Runtime for Ops {
let me = &mut *self as *mut Ops;
to_wake.put_runtime(self as ~rt::Runtime);
cast::forget(to_wake);
let mut guard = (*me).lock.lock();
let guard = (*me).lock.lock();
(*me).awoken = true;
guard.signal();
}
Expand Down
8 changes: 4 additions & 4 deletions src/librustdoc/html/format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -208,8 +208,8 @@ fn path(w: &mut io::Writer, path: &clean::Path, print_all: bool,
let loc = loc.unwrap();

local_data::get(cache_key, |cache| {
let cache = cache.unwrap().get();
let abs_root = root(cache, loc.as_slice());
let cache = cache.unwrap();
let abs_root = root(&**cache, loc.as_slice());
let rel_root = match path.segments.get(0).name.as_slice() {
"self" => Some(~"./"),
_ => None,
Expand Down Expand Up @@ -241,7 +241,7 @@ fn path(w: &mut io::Writer, path: &clean::Path, print_all: bool,
}
}

match info(cache) {
match info(&**cache) {
// This is a documented path, link to it!
Some((ref fqp, shortty)) if abs_root.is_some() => {
let mut url = abs_root.unwrap();
Expand Down Expand Up @@ -301,7 +301,7 @@ impl fmt::Show for clean::Type {
match *self {
clean::TyParamBinder(id) | clean::Generic(id) => {
local_data::get(cache_key, |cache| {
let m = cache.unwrap().get();
let m = cache.unwrap();
f.buf.write(m.typarams.get(&id).as_bytes())
})
}
Expand Down
8 changes: 4 additions & 4 deletions src/librustdoc/html/render.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1265,7 +1265,7 @@ fn item_trait(w: &mut Writer, it: &clean::Item,
}

local_data::get(cache_key, |cache| {
let cache = cache.unwrap().get();
let cache = cache.unwrap();
match cache.implementors.find(&it.id) {
Some(implementors) => {
try!(write!(w, "
Expand Down Expand Up @@ -1496,7 +1496,7 @@ fn render_struct(w: &mut Writer, it: &clean::Item,

fn render_methods(w: &mut Writer, it: &clean::Item) -> fmt::Result {
local_data::get(cache_key, |cache| {
let c = cache.unwrap().get();
let c = cache.unwrap();
match c.impls.find(&it.id) {
Some(v) => {
let mut non_trait = v.iter().filter(|p| {
Expand Down Expand Up @@ -1576,7 +1576,7 @@ fn render_impl(w: &mut Writer, i: &clean::Impl,
Some(id) => id,
};
try!(local_data::get(cache_key, |cache| {
let cache = cache.unwrap().get();
let cache = cache.unwrap();
match cache.traits.find(&trait_id) {
Some(t) => {
let name = meth.name.clone();
Expand Down Expand Up @@ -1606,7 +1606,7 @@ fn render_impl(w: &mut Writer, i: &clean::Impl,
None => {}
Some(id) => {
try!(local_data::get(cache_key, |cache| {
let cache = cache.unwrap().get();
let cache = cache.unwrap();
match cache.traits.find(&id) {
Some(t) => {
for method in t.methods.iter() {
Expand Down
2 changes: 1 addition & 1 deletion src/libstd/comm/shared.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ pub enum Failure {
impl<T: Send> Packet<T> {
// Creation of a packet *must* be followed by a call to inherit_blocker
pub fn new() -> Packet<T> {
let mut p = Packet {
let p = Packet {
queue: mpsc::Queue::new(),
cnt: atomics::AtomicInt::new(0),
steals: 0,
Expand Down
1 change: 0 additions & 1 deletion src/libstd/intrinsics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,6 @@ pub trait TyVisitor {
fn visit_self(&mut self) -> bool;
}


extern "rust-intrinsic" {

// NB: These intrinsics take unsafe pointers because they mutate aliased
Expand Down
4 changes: 2 additions & 2 deletions src/libstd/rt/bookkeeping.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ pub fn increment() {
pub fn decrement() {
unsafe {
if TASK_COUNT.fetch_sub(1, atomics::SeqCst) == 1 {
let mut guard = TASK_LOCK.lock();
let guard = TASK_LOCK.lock();
guard.signal();
}
}
Expand All @@ -44,7 +44,7 @@ pub fn decrement() {
/// the entry points of native programs
pub fn wait_for_other_tasks() {
unsafe {
let mut guard = TASK_LOCK.lock();
let guard = TASK_LOCK.lock();
while TASK_COUNT.load(atomics::SeqCst) > 0 {
guard.wait();
}
Expand Down
6 changes: 2 additions & 4 deletions src/libstd/sync/atomics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@
//!
//! A simple spinlock:
//!
//! ```ignore
//! # // FIXME: Needs PR #12430
//! ```
//! extern crate sync;
//!
//! use sync::Arc;
Expand Down Expand Up @@ -68,8 +67,7 @@
//!
//! Transferring a heap object with `AtomicOption`:
//!
//! ```ignore
//! # // FIXME: Needs PR #12430
//! ```
//! extern crate sync;
//!
//! use sync::Arc;
Expand Down
Loading