Skip to content

Don't use maybe_unwrap_block when checking for macro calls in a block expr #132653

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 1 commit into from
Nov 12, 2024

Conversation

BoxyUwU
Copy link
Member

@BoxyUwU BoxyUwU commented Nov 5, 2024

Fixes #131915

Using maybe_unwrap_block to determine if we are looking at a { mac_call!{} } will fail sometimes as mac_call!{} could be a StmtKind::MacCall not a StmtKind::Expr. This caused the def collector to think that { mac_call!{} } was a non-trivial const argument and create a definition for it even though it should not.

r? @compiler-errors cc @camelid

@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 Nov 5, 2024
@rust-log-analyzer

This comment has been minimized.

@BoxyUwU BoxyUwU force-pushed the const_arg_stmt_mac_call branch 2 times, most recently from 368ef2b to e1182fa Compare November 5, 2024 17:40
@rust-log-analyzer

This comment has been minimized.

@BoxyUwU BoxyUwU force-pushed the const_arg_stmt_mac_call branch from e1182fa to 1d6e847 Compare November 5, 2024 18:23
@compiler-errors
Copy link
Member

@bors r+ rollup

@bors
Copy link
Collaborator

bors commented Nov 11, 2024

📌 Commit 1d6e847 has been approved by compiler-errors

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 Nov 11, 2024
bors added a commit to rust-lang-ci/rust that referenced this pull request Nov 12, 2024
…iaskrgr

Rollup of 8 pull requests

Successful merges:

 - rust-lang#132487 (Provide placeholder generics for traits in "no method found for type parameter" suggestions)
 - rust-lang#132627 (cleanup: Remove outdated comment of `thir_body`)
 - rust-lang#132653 (Don't use `maybe_unwrap_block` when checking for macro calls in a block expr)
 - rust-lang#132793 (Update mdbook to 0.4.42)
 - rust-lang#132847 (elem_offset / subslice_range: use addr() instead of 'as usize')
 - rust-lang#132869 (split up the first paragraph of doc comments for better summaries)
 - rust-lang#132929 (Check for null in the `alloc_zeroed` example)
 - rust-lang#132933 (Make sure that we suggest turbofishing the right type arg for never suggestion)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit b7dc481 into rust-lang:master Nov 12, 2024
6 checks passed
@rustbot rustbot added this to the 1.84.0 milestone Nov 12, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Nov 12, 2024
Rollup merge of rust-lang#132653 - BoxyUwU:const_arg_stmt_mac_call, r=compiler-errors

Don't use `maybe_unwrap_block` when checking for macro calls in a block expr

Fixes rust-lang#131915

Using `maybe_unwrap_block` to determine if we are looking at a `{ mac_call!{} }` will fail sometimes as `mac_call!{}` could be a `StmtKind::MacCall` not a `StmtKind::Expr`. This caused the def collector to think that `{ mac_call!{} }` was a non-trivial const argument and create a definition for it even though it should not.

r? `@compiler-errors`  cc `@camelid`
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
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: adding a def'n for node-id NodeId(13) and def kind AnonConst but a previous def'n exists: DefKey
5 participants