rustc_attr_parsing: use a try {} in or_malformed#155829
Merged
rust-bors[bot] merged 1 commit intorust-lang:mainfrom Apr 27, 2026
Merged
rustc_attr_parsing: use a try {} in or_malformed#155829rust-bors[bot] merged 1 commit intorust-lang:mainfrom
try {} in or_malformed#155829rust-bors[bot] merged 1 commit intorust-lang:mainfrom
Conversation
Collaborator
|
Some changes occurred in compiler/rustc_attr_parsing cc @jdonszelmann, @JonathanBrouwer Some changes occurred to diagnostic attributes. cc @mejrs |
Contributor
|
It was originally a try block, see #151558 (comment) This seems fine with me, will review later |
Contributor
|
@bors r+ rollup |
Contributor
JonathanBrouwer
added a commit
to JonathanBrouwer/rust
that referenced
this pull request
Apr 26, 2026
rustc_attr_parsing: use a `try {}` in `or_malformed`
JonathanBrouwer
added a commit
to JonathanBrouwer/rust
that referenced
this pull request
Apr 26, 2026
rustc_attr_parsing: use a `try {}` in `or_malformed`
rust-bors Bot
pushed a commit
that referenced
this pull request
Apr 26, 2026
…uwer Rollup of 9 pull requests Successful merges: - #149624 (Fix requires_lto targets needing lto set in cargo) - #152443 (NVPTX: Drop support for old architectures and old ISAs) - #155317 (`std::io::Take`: Clarify & optimize `BorrowedBuf::set_init` usage.) - #155588 (Implement more traits for FRTs) - #155682 (Add boxing suggestions for `impl Trait` return type mismatches) - #155770 (Avoid misleading closure return type note) - #155818 (Convert attribute `FinalizeFn` to fn pointer) - #155829 (rustc_attr_parsing: use a `try {}` in `or_malformed`) - #155835 (couple of `crate_name` cleanups)
rust-bors Bot
pushed a commit
that referenced
this pull request
Apr 27, 2026
Rollup of 12 pull requests Successful merges: - #149624 (Fix requires_lto targets needing lto set in cargo) - #155317 (`std::io::Take`: Clarify & optimize `BorrowedBuf::set_init` usage.) - #155579 (Make Rcs and Arcs use pointer comparison for unsized types) - #155588 (Implement more traits for FRTs) - #155708 (Fix heap overflow in slice::join caused by misbehaving Borrow) - #155778 (Avoid Vec allocation in TyCtxt::mk_place_elem) - #151014 (std: sys: process: uefi: Add program searching) - #155682 (Add boxing suggestions for `impl Trait` return type mismatches) - #155770 (Avoid misleading closure return type note) - #155818 (Convert attribute `FinalizeFn` to fn pointer) - #155829 (rustc_attr_parsing: use a `try {}` in `or_malformed`) - #155835 (couple of `crate_name` cleanups)
rust-timer
added a commit
that referenced
this pull request
Apr 27, 2026
Rollup merge of #155829 - scrabsha:push-kwlqypwmnpul, r=mejrs rustc_attr_parsing: use a `try {}` in `or_malformed`
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.
This replace the
(|| { Some($($code)*) })()with a nice and cleantry { $($code)* }block.try {}is unstable but widely used within the compiler (and in a few places inrustc_attr_parsing), so I would argue it's ok to use it here too?To the best of my knowledge, there is no instance of IIFE (aka the poor man's
try {}) inrustc_attribute_parsing. Happy to be proven wrong though :)r? mejrs