Skip to content

Conversation

@daxpedda
Copy link
Contributor

@daxpedda daxpedda commented Dec 16, 2025

This change makes it possible to use unstable asm!, usually requiring feature(asm_experimental_arch), in proc-macros with the allow_internal_unstable attribute.

The test was added on a target where asm! is unstable: Wasm. However, this affects any target with an unstable asm! implementation.

@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 Dec 16, 2025
@rustbot
Copy link
Collaborator

rustbot commented Dec 16, 2025

r? @nnethercote

rustbot has assigned @nnethercote.
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

Copy link
Contributor

@nnethercote nnethercote left a comment

Choose a reason for hiding this comment

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

I have some questions.

  • What's the motivation for this? Did it come up in a particular real-world context?
  • Presumably targets with stable asm!/global_asm! are unaffected by this?
  • The PR description mentions proc macros, but the test uses a declarative macro. Why is this?

I'm also wondering if this will need some kind of libs/lang approval.

View changes since this review

@nnethercote nnethercote added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Dec 16, 2025
@daxpedda
Copy link
Contributor Author

daxpedda commented Dec 16, 2025

  • What's the motivation for this? Did it come up in a particular real-world context?

Yes, we are planning to use this in wasm-bindgen.

Currently we encode a bunch of information in really strange ways into the Wasm module and we are planning to make the next version of wasm-bindgen transition to using inline ASM instead. Until it is stabilized, we will basically build a replica of global_asm! ourselves, but we will dynamically detect nightly and switch to use Std's global_asm! instead to future-proof ourselves.

  • Presumably targets with stable asm!/global_asm! are unaffected by this?

Yes, this only affects targets requiring asm_experimental_arch: #93335.

  • The PR description mentions proc macros, but the test uses a declarative macro. Why is this?

The mechanism is the same, I've double-checked by trying it out locally.
The reason why I didn't add a proc-macro test is because I was just following existing tests for allow_internal_unstable.

Happy to add a dedicated proc-macro test!

@daxpedda daxpedda requested a review from nnethercote December 16, 2025 22:30
@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Dec 16, 2025
@nnethercote
Copy link
Contributor

No need to add a proc macro test. I'll just check on Zulip if we need any kind of libs/lang sign-off, otherwise this looks ok to me.

@nnethercote
Copy link
Contributor

@Noratrieb and @Amanieu both said on Zulip this doesn't need any additional approvals, so we're good to go. Happy new year.

@bors r+

@bors
Copy link
Collaborator

bors commented Jan 1, 2026

📌 Commit 96c165b has been approved by nnethercote

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 Jan 1, 2026
bors added a commit that referenced this pull request Jan 2, 2026
Rollup of 3 pull requests

Successful merges:

 - #150073 (Make `asm_experimental_arch` work in `allow_internal_unstable` macros)
 - #150445 (resolve: Preserve binding scopes in ambiguity errors)
 - #150580 (Document `panic!` in `Iterator::last` for #149707)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 57b2e65 into rust-lang:main Jan 2, 2026
11 checks passed
@rustbot rustbot added this to the 1.94.0 milestone Jan 2, 2026
rust-timer added a commit that referenced this pull request Jan 2, 2026
Rollup merge of #150073 - daxpedda:internal-unstable-asm-experimental-arch, r=nnethercote

Make `asm_experimental_arch` work in `allow_internal_unstable` macros

This change makes it possible to use unstable `asm!`, usually requiring `feature(asm_experimental_arch)`, in proc-macros with the `allow_internal_unstable` attribute.

The test was added on a target where `asm!` is unstable: Wasm. However, this affects *any* target with an unstable `asm!` implementation.
@bors
Copy link
Collaborator

bors commented Jan 2, 2026

⌛ Testing commit 96c165b with merge 1b43252...

@jhpratt
Copy link
Member

jhpratt commented Jan 4, 2026

@bors retry r- (sync)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in 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.

5 participants