Skip to content

Allow global_asm! in statement positions (take 2)#156919

Open
daxpedda wants to merge 1 commit into
rust-lang:mainfrom
daxpedda:global-asm-statement-2
Open

Allow global_asm! in statement positions (take 2)#156919
daxpedda wants to merge 1 commit into
rust-lang:mainfrom
daxpedda:global-asm-statement-2

Conversation

@daxpedda
Copy link
Copy Markdown
Contributor

@daxpedda daxpedda commented May 25, 2026

Fixes #156760
Fixes #156894

This PR makes it possible to put global_asm! in statement positions. This is particularly useful for macros, where you otherwise have to wrap them in mod foo { global_asm!(...); }.

The implementation gates this behind feature(global_asm_statement_position).

Previously discussed on Zulip.

Previous history:
This has been merged in #156582 and then reverted in #156884 because it was insta-stable. In that time two bugs surfaced: #156760 and #156894. Both were fixed with #156855, which was incorporated here. Thank you @Kokoro2336 and @folkertdev.

r? @petrochenkov.

@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 May 25, 2026
Comment thread compiler/rustc_feature/src/unstable.rs Outdated
/// Allows any generic constants being used as pattern type range ends
(incomplete, generic_pattern_types, "1.86.0", Some(136574)),
/// Allows `global_asm!` in statement positions.
(unstable, global_asm_statement_position, "CURRENT_RUSTC_VERSION", Some(0)),
Copy link
Copy Markdown
Contributor Author

@daxpedda daxpedda May 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add the tracking issue here when we are ready.

View changes since the review

@folkertdev
Copy link
Copy Markdown
Contributor

My understanding of our processes is that this needs some sort of thumbs up from T-lang, so nominating. See #project-inline-asm > Item position global_asm for extra context.

@folkertdev folkertdev added the I-lang-nominated Nominated for discussion during a lang team meeting. label May 25, 2026
@rust-log-analyzer

This comment has been minimized.

@daxpedda daxpedda force-pushed the global-asm-statement-2 branch from 3ad186f to 46594bf Compare May 25, 2026 13:34
Comment thread tests/ui/asm/global-asm-sym-generic-param.rs
@daxpedda daxpedda force-pushed the global-asm-statement-2 branch from 46594bf to 074562c Compare May 25, 2026 13:52
@petrochenkov petrochenkov added S-waiting-on-t-lang Status: Awaiting decision from T-lang T-lang Relevant to the language team and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels May 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

I-lang-nominated Nominated for discussion during a lang team meeting. S-waiting-on-t-lang Status: Awaiting decision from T-lang T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-lang Relevant to the language team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

global_asm! in statement position has weird behavior with Self [ICE]: could not resolve DefId

5 participants