Skip to content

Commit

Permalink
Auto merge of #53150 - kennytm:rollup, r=kennytm
Browse files Browse the repository at this point in the history
Rollup of 10 pull requests

Successful merges:

 - #52885 (Remove some unused method arguments from typeck)
 - #52886 (cleanup: Remove `Def::GlobalAsm`)
 - #53028 (Building librustc_codegen_llvm in a separate directory)
 - #53052 (fixed broken links to char)
 - #53060 (Change rustdoc style so fully qualified name does not overlap src link)
 - #53068 (Rename Executor trait to Spawn)
 - #53093 (Enable macros to pass $:literal to another macro)
 - #53107 (Remove references to `StaticMutex` which got removed a while ago)
 - #53135 (Rust 2018: Disable catch_expr, not targeted for 2018 edition)
 - #53139 (set emit_debug_gdb_scripts: false for riscv32imac-unknown-none target)
  • Loading branch information
bors committed Aug 7, 2018
2 parents 9e472c2 + d9e9230 commit 18925de
Show file tree
Hide file tree
Showing 28 changed files with 141 additions and 212 deletions.
20 changes: 0 additions & 20 deletions src/Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2184,30 +2184,10 @@ dependencies = [
name = "rustc_codegen_llvm"
version = "0.0.0"
dependencies = [
"bitflags 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
"cc 1.0.18 (registry+https://github.com/rust-lang/crates.io-index)",
"env_logger 0.5.10 (registry+https://github.com/rust-lang/crates.io-index)",
"flate2 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
"jobserver 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)",
"num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc 0.0.0",
"rustc-demangle 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc_allocator 0.0.0",
"rustc_apfloat 0.0.0",
"rustc_codegen_utils 0.0.0",
"rustc_data_structures 0.0.0",
"rustc_errors 0.0.0",
"rustc_incremental 0.0.0",
"rustc_llvm 0.0.0",
"rustc_mir 0.0.0",
"rustc_platform_intrinsics 0.0.0",
"rustc_target 0.0.0",
"serialize 0.0.0",
"syntax 0.0.0",
"syntax_pos 0.0.0",
"tempfile 3.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
]

[[package]]
Expand Down
6 changes: 4 additions & 2 deletions src/bootstrap/check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,16 +137,18 @@ impl Step for CodegenBackend {
let target = self.target;
let backend = self.backend;

let out_dir = builder.cargo_out(compiler, Mode::Codegen, target);
builder.clear_if_dirty(&out_dir, &librustc_stamp(builder, compiler, target));

let mut cargo = builder.cargo(compiler, Mode::Codegen, target, "check");
let features = builder.rustc_features().to_string();
cargo.arg("--manifest-path").arg(builder.src.join("src/librustc_codegen_llvm/Cargo.toml"));
rustc_cargo_env(builder, &mut cargo);

// We won't build LLVM if it's not available, as it shouldn't affect `check`.

let _folder = builder.fold_output(|| format!("stage{}-rustc_codegen_llvm", compiler.stage));
run_cargo(builder,
cargo.arg("--features").arg(features),
&mut cargo,
&codegen_backend_stamp(builder, compiler, target, backend),
true);
}
Expand Down
9 changes: 5 additions & 4 deletions src/bootstrap/compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -670,16 +670,17 @@ impl Step for CodegenBackend {
return;
}

let out_dir = builder.cargo_out(compiler, Mode::Codegen, target);
builder.clear_if_dirty(&out_dir, &librustc_stamp(builder, compiler, target));

let mut cargo = builder.cargo(compiler, Mode::Codegen, target, "build");
let mut features = builder.rustc_features().to_string();
cargo.arg("--manifest-path")
.arg(builder.src.join("src/librustc_codegen_llvm/Cargo.toml"));
rustc_cargo_env(builder, &mut cargo);

features += &build_codegen_backend(&builder, &mut cargo, &compiler, target, backend);
let features = build_codegen_backend(&builder, &mut cargo, &compiler, target, backend);

let tmp_stamp = builder.cargo_out(compiler, Mode::Codegen, target)
.join(".tmp.stamp");
let tmp_stamp = out_dir.join(".tmp.stamp");

let _folder = builder.fold_output(|| format!("stage{}-rustc_codegen_llvm", compiler.stage));
let files = run_cargo(builder,
Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -555,8 +555,8 @@ impl Build {
let suffix = match mode {
Mode::Std => "-std",
Mode::Test => "-test",
Mode::Codegen => "-rustc",
Mode::Rustc => "-rustc",
Mode::Codegen => "-codegen",
Mode::ToolBootstrap => "-bootstrap-tools",
Mode::ToolStd => "-tools",
Mode::ToolRustc => "-tools",
Expand Down
13 changes: 8 additions & 5 deletions src/liballoc/boxed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ use core::marker::{Unpin, Unsize};
use core::mem::{self, PinMut};
use core::ops::{CoerceUnsized, Deref, DerefMut, Generator, GeneratorState};
use core::ptr::{self, NonNull, Unique};
use core::task::{Context, Poll, Executor, SpawnErrorKind, SpawnObjError};
use core::task::{Context, Poll, Spawn, SpawnErrorKind, SpawnObjError};

use raw_vec::RawVec;
use str::from_boxed_utf8_unchecked;
Expand Down Expand Up @@ -973,11 +973,14 @@ unsafe impl<'a, T, F> UnsafeFutureObj<'a, T> for PinBox<F>
}

#[unstable(feature = "futures_api", issue = "50547")]
impl<E> Executor for Box<E>
where E: Executor + ?Sized
impl<Sp> Spawn for Box<Sp>
where Sp: Spawn + ?Sized
{
fn spawn_obj(&mut self, task: FutureObj<'static, ()>) -> Result<(), SpawnObjError> {
(**self).spawn_obj(task)
fn spawn_obj(
&mut self,
future: FutureObj<'static, ()>,
) -> Result<(), SpawnObjError> {
(**self).spawn_obj(future)
}

fn status(&self) -> Result<(), SpawnErrorKind> {
Expand Down
33 changes: 0 additions & 33 deletions src/libcore/str/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2117,8 +2117,6 @@ impl str {
/// This length is in bytes, not [`char`]s or graphemes. In other words,
/// it may not be what a human considers the length of the string.
///
/// [`char`]: primitive.char.html
///
/// # Examples
///
/// Basic usage:
Expand Down Expand Up @@ -2590,8 +2588,6 @@ impl str {
/// Value, and may not match your idea of what a 'character' is. Iteration
/// over grapheme clusters may be what you actually want.
///
/// [`char`]: primitive.char.html
///
/// # Examples
///
/// Basic usage:
Expand Down Expand Up @@ -2643,8 +2639,6 @@ impl str {
/// The iterator yields tuples. The position is first, the [`char`] is
/// second.
///
/// [`char`]: primitive.char.html
///
/// # Examples
///
/// Basic usage:
Expand Down Expand Up @@ -2946,7 +2940,6 @@ impl str {
/// The pattern can be a `&str`, [`char`], or a closure that determines if
/// a character matches.
///
/// [`char`]: primitive.char.html
/// [`None`]: option/enum.Option.html#variant.None
///
/// # Examples
Expand Down Expand Up @@ -2994,7 +2987,6 @@ impl str {
/// The pattern can be a `&str`, [`char`], or a closure that determines if
/// a character matches.
///
/// [`char`]: primitive.char.html
/// [`None`]: option/enum.Option.html#variant.None
///
/// # Examples
Expand Down Expand Up @@ -3050,7 +3042,6 @@ impl str {
/// If the pattern allows a reverse search but its results might differ
/// from a forward search, the [`rsplit`] method can be used.
///
/// [`char`]: primitive.char.html
/// [`rsplit`]: #method.rsplit
///
/// # Examples
Expand Down Expand Up @@ -3157,8 +3148,6 @@ impl str {
/// The pattern can be a `&str`, [`char`], or a closure that determines the
/// split.
///
/// [`char`]: primitive.char.html
///
/// # Iterator behavior
///
/// The returned iterator requires that the pattern supports a reverse
Expand Down Expand Up @@ -3224,7 +3213,6 @@ impl str {
/// elements. This is true for, eg, [`char`] but not for `&str`.
///
/// [`DoubleEndedIterator`]: iter/trait.DoubleEndedIterator.html
/// [`char`]: primitive.char.html
///
/// If the pattern allows a reverse search but its results might differ
/// from a forward search, the [`rsplit_terminator`] method can be used.
Expand Down Expand Up @@ -3259,8 +3247,6 @@ impl str {
/// Additional libraries might provide more complex patterns like
/// regular expressions.
///
/// [`char`]: primitive.char.html
///
/// Equivalent to [`split`], except that the trailing substring is
/// skipped if empty.
///
Expand Down Expand Up @@ -3306,8 +3292,6 @@ impl str {
/// The pattern can be a `&str`, [`char`], or a closure that determines the
/// split.
///
/// [`char`]: primitive.char.html
///
/// # Iterator behavior
///
/// The returned iterator will not be double ended, because it is
Expand Down Expand Up @@ -3361,8 +3345,6 @@ impl str {
/// The pattern can be a `&str`, [`char`], or a closure that
/// determines the split.
///
/// [`char`]: primitive.char.html
///
/// # Iterator behavior
///
/// The returned iterator will not be double ended, because it is not
Expand Down Expand Up @@ -3407,16 +3389,13 @@ impl str {
/// The pattern can be a `&str`, [`char`], or a closure that
/// determines if a character matches.
///
/// [`char`]: primitive.char.html
///
/// # Iterator behavior
///
/// The returned iterator will be a [`DoubleEndedIterator`] if the pattern
/// allows a reverse search and forward/reverse search yields the same
/// elements. This is true for, eg, [`char`] but not for `&str`.
///
/// [`DoubleEndedIterator`]: iter/trait.DoubleEndedIterator.html
/// [`char`]: primitive.char.html
///
/// If the pattern allows a reverse search but its results might differ
/// from a forward search, the [`rmatches`] method can be used.
Expand Down Expand Up @@ -3446,8 +3425,6 @@ impl str {
/// The pattern can be a `&str`, [`char`], or a closure that determines if
/// a character matches.
///
/// [`char`]: primitive.char.html
///
/// # Iterator behavior
///
/// The returned iterator requires that the pattern supports a reverse
Expand Down Expand Up @@ -3488,8 +3465,6 @@ impl str {
/// The pattern can be a `&str`, [`char`], or a closure that determines
/// if a character matches.
///
/// [`char`]: primitive.char.html
///
/// # Iterator behavior
///
/// The returned iterator will be a [`DoubleEndedIterator`] if the pattern
Expand Down Expand Up @@ -3532,8 +3507,6 @@ impl str {
/// The pattern can be a `&str`, [`char`], or a closure that determines if a
/// character matches.
///
/// [`char`]: primitive.char.html
///
/// # Iterator behavior
///
/// The returned iterator requires that the pattern supports a reverse
Expand Down Expand Up @@ -3665,8 +3638,6 @@ impl str {
/// The pattern can be a [`char`] or a closure that determines if a
/// character matches.
///
/// [`char`]: primitive.char.html
///
/// # Examples
///
/// Simple patterns:
Expand Down Expand Up @@ -3711,8 +3682,6 @@ impl str {
/// The pattern can be a `&str`, [`char`], or a closure that determines if
/// a character matches.
///
/// [`char`]: primitive.char.html
///
/// # Text directionality
///
/// A string is a sequence of bytes. 'Left' in this context means the first
Expand Down Expand Up @@ -3750,8 +3719,6 @@ impl str {
/// The pattern can be a `&str`, [`char`], or a closure that
/// determines if a character matches.
///
/// [`char`]: primitive.char.html
///
/// # Text directionality
///
/// A string is a sequence of bytes. 'Right' in this context means the last
Expand Down
44 changes: 25 additions & 19 deletions src/libcore/task/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@
issue = "50547")]

use fmt;
use super::{Executor, Waker, LocalWaker};
use super::{Spawn, Waker, LocalWaker};

/// Information about the currently-running task.
///
/// Contexts are always tied to the stack, since they are set up specifically
/// when performing a single `poll` step on a task.
pub struct Context<'a> {
local_waker: &'a LocalWaker,
executor: &'a mut dyn Executor,
spawner: &'a mut dyn Spawn,
}

impl<'a> fmt::Debug for Context<'a> {
Expand All @@ -32,13 +32,14 @@ impl<'a> fmt::Debug for Context<'a> {
}

impl<'a> Context<'a> {
/// Create a new task `Context` with the provided `local_waker`, `waker`, and `executor`.
/// Create a new task `Context` with the provided `local_waker`, `waker`,
/// and `spawner`.
#[inline]
pub fn new(local_waker: &'a LocalWaker, executor: &'a mut dyn Executor) -> Context<'a> {
Context {
local_waker,
executor,
}
pub fn new(
local_waker: &'a LocalWaker,
spawner: &'a mut dyn Spawn,
) -> Context<'a> {
Context { local_waker, spawner }
}

/// Get the `LocalWaker` associated with the current task.
Expand All @@ -53,40 +54,45 @@ impl<'a> Context<'a> {
unsafe { &*(self.local_waker as *const LocalWaker as *const Waker) }
}

/// Get the default executor associated with this task.
/// Get the spawner associated with this task.
///
/// This method is useful primarily if you want to explicitly handle
/// spawn failures.
#[inline]
pub fn executor(&mut self) -> &mut dyn Executor {
self.executor
pub fn spawner(&mut self) -> &mut dyn Spawn {
self.spawner
}

/// Produce a context like the current one, but using the given waker instead.
/// Produce a context like the current one, but using the given waker
/// instead.
///
/// This advanced method is primarily used when building "internal
/// schedulers" within a task, where you want to provide some customized
/// wakeup logic.
#[inline]
pub fn with_waker<'b>(&'b mut self, local_waker: &'b LocalWaker) -> Context<'b> {
pub fn with_waker<'b>(
&'b mut self,
local_waker: &'b LocalWaker,
) -> Context<'b> {
Context {
local_waker,
executor: self.executor,
spawner: self.spawner,
}
}

/// Produce a context like the current one, but using the given executor
/// Produce a context like the current one, but using the given spawner
/// instead.
///
/// This advanced method is primarily used when building "internal
/// schedulers" within a task.
#[inline]
pub fn with_executor<'b, E>(&'b mut self, executor: &'b mut E) -> Context<'b>
where E: Executor
{
pub fn with_spawner<'b, Sp: Spawn>(
&'b mut self,
spawner: &'b mut Sp,
) -> Context<'b> {
Context {
local_waker: self.local_waker,
executor,
spawner,
}
}
}
6 changes: 2 additions & 4 deletions src/libcore/task/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,8 @@
mod context;
pub use self::context::Context;

mod executor;
pub use self::executor::{
Executor, SpawnErrorKind, SpawnObjError, SpawnLocalObjError
};
mod spawn;
pub use self::spawn::{Spawn, SpawnErrorKind, SpawnObjError, SpawnLocalObjError};

mod poll;
pub use self::poll::Poll;
Expand Down
Loading

0 comments on commit 18925de

Please sign in to comment.