Description
Proposal
-Z asm-comments
currently controls two things: stripping all comments from assembly (PreserveAsmComments
), and LLVM emitting its own verbose comments (AsmVerbose
). By default this option is set to false, so even handwritten comments get stripped:
use core::arch::asm;
pub fn foo() {
unsafe {
asm!("nop # hello");
asm!("nop // world");
}
}
The output doesn't have the "hello" and "world" comments anywhere:
example::foo::h61551f5681388f69:
push rax
#APP
nop
#NO_APP
#APP
nop
#NO_APP
pop rax
ret
Link: https://rust.godbolt.org/z/jxdEWY6oG
There doesn't seem to be a good reason to strip handwritten assembly comments ever (within the string), since a user can just write Rust comments if they don't want something to show up in the binary. So, proposal:
- Rename the configuration flag to
-Z verbose-asm
, which will be consistent with Clang/GCC - Change that config option to only control LLVM-generated comments (
AsmVerbose
) - Change
PreserveAsmComments
to be always true - Start an actual tracking issue so
-Z verbose-asm
might wind up stabilized one day
The flag was originally added at rust-lang/rust#53290
See background discussion at https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/Comments.20in.20.60asm!.60
Mentors or Reviewers
I can do the change
Process
The main points of the Major Change Process are as follows:
- File an issue describing the proposal.
- A compiler team member or contributor who is knowledgeable in the area can second by writing
@rustbot second
.- Finding a "second" suffices for internal changes. If however, you are proposing a new public-facing feature, such as a
-C flag
, then full team check-off is required. - Compiler team members can initiate a check-off via
@rfcbot fcp merge
on either the MCP or the PR.
- Finding a "second" suffices for internal changes. If however, you are proposing a new public-facing feature, such as a
- Once an MCP is seconded, the Final Comment Period begins. If no objections are raised after 10 days, the MCP is considered approved.
You can read more about Major Change Proposals on forge.
Comments
This issue is not meant to be used for technical discussion. There is a Zulip stream for that. Use this issue to leave procedural comments, such as volunteering to review, indicating that you second the proposal (or third, etc), or raising a concern that you would like to be addressed.