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
This commit is contained in:
Alex Crichton
2019-01-30 15:11:35 -08:00
committed by GitHub
parent 69e7d7ac3a
commit cf738b0d36
10 changed files with 15 additions and 82 deletions

View File

@@ -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.