-
Notifications
You must be signed in to change notification settings - Fork 12.1k
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 #87746
Rollup of 8 pull requests #87746
Commits on Jun 23, 2021
-
Configuration menu - View commit details
-
Copy full SHA for 660f585 - Browse repository at this point
Copy the full SHA 660f585View commit details
Commits on Aug 3, 2021
-
don't use .into() to convert types to identical types (clippy::useles…
…s_conversion) Example: let _x: String = String::from("hello world").into();
Configuration menu - View commit details
-
Copy full SHA for 02b7754 - Browse repository at this point
Copy the full SHA 02b7754View commit details -
Use .contains instead of manual reimplementation.
It's also significantly easier to read.
Configuration menu - View commit details
-
Copy full SHA for 499758a - Browse repository at this point
Copy the full SHA 499758aView commit details -
Configuration menu - View commit details
-
Copy full SHA for f9b168f - Browse repository at this point
Copy the full SHA f9b168fView commit details -
Remove crypto composite feature from allowed aarch64 features.
Prefer using AES/SHA2 features directly.
Configuration menu - View commit details
-
Copy full SHA for 3be9261 - Browse repository at this point
Copy the full SHA 3be9261View commit details -
Configuration menu - View commit details
-
Copy full SHA for e817b50 - Browse repository at this point
Copy the full SHA e817b50View commit details -
Rustdoc accessibility: use an icon for the [-]/[+] controls
This way, we can show the plus and minus buttons on screens, while voice control will read off actual words "Collapse" and "Expand" instead of reading "open brace minus close brace" and "open brace plus close brace". Part of rust-lang#87059
Configuration menu - View commit details
-
Copy full SHA for c58246e - Browse repository at this point
Copy the full SHA c58246eView commit details -
Configuration menu - View commit details
-
Copy full SHA for 59460a6 - Browse repository at this point
Copy the full SHA 59460a6View commit details -
Configuration menu - View commit details
-
Copy full SHA for 64c9903 - Browse repository at this point
Copy the full SHA 64c9903View commit details -
Configuration menu - View commit details
-
Copy full SHA for 6698cdc - Browse repository at this point
Copy the full SHA 6698cdcView commit details -
Configuration menu - View commit details
-
Copy full SHA for 3744dc8 - Browse repository at this point
Copy the full SHA 3744dc8View commit details -
Configuration menu - View commit details
-
Copy full SHA for 6fe0972 - Browse repository at this point
Copy the full SHA 6fe0972View commit details -
Configuration menu - View commit details
-
Copy full SHA for 6953f17 - Browse repository at this point
Copy the full SHA 6953f17View commit details -
Rollup merge of rust-lang#81797 - yoshuawuyts:stream_from_iter, r=dto…
…lnay Add `core::stream::from_iter` _Tracking issue: https://github.com/rust-lang/rust/issues/81798_ This_ PR implements `std::stream::from_iter`, as outlined in the _"Converting an Iterator to a Stream"_ section of the [Stream RFC](https://github.com/nellshamrell/rfcs/blob/add-async-stream-rfc/text/0000-async-stream.md#converting-an-iterator-to-a-stream). This function enables converting an `Iterator` to a `Stream` by wrapping each item in the iterator with a `Poll::Ready` instance. r? `@tmandry` cc/ `@rust-lang/libs` `@rust-lang/wg-async-foundations` ## Example Being able to convert from an iterator into a stream is useful when refactoring from iterative loops into a more functional adapter-based style. This is fairly common when using more complex `filter` / `map` / `find` chains. In its basic form this conversion looks like this: **before** ```rust let mut output = vec![]; for item in my_vec { let out = do_io(item).await?; output.push(out); } ``` **after** ```rust use std::stream; let output = stream::from_iter(my_vec.iter()) .map(async |item| do_io(item).await) .collect()?; ``` Having a way to convert an `Iterator` to a `Stream` is essential in enabling this flow. ## Implementation Notes This PR makes use of `unsafe {}` to pin an item. Currently we're having conversations on the libs stream in Zulip how to bring `pin-project` in as a dependency to `core` so we can omit the `unsafe {}`. This PR also includes a documentation block which references `Stream::next` which currently doesn't exist in the stdlib (originally included in the RFC and PR, but later omitted because of an unresolved issue). `stream::from_iter` can't stabilize before `Stream` does, and there's still a chance we may stabilize `Stream` with a `next` method. So this PR includes documentation referencing that method, which we can remove as part of stabilization if by any chance we don't have `Stream::next`. ## Alternatives Considered ### `impl IntoStream for T: IntoIterator` An obvious question would be whether we could make it so every iterator can automatically be converted into a stream by calling `into_stream` on it. The answer is: "perhaps, but it could cause type issues". Types like `std::collections` may want to opt to create manual implementations for `IntoStream` and `IntoIter`, which wouldn't be possible if it was implemented through a catch-all trait. Possibly an alternative such as `impl IntoStream for T: Iterator` could work, but it feels somewhat restrictive. In the end, converting an iterator to a stream is likely to be a bit of a niche case. And even then, **adding a standalone function to convert an `Iterator` into a `Stream` would not be mutually exclusive with a blanket implementation**. ### Naming The exact name can be debated in the period before stabilization. But I've chosen `stream::from_iter` rather than `stream::iter` because we are _creating a stream from an iterator_ rather than _iterating a stream_. We also expect to add a stream counterpart to `iter::from_fn` later on (blocked on async closures), and having `stream::from_fn` and `stream::from_iter` would feel like a consistent pair. It also has prior art in `async_std::stream::from_iter`. ## Future Directions ### Stream conversions for collections This is a building block towards implementing `stream/stream_mut/into_stream` methods for `std::collections`, `std::vec`, and more. This would allow even quicker refactorings from using loops to using iterator adapters by omitting the import altogether: **before** ```rust use std::stream; let output = stream::from_iter(my_vec.iter()) .map(async |item| do_io(item).await) .collect()?; ``` **after** ```rust let output = my_vec .stream() .map(async |item| do_io(item).await) .collect()?; ```
Configuration menu - View commit details
-
Copy full SHA for ad74828 - Browse repository at this point
Copy the full SHA ad74828View commit details -
Rollup merge of rust-lang#87267 - dtolnay:negspace, r=Aaron1011
Remove space after negative sign in Literal to_string Negative proc macro literal tokens used to be printed with a space between the minus sign and the magnitude. That's because `impl ToString for Literal` used to convert the Literal into a TokenStream, which splits the minus sign into a separate Punct token. ```rust Literal::isize_unsuffixed(-10).to_string() // "- 10" ``` This PR updates the ToString impl to directly use `rustc_ast::token::Lit`'s ToString, which matches the way Rust negative numbers are idiomatically written without a space. ```rust Literal::isize_unsuffixed(-10).to_string() // "-10" ```
Configuration menu - View commit details
-
Copy full SHA for 87c8205 - Browse repository at this point
Copy the full SHA 87c8205View commit details -
Rollup merge of rust-lang#87663 - GuillaumeGomez:rustdoc-brace-minus-…
…brace, r=notriddle Rustdoc accessibility: use an icon for the [-]/[+] controls This is a reopening of rust-lang#87207 with improvement for the way of generating the `background-image` CSS property. I quote from the original PR: > This way, we can show the plus and minus buttons on screens, while voice > control will read off actual words "Collapse" and "Expand" instead of reading > "open brace minus close brace" and "open brace plus close brace". Part of rust-lang#87059 r? ``@notriddle``
Configuration menu - View commit details
-
Copy full SHA for 75e1487 - Browse repository at this point
Copy the full SHA 75e1487View commit details -
Rollup merge of rust-lang#87720 - matthiaskrgr:clippy_into, r=jyn514
don't use .into() to convert types to identical types (clippy::useless_conversion) Example: let _x: String = String::from("hello world").into();
Configuration menu - View commit details
-
Copy full SHA for 917c047 - Browse repository at this point
Copy the full SHA 917c047View commit details -
Rollup merge of rust-lang#87723 - frogtd:patch-3, r=JohnTitor
Use .contains instead of manual reimplementation. It's also significantly easier to read.
Configuration menu - View commit details
-
Copy full SHA for af8c99a - Browse repository at this point
Copy the full SHA af8c99aView commit details -
Rollup merge of rust-lang#87729 - adamgemmell:dev/deprecate-crypto, r…
…=Amanieu Remove the aarch64 `crypto` target_feature The subfeatures `aes` or `sha2` should be used instead. This can't yet be done for ARM targets as some LLVM intrinsics still require `crypto`. Also update the runtime feature detection tests in `library/std` to mirror the updates in `stdarch`. This also helps rust-lang#86941 r? ``@Amanieu``
Configuration menu - View commit details
-
Copy full SHA for 519c5a2 - Browse repository at this point
Copy the full SHA 519c5a2View commit details -
Rollup merge of rust-lang#87731 - ehuss:update-cargo, r=ehuss
Update cargo 11 commits in d21c22870e58499d6c31f1bef3bf1255eb021666..cc17afbb0067b1f57d8882640f63b2168d5b7624 2021-07-26 20:23:21 +0000 to 2021-08-02 20:28:08 +0000 - Stabilize the rust-version field (rust-lang/cargo#9732) - Remove nbsp characters. (rust-lang/cargo#9751) - Update unstable documentation TOC. (rust-lang/cargo#9750) - Some minor updates for package/publish package selection. (rust-lang/cargo#9749) - Bump to 0.57.0, update changelog (rust-lang/cargo#9748) - Stabilize `[env]` sections (rust-lang/cargo#9411) - doc: Clarify [doc].browser docs, document PathAndArgs better (rust-lang/cargo#9747) - Bump cargo-util version. (rust-lang/cargo#9745) - Make clippy happy (rust-lang/cargo#9736) - Fix typo in features doc (rust-lang/cargo#9737) - doc test supports silent output (rust-lang/cargo#9730)
Configuration menu - View commit details
-
Copy full SHA for 1666c26 - Browse repository at this point
Copy the full SHA 1666c26View commit details -
Rollup merge of rust-lang#87734 - Smittyvb:more-union-tests, r=LeSeul…
…Artichaut Test dropping union fields more Now that rust-lang#87403 is merged, a few more tests can be added for reads/writes to dropping union fields. r? ``@LeSeulArtichaut``
Configuration menu - View commit details
-
Copy full SHA for 7c5588e - Browse repository at this point
Copy the full SHA 7c5588eView commit details