Add support for specifying multiple clobber_abi in asm!#89316
Add support for specifying multiple clobber_abi in asm!#89316bors merged 4 commits intorust-lang:masterfrom
asm!#89316Conversation
|
One concern I have is the increase of the size of ast::ItemKind, if that is a problem I think that it can be fixed with some boxed slices? |
77726da to
db8af3f
Compare
| } | ||
|
|
||
| #[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))] | ||
| rustc_data_structures::static_assert_size!(ItemKind, 112); |
There was a problem hiding this comment.
Consider boxing the InlineAsm to avoid increasing the size of ItemKind.
| } | ||
|
|
||
| let mut clobber_abi = None; | ||
| let mut clobber_abis = FxHashSet::default(); |
There was a problem hiding this comment.
Use a HashMap keyed on the ABI, otherwise 2 identical ABIs with different spans will both be included.
| } else if let Some((_, abi_span)) = args.clobber_abi { | ||
| } else if let Some(&(_, abi_span)) = args.clobber_abis.last() { | ||
| ecx.struct_span_err(span, "arguments are not allowed after clobber_abi") | ||
| .span_label(abi_span, "clobber_abi") |
There was a problem hiding this comment.
I'd like this to point to all the clobber_abi spans, not just the last one.
| if let Some(&(_, abi_span)) = args.clobber_abis.last() { | ||
| if is_global_asm { | ||
| let err = | ||
| ecx.struct_span_err(abi_span, "`clobber_abi` cannot be used with `global_asm!`"); |
|
Can you add this to grammar in the asm documentation in the unstable book? Also in the reference-level explanation add a note saying that |
|
@bors r+ |
|
📌 Commit b159d95 has been approved by |
… r=Amanieu Add support for specifying multiple clobber_abi in `asm!` r? `@Amanieu` cc rust-lang#72016 `@rustbot` label: +A-inline-assembly +F-asm
|
@bors r- Failed in #89420 (comment) |
nbdd0121
left a comment
There was a problem hiding this comment.
I wonder if the syntax should be
clobber_abi("A"), clobber_abi("B")or
clobber_abi("A", "B")There was a problem hiding this comment.
| if args.clobber_abis.len() > 0 { | |
| if !args.clobber_abis.is_empty() { |
|
Hmm actually I slightly prefer |
|
I like that syntax better too |
59bae7f to
887caeb
Compare
There was a problem hiding this comment.
| let mut abis = format!("`{}`", supported_abis[0]); | |
| for m in &supported_abis[1..] { | |
| let _ = write!(abis, ", `{}`", m); | |
| } | |
| let abis = supported_abis.join(","); |
There was a problem hiding this comment.
The code there adds ` around the abi name, which can't be replicated using just join like that.
There was a problem hiding this comment.
I think this shall be a Vec. If there are multiple occurrence of the same ABI then it should be error (and emitted during macro expansion), not silently merged.
There was a problem hiding this comment.
Wouldn't this still geenrate multiple clobber_abis?
There was a problem hiding this comment.
I think it's best to treat non-string-literal case and no ABI specified case separately (given that this is now a comma delimited list), so if the user writes clobber_abi() then we should say "at least an ABI name should be specified in clobber_abi" rather than just "expected string literal".
This comment has been minimized.
This comment has been minimized.
5625ff6 to
1114234
Compare
|
@bors r+ |
|
📌 Commit 111423454809b548c7d8ad195d100046d99dcd98 has been approved by |
|
⌛ Testing commit 111423454809b548c7d8ad195d100046d99dcd98 with merge f1b081eb34e3a1756703a5cd7884ae8132eb52ef... |
This comment has been minimized.
This comment has been minimized.
Allow multiple clobber_abi in asm Update docs Fix aarch64 test Combine abis Emit duplicate ABI error, empty ABI list error multiple clobber_abi
c77cd0a to
3e799e4
Compare
|
@bors r+ |
|
📌 Commit 3e799e4 has been approved by |
|
⌛ Testing commit 3e799e4 with merge 4de694226be8edf717148c78451fac31fb9ff4f5... |
This comment has been minimized.
This comment has been minimized.
|
💔 Test failed - checks-actions |
|
@bors r+ |
|
📌 Commit e80f300 has been approved by |
|
☀️ Test successful - checks-actions |
|
Finished benchmarking commit (220ed09): comparison url. Summary: This benchmark run did not return any relevant changes. If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf. @rustbot label: -perf-regression |
r? @Amanieu
cc #72016
@rustbot label: +A-inline-assembly +F-asm