Rollup merge of #76823 - RalfJung:black-box-warn, r=joshtriplett

black_box: silence unused_mut warning when building with cfg(miri)
This commit is contained in:
Ralf Jung 2020-09-20 12:08:24 +02:00 committed by GitHub
commit df4e4ef2b9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -111,7 +111,7 @@ pub fn spin_loop() {
#[cfg_attr(not(miri), inline)]
#[cfg_attr(miri, inline(never))]
#[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