Closed
Conversation
For `gnu` function_sections is off by default.
This creates an empty iterator, like `repeat_n(value, 0)` but without needing any such value at hand. There's precedent in many other iterators that the `Default` is empty, like `slice::Iter`. I found myself wanting this for rayon's `RepeatN` as it lowers to a sequential iterator [here][1]. Since rayon is also optimizing to avoid extra clones, it may end up with parallel splits that have count 0 and no item value. Calling `std::iter::repeat_n(x, 0)` just drops that value, but there's no way to construct the same result without a value yet. This would be straightforward with an empty `Default`. [1]: https://github.com/rayon-rs/rayon/blob/ae07384e3e0b238cea89f0c14891f351c65a5cee/src/iter/repeat.rs#L201-L202
All but one of the bullet points ended with a period; add the missing period.
…, r=Amanieu naked functions: respect `function-sections` fixes rust-lang#147789 r? @Amanieu
…gross35 `impl Default for RepeatN` This creates an empty iterator, like `repeat_n(value, 0)` but without needing any such value at hand. There's precedent in many other iterators that the `Default` is empty, like `slice::Iter`. I found myself wanting this for rayon's `RepeatN` as it lowers to a sequential iterator [here][1]. Since rayon is also optimizing to avoid extra clones, it may end up with parallel splits that have count 0 and no item value. Calling `std::iter::repeat_n(x, 0)` just drops that value, but there's no way to construct the same result without a value yet. This would be straightforward with an empty `Default`. [1]: https://github.com/rayon-rs/rayon/blob/ae07384e3e0b238cea89f0c14891f351c65a5cee/src/iter/repeat.rs#L201-L202 r? libs-api (insta-stable)
Move recursion out of `MatchPairTree::for_pattern` helpers The helper functions now just iterate over the relevant subpatterns, while leaving recursion up to the main function. This avoids passing parameters that were only used for recursive plumbing, and consolidates all recursive calls into `for_pattern` itself, which should make it easier to experiment with changes to the recursive structure. There should be no change to compiler behaviour.
Fix ICE in borrowck mutability suggestion with multi-byte ref sigil Fixes rust-lang#139089 Similarly to rust-lang#155068, this is another instance where span arithmetic did not account for multi-byte characters. (Note that the ampersand in the test is full-width) This change also results in correcting some inappropriate suggestions.
rustdoc: Fix `redundant_explicit_links` incorrectly firing (or not firing) under certain scenarios Hi! I found some issues with the `rustdoc::redundant_explicit_links` lint while working on a personal project. - After skipping a link that contains inline markups, the lint would incorrectly skip all the remaining links. For example, with the following snippet, the lint is fired for `[Option][Option]`, but not `[Result][Result]`: ```rs //! [Option][Option] //! [**u8**][u8] (skipped) //! [Result][Result] ``` Happening because of a `?` causing a loop to bail early: https://github.com/rust-lang/rust/blob/a4a37ed163a6c1d227b58047d91457589c611cf8/src/librustdoc/passes/lint/redundant_explicit_links.rs#L107 - The lint is fired for links that specify titles (like `[link](link "title")`), except that wouldn't be applicable because it's not possible to specify a title without there also being an explicit target. For example: ``` error: redundant explicit link target --> <anon>:5:12 | 5 | /// [drop](drop "This function is not magic") | ---- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ explicit target is redundant | | | because label contains path that resolves to same destination | = note: when a link's destination is not specified, the label is used to resolve intra-doc links help: remove explicit link target | 5 - /// [drop](drop "This function is not magic") 5 + /// [drop] | ``` These are found as of: ``` rustdoc 1.97.0-nightly (1b8f2e4 2026-04-17) binary: rustdoc commit-hash: 1b8f2e4 commit-date: 2026-04-17 host: aarch64-apple-darwin release: 1.97.0-nightly LLVM version: 22.1.2 ``` (Note: I ran `./x test tests/rustdoc-ui` locally, but not `./x tidy` due to my slow internet. There was an unrelated failed test at `tests/rustdoc-ui/ice-bug-report-url.rs` which I'm not sure about)
Remove unnecessary safety conditions related to unchecked uint arithmetic Improve the safety documentation of three unsafe APIs related to unsigned integer arithmetic. - [unchecked_add](https://doc.rust-lang.org/nightly/core/primitive.usize.html#method.unchecked_add): It is impossible for `self + rhs < usize::MIN`. - [unchecked_sub](https://doc.rust-lang.org/nightly/core/primitive.usize.html#method.unchecked_sub): It is impossible for `self - rhs > usize::MAX`. - [unchecked_mul](https://doc.rust-lang.org/nightly/core/primitive.usize.html#method.unchecked_mul): It is impossible for `self * rhs < usize::MIN`. The examples use `usize` for demonstration. All unsigned integer types suffer from the same issue because their APIs are generated by the same macro `uint_impl`, and fixing the macro documentation will fix them all.
docs: Fix typo in std/src/thready/scoped.rs # Fix typo in std/src/thread/scoped.rs ## Why this pr This PR fixes the typo mentioned in rust-lang#155275. I know this was originally fixed in rust-lang#155325 and then in rust-lang#155328. But since the first issue was closed due to some ai slop and the second one was closed because the first one was already opened, it seems to me that this PR is still needed. ## What this pr does This PR "just" fixes a typo inside the `std/src/thread/scoped.rs` file Changing the comment from this: ``` /// borrow non-`'static` data from the outside the scope. See [`scope`] for /// details. ``` to this: ``` /// borrow non-`'static` data from outside the scope. See [`scope`] for /// details. ```
`std::error::Request`: clean up documentation
Member
Author
|
@bors r+ rollup=never p=5 |
Contributor
Contributor
|
This pull request was unapproved due to being closed. |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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:
function-sections#147811 (naked functions: respectfunction-sections)impl Default for RepeatN#139690 (impl Default for RepeatN)MatchPairTree::for_patternhelpers #154943 (Move recursion out ofMatchPairTree::for_patternhelpers )redundant_explicit_linksincorrectly firing (or not firing) under certain scenarios #155435 (rustdoc: Fixredundant_explicit_linksincorrectly firing (or not firing) under certain scenarios)std::error::Request: clean up documentation #155467 (std::error::Request: clean up documentation)r? @ghost
Create a similar rollup