Skip to content

Mention that asm! is unsafe - #2365

Open
N1ark wants to merge 1 commit into
rust-lang:masterfrom
N1ark:asm
Open

N1ark wants to merge 1 commit into
rust-lang:masterfrom
N1ark:asm

Conversation

@N1ark

@N1ark N1ark commented Sep 24, 2026 •

Copy link
Copy Markdown
Member
this is my first PR to the reference, apologies if this should have gone through an issue or more discussion before opening

Add a line in unsafety.md and inline-assembly.md pointing out that asm! requires unsafe.

This is already briefly mentioned in inline-assembly.md, but feels very off-handed and lacklustre:

Programmers should exercise appropriate care, as invoking this unsafe capability comes with assuming the responsibility of not violating rules of both the compiler or the architecture.

Unrelatedly; i believe the header level for asm.validity is wrong and should only be an h2? since it currently sits inside "Rules for naked inline assembly", while mentioning asm!. note that it is immediately followed by "Directives support", which also seems to need to be a h2 rather than h3. happy to do those changes here or separately.

disclaimer i have very little knowledge on asm! -- i primarily care about the documentation surrounding unsafe to be exhaustive.

@rustbot rustbot added the S-waiting-on-review Status: The marked PR is awaiting review from a maintainer label Sep 24, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: The marked PR is awaiting review from a maintainer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants