about summary refs log tree commit diff
path: root/library/stdarch/crates/assert-instr-macro
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2019-01-30 15:11:35 -0800
committerGitHub <noreply@github.com>2019-01-30 15:11:35 -0800
commitcf738b0d36338b0a47a45a7ccb336d2464ee4107 (patch)
tree8e618706d0619aa2e162bb28b7bb7f0e37b6a898 /library/stdarch/crates/assert-instr-macro
parent69e7d7ac3af7916cd37accb28e3cbf17317fd88b (diff)
downloadrust-cf738b0d36338b0a47a45a7ccb336d2464ee4107.tar.gz
rust-cf738b0d36338b0a47a45a7ccb336d2464ee4107.zip
Attempt to fix tests on master (#662)
* Attempt to fix tests on master

* Make all doctests use items from the real `std` rather than this
  crate, it's just easier
* Handle debuginfo weirdness by flagging functions as `no_mangle` that
  we're looking for instructions within.

* Handle double undescores in symbol names
Diffstat (limited to 'library/stdarch/crates/assert-instr-macro')
-rw-r--r--library/stdarch/crates/assert-instr-macro/src/lib.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/library/stdarch/crates/assert-instr-macro/src/lib.rs b/library/stdarch/crates/assert-instr-macro/src/lib.rs
index 3a6e0dfb9ce..4525398b759 100644
--- a/library/stdarch/crates/assert-instr-macro/src/lib.rs
+++ b/library/stdarch/crates/assert-instr-macro/src/lib.rs
@@ -49,7 +49,7 @@ pub fn assert_instr(
         .replace(':', "_")
         .replace(|c: char| c.is_whitespace(), "");
     let assert_name = syn::Ident::new(&format!("assert_{}_{}", name, instr_str), name.span());
-    let shim_name = syn::Ident::new(&format!("{}_shim", name), name.span());
+    let shim_name = syn::Ident::new(&format!("{}_shim_{}", name, instr_str), name.span());
     let mut inputs = Vec::new();
     let mut input_vals = Vec::new();
     let ret = &func.decl.output;
@@ -99,6 +99,7 @@ pub fn assert_instr(
     let shim_name_str = format!("{}{}", shim_name, assert_name);
     let to_test = quote! {
         #attrs
+        #[no_mangle]
         unsafe extern #abi fn #shim_name(#(#inputs),*) #ret {
             // The compiler in optimized mode by default runs a pass called
             // "mergefunc" where it'll merge functions that look identical.