diff options
| author | bors <bors@rust-lang.org> | 2018-08-07 11:00:07 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2018-08-07 11:00:07 +0000 |
| commit | 18925dee25ce649562d203e72068e3a57b60b153 (patch) | |
| tree | cefb7c09f52e823aa3c03dc072d29cba51e52c2a /src/libcore | |
| parent | 9e472c2acea2b7714985390abb6b7fe420a4f346 (diff) | |
| parent | d9e9230b1d3ccb8eb0fe57d0e0a29e08f09292c3 (diff) | |
| download | rust-18925dee25ce649562d203e72068e3a57b60b153.tar.gz rust-18925dee25ce649562d203e72068e3a57b60b153.zip | |
Auto merge of #53150 - kennytm:rollup, r=kennytm
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)
Diffstat (limited to 'src/libcore')
| -rw-r--r-- | src/libcore/str/mod.rs | 33 | ||||
| -rw-r--r-- | src/libcore/task/context.rs | 44 | ||||
| -rw-r--r-- | src/libcore/task/mod.rs | 6 | ||||
| -rw-r--r-- | src/libcore/task/spawn.rs (renamed from src/libcore/task/executor.rs) | 15 |
4 files changed, 33 insertions, 65 deletions
diff --git a/src/libcore/str/mod.rs b/src/libcore/str/mod.rs index 86b8349fa3c..356534a9187 100644 --- a/src/libcore/str/mod.rs +++ b/src/libcore/str/mod.rs @@ -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: @@ -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: @@ -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: @@ -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 @@ -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 @@ -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 @@ -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 @@ -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. @@ -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. /// @@ -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 @@ -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 @@ -3407,8 +3389,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 @@ -3416,7 +3396,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 [`rmatches`] method can be used. @@ -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 @@ -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 @@ -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 @@ -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: @@ -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 @@ -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 diff --git a/src/libcore/task/context.rs b/src/libcore/task/context.rs index 121f93b666b..5a29c8528ef 100644 --- a/src/libcore/task/context.rs +++ b/src/libcore/task/context.rs @@ -13,7 +13,7 @@ issue = "50547")] use fmt; -use super::{Executor, Waker, LocalWaker}; +use super::{Spawn, Waker, LocalWaker}; /// Information about the currently-running task. /// @@ -21,7 +21,7 @@ use super::{Executor, Waker, LocalWaker}; /// 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> { @@ -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. @@ -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, } } } diff --git a/src/libcore/task/mod.rs b/src/libcore/task/mod.rs index c4f07536164..f51e5f7ce0e 100644 --- a/src/libcore/task/mod.rs +++ b/src/libcore/task/mod.rs @@ -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; diff --git a/src/libcore/task/executor.rs b/src/libcore/task/spawn.rs index affcbf464da..58ee85d232b 100644 --- a/src/libcore/task/executor.rs +++ b/src/libcore/task/spawn.rs @@ -15,16 +15,13 @@ use fmt; use future::{FutureObj, LocalFutureObj}; -/// A task executor. +/// Spawns tasks that poll futures to completion onto its associated task +/// executor. /// -/// Futures are polled until completion by tasks, a kind of lightweight -/// "thread". A *task executor* is responsible for the creation of these tasks -/// and the coordination of their execution on real operating system threads. In -/// particular, whenever a task signals that it can make further progress via a -/// wake-up notification, it is the responsibility of the task executor to put -/// the task into a queue to continue executing it, i.e. polling the future in -/// it, later. -pub trait Executor { +/// The term "task" refers to a kind of lightweight "thread". Task executors +/// are responsible for scheduling the execution of tasks on operating system +/// threads. +pub trait Spawn { /// Spawns a new task with the given future. The future will be polled until /// completion. /// |
