-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Rollup of 8 pull requests #72036
Merged
Merged
Rollup of 8 pull requests #72036
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This commit adds some new `LocalDecl` methods: - `with_source_info`, a most general constructor. - `new`, a variant of `with_source_info` which represents the most common use case. - `internal` a modifying method (like the already present `immutable`). It removes some old `LocalDecl` methods: - `new_internal` and `new_local`, because they're subsumed by the new methods. - `new_return_place`, because it was identical to `new_temp`. Finally, it cleans up all the use sites.
By boxing `local_info`.
By boxing `user_ty`.
…=sfackler Add core::future::{pending,ready} Adds two future constructors to `core`: `future::ready` and `future::pending`. These functions enable constructing futures of any type that either immediately resolve, or never resolve which is an incredible useful tool when writing documentation. These functions have prior art in both the `futures` and `async-std` crates. This implementation has been adapted from the `futures` crate. ## Examples In rust-lang#70817 we propose adding the `ready!` macro. In the example we use an `async fn` which does not return a future that implements `Unpin`, which leads to the use of `unsafe`. Instead had we had `future::ready` available, we could've written the same example without using `unsafe`: ```rust use core::task::{Context, Poll}; use core::future::{self, Future}; use core::pin::Pin; pub fn do_poll(cx: &mut Context<'_>) -> Poll<()> { let mut fut = future::ready(42_u8); let num = ready!(Pin::new(fut).poll(cx)); // ... use num Poll::Ready(()) } ``` ## Why future::ready? Arguably `future::ready` and `async {}` can be considered equivalent. The main differences are that `future::ready` returns a future that implements `Unpin`, and the returned future is a concrete type. This is useful for traits that require a future as an associated type that can sometimes be a no-op ([example](https://docs.rs/http-service/0.4.0/http_service/trait.HttpService.html#associatedtype.ConnectionFuture)). The final, minor argument is that `future::ready` and `future::pending` form a counterpart to the enum members of `Poll`: `Ready` and `Pending`. These functions form a conceptual bridge between `Poll` and `Future`, and can be used as a useful teaching device. ## References - [`futures::future::ready`](https://docs.rs/futures/0.3.4/futures/future/fn.ready.html) - [`futures::future::pending`](https://docs.rs/futures/0.3.4/futures/future/fn.pending.html) - [`async_std::future::pending`](https://docs.rs/async-std/1.5.0/async_std/future/fn.pending.html) - [`async_std::future::ready`](https://docs.rs/async-std/1.5.0/async_std/future/fn.ready.html)
Make BTreeMap::new and BTreeSet::new const
…amertj Simplify the error Registry methods a little
…thewjasper Shrink `LocalDecl` `LocalDecl` contributes 4-8% of peak heap memory usage on a range of benchmarks. This PR reduces its size from 128 bytes to 56 bytes on 64-bit, and does some clean-ups as well. r? @matthewjasper
Dead-code pass highlights too much of impl functions Fixes rust-lang#66627. Previous diagnostic: ``` error: method is never used: `unused_impl_fn_3` --> src/main.rs:28:5 | 28 | / fn unused_impl_fn_3( 29 | | var: i32, 30 | | ) { 31 | | println!("bar {}", var); 32 | | } | |_____^ ``` New diagnostic: ``` error: associated function is never used: `unused_impl_fn_3` --> $DIR/lint-dead-code-6.rs:13:8 | LL | fn unused_impl_fn_3( | ^^^^^^^^^^^^^^^^ ``` This makes associated functions in line with free-standing functions.
Fix `strip-priv-imports` pass name in the rustdoc documentation
Fix canonicalization links
Better documentation for io::Read::read() return value Aims to provide the clarity requested in rust-lang#70360
@bors p=8 rollup=never |
@bors p+ |
@bors r+ |
📌 Commit 4b337d2 has been approved by |
bors
added
the
S-waiting-on-bors
Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
label
May 9, 2020
☀️ Test successful - checks-actions, checks-azure |
This was referenced May 9, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
merged-by-bors
This PR was explicitly merged by bors.
S-waiting-on-bors
Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Successful merges:
LocalDecl
#71942 (ShrinkLocalDecl
)strip-priv-imports
pass name in the rustdoc documentation #71981 (Fixstrip-priv-imports
pass name in the rustdoc documentation)Failed merges:
r? @ghost