7

Add support for specifying multiple clobber_abi in `asm!` by asquared31415 · Pul...

 2 years ago
source link: https://github.com/rust-lang/rust/pull/89316
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

@@ -2744,7 +2744,7 @@ pub enum ItemKind {

}

#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]

rustc_data_structures::static_assert_size!(ItemKind, 112);

Copy link

Contributor

@Amanieu Amanieu on Sep 29

Consider boxing the InlineAsm to avoid increasing the size of ItemKind.

@@ -27,11 +28,13 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {

.emit();

}

let mut clobber_abi = None;

let mut clobber_abis = FxHashSet::default();

Copy link

Contributor

@Amanieu Amanieu on Sep 29

Use a HashMap keyed on the ABI, otherwise 2 identical ABIs with different spans will both be included.

@@ -210,7 +210,7 @@ fn parse_args<'a>(

.span_labels(args.options_spans.clone(), "previous options")

.span_label(span, "argument")

.emit();

} 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")

Copy link

Contributor

@Amanieu Amanieu on Sep 29

I'd like this to point to all the clobber_abi spans, not just the last one.

@@ -322,7 +322,7 @@ fn parse_args<'a>(

// Bail out now since this is likely to confuse MIR

return Err(err);

}

if let Some((_, abi_span)) = args.clobber_abi {

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!`");

Copy link

Contributor

@Amanieu Amanieu on Sep 29

Same here.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK