Skip to content

Check if merged attributes list is empty in expr #139391

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

Merged
merged 1 commit into from
Apr 6, 2025

Conversation

TaKO8Ki
Copy link
Member

@TaKO8Ki TaKO8Ki commented Apr 4, 2025

Fixes #139373

In the example code, an UnrecognizedReprHint error is output, and the list of merged attributes becomes empty. This causes a panic to occur. So, it's necessary to check if merged attributes list is empty as other functions do.

ref:

if ret.is_empty() {

@rustbot
Copy link
Collaborator

rustbot commented Apr 4, 2025

r? @oli-obk

rustbot has assigned @oli-obk.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Apr 4, 2025
@workingjubilee
Copy link
Member

cc @jdonszelmann

@TaKO8Ki TaKO8Ki changed the title Check if merged attributes list is empty Check if merged attributes list is empty in expr Apr 4, 2025
@jdonszelmann
Copy link
Contributor

Oh, good catch. I'll review this tomorrow :)

@jdonszelmann jdonszelmann assigned jdonszelmann and unassigned oli-obk Apr 4, 2025
@jdonszelmann jdonszelmann added the A-attributes Area: Attributes (`#[…]`, `#![…]`) label Apr 4, 2025
@jdonszelmann
Copy link
Contributor

I swear I fixed a very similar bug myself, but apparently not here. Thanks for the PR! @bors r+ rollup

@bors
Copy link
Collaborator

bors commented Apr 6, 2025

📌 Commit 6b5ccfc has been approved by jdonszelmann

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 6, 2025
bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 6, 2025
…llaumeGomez

Rollup of 6 pull requests

Successful merges:

 - rust-lang#138562 (Optimize slice {Chunks,Windows}::nth)
 - rust-lang#138876 (Trusty: Implement `write_vectored` for stdio )
 - rust-lang#139072 (Add `slice::align_to_uninit_mut`)
 - rust-lang#139367 (Add `*_value` methods to proc_macro lib)
 - rust-lang#139391 (Check if merged attributes list is empty in expr)
 - rust-lang#139414 (Fix typo in `RawList`'s documentation)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit b1d67b2 into rust-lang:master Apr 6, 2025
6 checks passed
@rustbot rustbot added this to the 1.88.0 milestone Apr 6, 2025
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Apr 6, 2025
Rollup merge of rust-lang#139391 - TaKO8Ki:check-if-merged-attrs-list-is-empty, r=jdonszelmann

Check if merged attributes list is empty in expr

Fixes rust-lang#139373

In the example code, an [`UnrecognizedReprHint`](https://github.com/rust-lang/rust/blob/6b5ccfc87f59ab017032e430d4d358b4989735da/compiler/rustc_attr_parsing/src/attributes/repr.rs#L155) error is output, and the list of merged attributes becomes empty. This causes a [panic](https://github.com/rust-lang/rust/blob/6b5ccfc87f59ab017032e430d4d358b4989735da/compiler/rustc_ast_lowering/src/lib.rs#L618) to occur. So, it's necessary to check if merged attributes list is empty as other functions do.

ref: https://github.com/rust-lang/rust/blob/6b5ccfc87f59ab017032e430d4d358b4989735da/compiler/rustc_ast_lowering/src/lib.rs#L896
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-attributes Area: Attributes (`#[…]`, `#![…]`) S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ICE: Stored empty attributes for 3
6 participants