-
Notifications
You must be signed in to change notification settings - Fork 21
Update to nightly-2019-01-16 #77
base: master
Are you sure you want to change the base?
Conversation
|
Nice job! Looks like the only thing keeping this from passing CI is a few missing doc comments. Just add those and I'll bet it'll be good to merge. |
| { | ||
| unsafe { self.spawn_unchecked(f) } | ||
| } | ||
| #[unstable(feature = "thread_spawn_unchecked", issue = "55132")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doc comment is missing here which prevents compilation from succeeding.
| #[unstable(feature = "thread_spawn_unchecked", issue = "55132")] | |
| /// Spawns a new thread without any lifetime restrictions by taking ownership | |
| /// of the `Builder`, and returns an [`io::Result`] to its [`JoinHandle`]. | |
| /// | |
| /// The spawned thread may outlive the caller (unless the caller thread | |
| /// is the main thread; the whole process is terminated when the main | |
| /// thread finishes). The join handle can be used to block on | |
| /// termination of the child thread, including recovering its panics. | |
| /// | |
| /// This method is identical to [`thread::Builder::spawn`][`Builder::spawn`], | |
| /// except for the relaxed lifetime bounds, which render it unsafe. | |
| /// For a more complete documentation see [`thread::spawn`][`spawn`]. | |
| /// | |
| /// # Errors | |
| /// | |
| /// Unlike the [`spawn`] free function, this method yields an | |
| /// [`io::Result`] to capture any failure to create the thread at | |
| /// the OS level. | |
| /// | |
| /// # Panics | |
| /// | |
| /// Panics if a thread name was set and it contained null bytes. | |
| /// | |
| /// # Safety | |
| /// | |
| /// The caller has to ensure that no references in the supplied thread closure | |
| /// or its return type can outlive the spawned thread's lifetime. This can be | |
| /// guaranteed in two ways: | |
| /// | |
| /// - ensure that [`join`][`JoinHandle::join`] is called before any referenced | |
| /// data is dropped | |
| /// - use only types with `'static` lifetime bounds, i.e., those with no or only | |
| /// `'static` references (both [`thread::Builder::spawn`][`Builder::spawn`] | |
| /// and [`thread::spawn`][`spawn`] enforce this property statically) | |
| /// | |
| /// # Examples | |
| /// | |
| /// ``` | |
| /// #![feature(thread_spawn_unchecked)] | |
| /// use std::thread; | |
| /// | |
| /// let builder = thread::Builder::new(); | |
| /// | |
| /// let x = 1; | |
| /// let thread_x = &x; | |
| /// | |
| /// let handler = unsafe { | |
| /// builder.spawn_unchecked(move || { | |
| /// println!("x = {}", *thread_x); | |
| /// }).unwrap() | |
| /// }; | |
| /// | |
| /// // caller has to ensure `join()` is called, otherwise | |
| /// // it is possible to access freed memory if `x` gets | |
| /// // dropped before the thread closure is executed! | |
| /// handler.join().unwrap(); | |
| /// ``` | |
| /// | |
| /// [`spawn`]: ../../std/thread/fn.spawn.html | |
| /// [`Builder::spawn`]: ../../std/thread/struct.Builder.html#method.spawn | |
| /// [`io::Result`]: ../../std/io/type.Result.html | |
| /// [`JoinHandle`]: ../../std/thread/struct.JoinHandle.html | |
| #[unstable(feature = "thread_spawn_unchecked", issue = "55132")] |
| }) | ||
| } | ||
|
|
||
| #[stable(feature = "debug", since = "1.69.0")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing doc comment on this macro prevents compilation from succeeding
| #[stable(feature = "debug", since = "1.69.0")] | |
| /// A macro for quick and dirty debugging with which you can inspect | |
| /// the value of a given expression. An example: | |
| /// | |
| /// ```rust | |
| /// let a = 2; | |
| /// let b = dbg!(a * 2) + 1; | |
| /// // ^-- prints: [src/main.rs:2] a * 2 = 4 | |
| /// assert_eq!(b, 5); | |
| /// ``` | |
| /// | |
| /// The macro works by using the `Debug` implementation of the type of | |
| /// the given expression to print the value to [stderr] along with the | |
| /// source location of the macro invocation as well as the source code | |
| /// of the expression. | |
| /// | |
| /// Invoking the macro on an expression moves and takes ownership of it | |
| /// before returning the evaluated expression unchanged. If the type | |
| /// of the expression does not implement `Copy` and you don't want | |
| /// to give up ownership, you can instead borrow with `dbg!(&expr)` | |
| /// for some expression `expr`. | |
| /// | |
| /// Note that the macro is intended as a debugging tool and therefore you | |
| /// should avoid having uses of it in version control for longer periods. | |
| /// Use cases involving debug output that should be added to version control | |
| /// may be better served by macros such as `debug!` from the `log` crate. | |
| /// | |
| /// # Stability | |
| /// | |
| /// The exact output printed by this macro should not be relied upon | |
| /// and is subject to future changes. | |
| /// | |
| /// # Panics | |
| /// | |
| /// Panics if writing to `io::stderr` fails. | |
| /// | |
| /// # Further examples | |
| /// | |
| /// With a method call: | |
| /// | |
| /// ```rust | |
| /// fn foo(n: usize) { | |
| /// if let Some(_) = dbg!(n.checked_sub(4)) { | |
| /// // ... | |
| /// } | |
| /// } | |
| /// | |
| /// foo(3) | |
| /// ``` | |
| /// | |
| /// This prints to [stderr]: | |
| /// | |
| /// ```text,ignore | |
| /// [src/main.rs:4] n.checked_sub(4) = None | |
| /// ``` | |
| /// | |
| /// Naive factorial implementation: | |
| /// | |
| /// ```rust | |
| /// fn factorial(n: u32) -> u32 { | |
| /// if dbg!(n <= 1) { | |
| /// dbg!(1) | |
| /// } else { | |
| /// dbg!(n * factorial(n - 1)) | |
| /// } | |
| /// } | |
| /// | |
| /// dbg!(factorial(4)); | |
| /// ``` | |
| /// | |
| /// This prints to [stderr]: | |
| /// | |
| /// ```text,ignore | |
| /// [src/main.rs:3] n <= 1 = false | |
| /// [src/main.rs:3] n <= 1 = false | |
| /// [src/main.rs:3] n <= 1 = false | |
| /// [src/main.rs:3] n <= 1 = true | |
| /// [src/main.rs:4] 1 = 1 | |
| /// [src/main.rs:5] n * factorial(n - 1) = 2 | |
| /// [src/main.rs:5] n * factorial(n - 1) = 6 | |
| /// [src/main.rs:5] n * factorial(n - 1) = 24 | |
| /// [src/main.rs:11] factorial(4) = 24 | |
| /// ``` | |
| /// | |
| /// The `dbg!(..)` macro moves the input: | |
| /// | |
| /// ```compile_fail | |
| /// /// A wrapper around `usize` which importantly is not Copyable. | |
| /// #[derive(Debug)] | |
| /// struct NoCopy(usize); | |
| /// | |
| /// let a = NoCopy(42); | |
| /// let _ = dbg!(a); // <-- `a` is moved here. | |
| /// let _ = dbg!(a); // <-- `a` is moved again; error! | |
| /// ``` | |
| /// | |
| /// You can also use `dbg!()` without a value to just print the | |
| /// file and line whenever it's reached. | |
| /// | |
| /// [stderr]: https://en.wikipedia.org/wiki/Standard_streams#Standard_error_(stderr) | |
| #[macro_export] | |
| #[stable(feature = "dbg_macro", since = "1.32.0")] |
| } | ||
| } | ||
|
|
||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing doc comment prevents compilation from succeeding
| /// A macro to await on an async call. |
|
It's also worth mentioning that we already have a separate |
|
Friendly ping! I'm pretty sure this should be mergeable after the requested changes are made. |
This pull request changes the std component to be closer to the nightly-2019-01-16 one. It builds and works using the nightly-2019-01-16 compiler. This fixes #75