From 74e07198a08fea62ab2fba9ae258f4d118d7dffe Mon Sep 17 00:00:00 2001 From: Bastian Kauschke Date: Wed, 9 Sep 2020 20:10:23 +0200 Subject: [PATCH] fix test on 32 bit systems --- src/test/ui/const_evaluatable/function-call.rs | 5 +++-- src/test/ui/const_evaluatable/function-call.stderr | 8 ++------ 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/test/ui/const_evaluatable/function-call.rs b/src/test/ui/const_evaluatable/function-call.rs index 9b54a541e6906..b5de66621c50e 100644 --- a/src/test/ui/const_evaluatable/function-call.rs +++ b/src/test/ui/const_evaluatable/function-call.rs @@ -1,8 +1,9 @@ // check-pass -#![warn(const_evaluatable_unchecked)] const fn foo() -> usize { - if std::mem::size_of::<*mut T>() < 8 { // size of *mut T does not depend on T + // We might instead branch on `std::mem::size_of::<*mut T>() < 8` here, + // which would cause this function to fail on 32 bit systems. + if false { std::mem::size_of::() } else { 8 diff --git a/src/test/ui/const_evaluatable/function-call.stderr b/src/test/ui/const_evaluatable/function-call.stderr index a63a2643ad2c2..0d8463714e8df 100644 --- a/src/test/ui/const_evaluatable/function-call.stderr +++ b/src/test/ui/const_evaluatable/function-call.stderr @@ -1,14 +1,10 @@ warning: cannot use constants which depend on generic parameters in types - --> $DIR/function-call.rs:13:17 + --> $DIR/function-call.rs:14:17 | LL | let _ = [0; foo::()]; | ^^^^^^^^^^ | -note: the lint level is defined here - --> $DIR/function-call.rs:2:9 - | -LL | #![warn(const_evaluatable_unchecked)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: `#[warn(const_evaluatable_unchecked)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #76200