3
3
//! This basically just disassembles the current executable and then parses the
4
4
//! output once globally and then provides the `assert` function which makes
5
5
//! assertions about the disassembly of a function.
6
+ #![ feature( test) ] // For black_box
6
7
#![ allow( clippy:: missing_docs_in_private_items, clippy:: print_stdout) ]
7
8
8
9
extern crate assert_instr_macro;
@@ -16,7 +17,7 @@ extern crate cfg_if;
16
17
17
18
pub use assert_instr_macro:: * ;
18
19
pub use simd_test_macro:: * ;
19
- use std:: { cmp, collections:: HashSet , env, hash, str, sync:: atomic:: AtomicPtr } ;
20
+ use std:: { cmp, collections:: HashSet , env, hash, hint :: black_box , str, sync:: atomic:: AtomicPtr } ;
20
21
21
22
cfg_if ! {
22
23
if #[ cfg( target_arch = "wasm32" ) ] {
@@ -63,7 +64,10 @@ impl hash::Hash for Function {
63
64
///
64
65
/// This asserts that the function at `fnptr` contains the instruction
65
66
/// `expected` provided.
66
- pub fn assert ( _fnptr : usize , fnname : & str , expected : & str ) {
67
+ pub fn assert ( shim_addr : usize , fnname : & str , expected : & str ) {
68
+ // Make sure that the shim is not removed
69
+ black_box ( shim_addr) ;
70
+
67
71
//eprintln!("shim name: {}", fnname);
68
72
let function = & DISASSEMBLY
69
73
. get ( & Function :: new ( fnname) )
0 commit comments