Skip to content

Commit

Permalink
fix test on 32 bit systems
Browse files Browse the repository at this point in the history
  • Loading branch information
lcnr committed Sep 9, 2020
1 parent 4226a17 commit 74e0719
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
5 changes: 3 additions & 2 deletions src/test/ui/const_evaluatable/function-call.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
// check-pass
#![warn(const_evaluatable_unchecked)]

const fn foo<T>() -> 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::<T>()
} else {
8
Expand Down
8 changes: 2 additions & 6 deletions src/test/ui/const_evaluatable/function-call.stderr
Original file line number Diff line number Diff line change
@@ -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::<T>()];
| ^^^^^^^^^^
|
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 <https://github.com/rust-lang/rust/issues/76200>

Expand Down

0 comments on commit 74e0719

Please sign in to comment.