diff --git a/src/libcollections/bit.rs b/src/libcollections/bit.rs index c1b34c52fcc15..82e5af67ae316 100644 --- a/src/libcollections/bit.rs +++ b/src/libcollections/bit.rs @@ -2526,7 +2526,7 @@ mod bitv_bench { for _ in range(0u, 100) { bitv |= 1 << ((r.next_u32() as uint) % u32::BITS); } - black_box(&bitv) + black_box(&bitv); }); } @@ -2538,7 +2538,7 @@ mod bitv_bench { for _ in range(0u, 100) { bitv.set((r.next_u32() as uint) % BENCH_BITS, true); } - black_box(&bitv) + black_box(&bitv); }); } diff --git a/src/libcollections/str.rs b/src/libcollections/str.rs index ccf654ac0a048..7aa87ffaae260 100644 --- a/src/libcollections/str.rs +++ b/src/libcollections/str.rs @@ -2841,7 +2841,7 @@ mod bench { let s = "ศไทย中华Việt Nam; Mary had a little lamb, Little lamb"; b.iter(|| { - for ch in s.chars() { black_box(ch) } + for ch in s.chars() { black_box(ch); } }); } @@ -2869,7 +2869,7 @@ mod bench { let s = "ศไทย中华Việt Nam; Mary had a little lamb, Little lamb"; b.iter(|| { - for ch in s.chars().rev() { black_box(ch) } + for ch in s.chars().rev() { black_box(ch); } }); } diff --git a/src/libtest/lib.rs b/src/libtest/lib.rs index c4cb53d6cb7b6..c00246598c303 100644 --- a/src/libtest/lib.rs +++ b/src/libtest/lib.rs @@ -1332,10 +1332,11 @@ impl MetricMap { /// elimination. /// /// This function is a no-op, and does not even read from `dummy`. -pub fn black_box(dummy: T) { +pub fn black_box(dummy: T) -> T { // we need to "use" the argument in some way LLVM can't // introspect. unsafe {asm!("" : : "r"(&dummy))} + dummy }