Skip to content
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

Update unstable docs for asm! macro #88281

Merged
merged 2 commits into from
Aug 30, 2021
Merged

Conversation

asquared31415
Copy link
Contributor

This adds documentation that SPIR-V is supported, expands on the restrictions for labels, and has some minor cleanups or clarifications.

r? @joshtriplett

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Aug 24, 2021
@asquared31415
Copy link
Contributor Author

cc @Amanieu @bjorn3 @nbdd0121

@@ -373,9 +367,15 @@ unsafe {

## Labels

The compiler is allowed to instantiate multiple copies an `asm!` block, for example when the function containing it is inlined in multiple places. As a consequence, you should only use GNU assembler [local labels] inside inline assembly code. Defining symbols in assembly code may lead to assembler and/or linker errors due to duplicate symbol definitions.
Any reuse of a named label, local or otherwise, can result in a assembler or linker error in the best case, ICEs or segfaults in the compiler in other cases, and generally unexpected behavior. Reuse of a named label can happen in a variety of ways including:
Copy link
Member

Choose a reason for hiding this comment

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

ICEs and segfaults caused by assembly code should be reported as bugs in the compiler and fixed, they are definitely not an expected behavior. I think just mentioning an assembler/linker error is enough.

@inquisitivecrystal inquisitivecrystal added A-docs Area: Documentation for any part of the project, including the compiler, standard library, and tools A-inline-assembly Area: Inline assembly (`asm!(…)`) T-lang Relevant to the language team, which will review and decide on the PR/issue. labels Aug 24, 2021
Copy link
Member

@Amanieu Amanieu left a comment

Choose a reason for hiding this comment

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

@bors r+

@asquared31415
Copy link
Contributor Author

I don't think that registered, doesn't bors normally immediately respond with a confirmation?

@bjorn3
Copy link
Member

bjorn3 commented Aug 30, 2021

@bors r=Amanieu

@bors
Copy link
Contributor

bors commented Aug 30, 2021

📌 Commit 8769b99 has been approved by Amanieu

@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 Aug 30, 2021
@bors
Copy link
Contributor

bors commented Aug 30, 2021

⌛ Testing commit 8769b99 with merge 13edc17...

@bors
Copy link
Contributor

bors commented Aug 30, 2021

☀️ Test successful - checks-actions
Approved by: Amanieu
Pushing 13edc17 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Aug 30, 2021
@bors bors merged commit 13edc17 into rust-lang:master Aug 30, 2021
@rustbot rustbot added this to the 1.56.0 milestone Aug 30, 2021
@asquared31415 asquared31415 deleted the asm-docs branch September 2, 2021 13:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-docs Area: Documentation for any part of the project, including the compiler, standard library, and tools A-inline-assembly Area: Inline assembly (`asm!(…)`) merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-lang Relevant to the language team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants