File tree Expand file tree Collapse file tree 2 files changed +6
-5
lines changed Expand file tree Collapse file tree 2 files changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,9 @@ version = "0.1.0"
4
4
authors = [" The Rust Project Developers" ]
5
5
license = " MIT OR Apache-2.0"
6
6
7
+ [features ]
8
+ asm_black_box = []
9
+
7
10
[dependencies ]
8
11
libc = " 0.2"
9
12
getopts = " 0.2"
Original file line number Diff line number Diff line change 24
24
// build off of.
25
25
26
26
#![ crate_name = "test" ]
27
- #![ unstable( feature = "test" , issue = "27812" ) ]
28
27
#![ crate_type = "rlib" ]
29
28
#![ crate_type = "dylib" ]
30
29
#![ doc( html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png" ,
33
32
test( attr( deny( warnings) ) ) ) ]
34
33
#![ cfg_attr( not( stage0) , deny( warnings) ) ]
35
34
36
- #![ feature( asm) ]
35
+ #![ cfg_attr ( feature = "asm_black_box" , feature ( asm) ) ]
37
36
#![ feature( set_stdio) ]
38
- #![ feature( staged_api) ]
39
37
#![ feature( time2) ]
40
38
41
39
extern crate getopts;
@@ -1187,14 +1185,14 @@ impl MetricMap {
1187
1185
/// elimination.
1188
1186
///
1189
1187
/// This function is a no-op, and does not even read from `dummy`.
1190
- #[ cfg( not( all( target_os = "nacl" , target_arch = "le32" ) ) ) ]
1188
+ #[ cfg( all ( feature = "asm_black_box" , not( all( target_os = "nacl" , target_arch = "le32" ) ) ) ) ]
1191
1189
pub fn black_box < T > ( dummy : T ) -> T {
1192
1190
// we need to "use" the argument in some way LLVM can't
1193
1191
// introspect.
1194
1192
unsafe { asm ! ( "" : : "r" ( & dummy) ) }
1195
1193
dummy
1196
1194
}
1197
- #[ cfg( all( target_os = "nacl" , target_arch = "le32" ) ) ]
1195
+ #[ cfg( not ( all( feature = "asm_black_box" , not ( all ( target_os = "nacl" , target_arch = "le32" ) ) ) ) ) ]
1198
1196
#[ inline( never) ]
1199
1197
pub fn black_box < T > ( dummy : T ) -> T {
1200
1198
dummy
You can’t perform that action at this time.
0 commit comments