Rollup of 5 pull requests - #162278
Closed
JonathanBrouwer wants to merge 20 commits into
Closed
Conversation
… now use `!` in `Residual`
Note: `cannot-infer-partial-try-return` not extended to cover both Uninhabited & ! - will only error on the first one - not worth a second test to cover both
- in general replace Infallible with ! in try-adjacent situations (mainly Result<_, !>) - where applicable extend tests to also validate both ! and a custom enum Uninhabited, to avoid unintentional future divergence
It's unused, and we should never have a single-element tuple in the AST.
They are trivial and the code is clearer with them gone.
It has only two call sites and the code is clearer with it gone.
This is a very common pattern in the AST visitor code: ``` visit_visitable!($($mut)? visitor, a, b, c); ``` It looks like the `$($mut)?` selects between the immutable visitor's `visit_visitable!` (which doesn't accept `mut` at the start) and the mutable visitor's (which does accept `mut` at the start). That would make sense if `visit_visitable!` was a single macro with separate rules for the immutable and mutable cases. But that's not the case. The two `visit_visitable!` definitions are in different modules and at any call site only one of them is visible within the relevant `common_visitor_and_walkers!` invocation. So the `$($mut)?` can be removed from the many `visit_visitable!` calls, and also the `visit_visitable_with!` and `define_named_walk!` calls. This makes the code easier to read.
Similar to the previous commit.
`generate_list_visit_fns` currently creates two functions for each case: the method `MutVisitable::visit_mut` and the free function `$name`, of the form `visit_foo`. The former calls the latter. But the latter is a single line of code and can be easily inlined into the former and removed. This avoids the need to provide `$name`. The commit also changes the argument order so each case's `$visit_fn` comes before the type, because that feels more natural. It's a similar story for `generate_flat_map_visit_fns`. Also, only support a single optional argument in these macros, (a) because that's all that is needed and (b) to match all the other macros.
Must be done manually because rustfmt doesn't do much within macro definitions. Also, the code currently has a mix of `&$($mut)? $($lt)?` and `&$($lt)? $($mut)?` pairs. The inconsistency doesn't matter because only one of `$mut` and `$lt` is ever present. But this commit changes them all to the latter form for consistency.
The sanitize ignorelist gives central controls over which functions, files, etc. should be ignored and not sanitized. It is a common file format for clang and explained here: https://clang.llvm.org/docs/SanitizerSpecialCaseList.html. This change adds support for this list in Rust as well.
…alle sanitizers: Implement support for the sanitize ignorelist The sanitize ignorelist gives central controls over which functions, files, etc. should be ignored and not sanitized. It is a common file format for clang and explained here: https://clang.llvm.org/docs/SanitizerSpecialCaseList.html. This change adds support for this list in Rust as well. r? @rcvalle
c-variadic: use `emit_ptr_va_arg` for `va_arg` on `sparc` I've built GCC for the target and validated pretty extensively that this works. Using our helper does generate worse code for `i64` unfortunately, I've reported that as llvm/llvm-project#214594. But, given that this is a tier-3 target etc. I don't think it makes sense to go out of our way to do better, we can just wait for LLVM to resolve that issue.
…ray, r=mu001999 Generalize Decodable impl for arrays to all types This is almost the only impl that is not symetric with its Encodable counterpart. I tried to find out why in the history but it looks like this impl predates most of the generic symetric ones that are in this file, so it looks like it's not intentional. I bumped into this randomly by changing a Vec to an array in some Mir types. The error was pretty confusing and It took me a while to figure out so I think it's worth generalizing this for somebody else in the future, even though it's technically not necessary at the moment. ~~We piggyback off of `SmallVec` impl to avoid adding a `Default` bound or `MaybeUninit` unsafe dance. This moves the assert from the begining to the end of the loop.~~ We use `array::from_fn`
…ethercote
Update internal docs & tests to use `!` rather than `Infallible` in relation to `Try`
- Update docs, internal comments and tests to use `!` rather than `Infallible` in `Try` situations.
- Add a custom `enum Uninhabited {}` to specific clippy tests where unintentional future divergence in handling `!` vs other uninhabited types may be a possible concern
Refs:
- Never is ~~meow~~ now rust-lang#155499
- Try: rust-lang#84277 & rust-lang/goals#654
…r=fee1-dead Clean up the AST visitor The AST visitor is macro-heavy and complicated. This PR simplifies some aspects of it. Details in individual commits. r? @fee1-dead
Member
Author
Contributor
This comment has been minimized.
This comment has been minimized.
rust-bors Bot
pushed a commit
that referenced
this pull request
Sep 4, 2026
Rollup of 5 pull requests try-job: dist-various-1 try-job: test-various try-job: x86_64-gnu-aux try-job: x86_64-gnu-llvm-21-3 try-job: x86_64-msvc-1 try-job: aarch64-apple-1 try-job: aarch64-apple-2 try-job: x86_64-mingw-1 try-job: i686-msvc-1 try-job: i686-msvc-2
Contributor
|
This pull request was unapproved due to being closed. |
Contributor
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:
emit_ptr_va_argforva_argonsparc#160660 (c-variadic: useemit_ptr_va_argforva_argonsparc)!rather thanInfalliblein relation toTry#162174 (Update internal docs & tests to use!rather thanInfalliblein relation toTry)r? @ghost
Create a similar rollup