Skip to content

Commit

Permalink
Remove cfg(rayon_unstable)
Browse files Browse the repository at this point in the history
  • Loading branch information
cuviper committed Dec 19, 2019
1 parent 198ca7f commit 1f9d117
Show file tree
Hide file tree
Showing 11 changed files with 3 additions and 396 deletions.
24 changes: 2 additions & 22 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ matrix:
fast_finish: true
include:
# NB: To help with CI delays, each `pull_request` is only tested on Linux,
# with 1.31 for compatibility and stable+rayon_unstable for broad test
# coverage. The bors bot counts as a `push` type, which will run it all.
# with 1.31 for compatibility and stable for broad test coverage. The bors
# bot counts as a `push` type, which will run it all.

- rust: 1.31.0
os: linux
Expand All @@ -20,43 +20,23 @@ matrix:

- rust: stable
os: linux
if: NOT type = pull_request
- rust: stable
os: linux
env: RUSTFLAGS='--cfg rayon_unstable'
#if: everything!

- rust: beta
os: linux
if: NOT type = pull_request
- rust: beta
os: linux
env: RUSTFLAGS='--cfg rayon_unstable'
if: NOT type = pull_request

- rust: nightly
os: linux
if: NOT type = pull_request
- rust: nightly
os: linux
env: RUSTFLAGS='--cfg rayon_unstable'
if: NOT type = pull_request

- rust: stable
os: osx
if: NOT type = pull_request
- rust: stable
os: osx
env: RUSTFLAGS='--cfg rayon_unstable'
if: NOT type = pull_request

- rust: nightly
os: osx
if: NOT type = pull_request
- rust: nightly
os: osx
env: RUSTFLAGS='--cfg rayon_unstable'
if: NOT type = pull_request

# wasm won't actually work without threading, but it builds
- rust: nightly
Expand Down
7 changes: 0 additions & 7 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,8 @@ environment:
matrix:
- TARGET: x86_64-pc-windows-gnu
CHANNEL: stable
- TARGET: x86_64-pc-windows-gnu
CHANNEL: stable
RUSTFLAGS: --cfg rayon_unstable

- TARGET: x86_64-pc-windows-msvc
CHANNEL: stable
- TARGET: x86_64-pc-windows-msvc
CHANNEL: stable
RUSTFLAGS: --cfg rayon_unstable

install:
- curl -sSf -o rustup-init.exe https://win.rustup.rs
Expand Down
8 changes: 0 additions & 8 deletions rayon-core/src/internal/mod.rs

This file was deleted.

83 changes: 0 additions & 83 deletions rayon-core/src/internal/task.rs

This file was deleted.

67 changes: 0 additions & 67 deletions rayon-core/src/internal/worker.rs

This file was deleted.

5 changes: 1 addition & 4 deletions rayon-core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ use std::io;
use std::marker::PhantomData;
use std::str::FromStr;

#[cfg(any(debug_assertions, rayon_unstable))]
#[cfg(any(debug_assertions))]
#[macro_use]
extern crate lazy_static;

Expand All @@ -55,9 +55,6 @@ mod util;
mod compile_fail;
mod test;

#[cfg(rayon_unstable)]
pub mod internal;

pub use self::join::{join, join_context};
pub use self::registry::ThreadBuilder;
pub use self::scope::{scope, Scope};
Expand Down
56 changes: 0 additions & 56 deletions rayon-core/src/registry.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
use crossbeam_deque::{Steal, Stealer, Worker};
use crossbeam_queue::SegQueue;
#[cfg(rayon_unstable)]
use crate::internal::task::Task;
#[cfg(rayon_unstable)]
use crate::job::Job;
use crate::job::{JobFifo, JobRef, StackJob};
use crate::latch::{CountLatch, Latch, LatchProbe, LockLatch, SpinLatch, TickleLatch};
use crate::log::Event::*;
Expand Down Expand Up @@ -267,11 +263,6 @@ impl Registry {
Ok(registry.clone())
}

#[cfg(rayon_unstable)]
pub(super) fn global() -> Arc<Registry> {
global_registry().clone()
}

pub(super) fn current() -> Arc<Registry> {
unsafe {
let worker_thread = WorkerThread::current();
Expand Down Expand Up @@ -377,53 +368,6 @@ impl Registry {
}
}

/// Unsafe: the caller must guarantee that `task` will stay valid
/// until it executes.
#[cfg(rayon_unstable)]
pub(super) unsafe fn submit_task<T>(&self, task: Arc<T>)
where
T: Task,
{
let task_job = TaskJob::new(task);
let task_job_ref = TaskJob::into_job_ref(task_job);
return self.inject_or_push(task_job_ref);

/// A little newtype wrapper for `T`, just because I did not
/// want to implement `Job` for all `T: Task`.
struct TaskJob<T: Task> {
_data: T,
}

impl<T: Task> TaskJob<T> {
fn new(arc: Arc<T>) -> Arc<Self> {
// `TaskJob<T>` has the same layout as `T`, so we can safely
// tranmsute this `T` into a `TaskJob<T>`. This lets us write our
// impls of `Job` for `TaskJob<T>`, making them more restricted.
// Since `Job` is a private trait, this is not strictly necessary,
// I don't think, but makes me feel better.
unsafe { mem::transmute(arc) }
}

fn into_task(this: Arc<TaskJob<T>>) -> Arc<T> {
// Same logic as `new()`
unsafe { mem::transmute(this) }
}

unsafe fn into_job_ref(this: Arc<Self>) -> JobRef {
let this: *const Self = mem::transmute(this);
JobRef::new(this)
}
}

impl<T: Task> Job for TaskJob<T> {
unsafe fn execute(this: *const Self) {
let this: Arc<Self> = mem::transmute(this);
let task: Arc<T> = TaskJob::into_task(this);
Task::execute(task);
}
}
}

/// Push a job into the "external jobs" queue; it will be taken by
/// whatever worker has nothing to do. Use this is you know that
/// you are not on a worker of this registry.
Expand Down
61 changes: 0 additions & 61 deletions rayon-core/src/scope/internal.rs

This file was deleted.

1 change: 0 additions & 1 deletion rayon-core/src/scope/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ use std::sync::atomic::{AtomicPtr, Ordering};
use std::sync::Arc;
use crate::unwind;

mod internal;
#[cfg(test)]
mod test;

Expand Down
Loading

0 comments on commit 1f9d117

Please sign in to comment.