black_box: silence unused_mut warning when building with cfg(miri)

This commit is contained in:
Ralf Jung 2020-09-17 08:59:30 +02:00
parent 95386b656e
commit 1dd3df6738

View File

@ -110,7 +110,7 @@ pub fn spin_loop() {
/// backend used. Programs cannot rely on `black_box` for *correctness* in any way.
#[inline]
#[unstable(feature = "test", issue = "50297")]
#[allow(unreachable_code)] // this makes #[cfg] a bit easier below.
#[cfg_attr(miri, allow(unused_mut))]
pub fn black_box<T>(mut dummy: T) -> T {
// We need to "use" the argument in some way LLVM can't introspect, and on
// targets that support it we can typically leverage inline assembly to do