Skip to content

Commit 74e0719

Browse files
committed
fix test on 32 bit systems
1 parent 4226a17 commit 74e0719

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

src/test/ui/const_evaluatable/function-call.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
// check-pass
2-
#![warn(const_evaluatable_unchecked)]
32

43
const fn foo<T>() -> usize {
5-
if std::mem::size_of::<*mut T>() < 8 { // size of *mut T does not depend on T
4+
// We might instead branch on `std::mem::size_of::<*mut T>() < 8` here,
5+
// which would cause this function to fail on 32 bit systems.
6+
if false {
67
std::mem::size_of::<T>()
78
} else {
89
8

src/test/ui/const_evaluatable/function-call.stderr

+2-6
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
11
warning: cannot use constants which depend on generic parameters in types
2-
--> $DIR/function-call.rs:13:17
2+
--> $DIR/function-call.rs:14:17
33
|
44
LL | let _ = [0; foo::<T>()];
55
| ^^^^^^^^^^
66
|
7-
note: the lint level is defined here
8-
--> $DIR/function-call.rs:2:9
9-
|
10-
LL | #![warn(const_evaluatable_unchecked)]
11-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
7+
= note: `#[warn(const_evaluatable_unchecked)]` on by default
128
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
139
= note: for more information, see issue #76200 <https://github.com/rust-lang/rust/issues/76200>
1410

0 commit comments

Comments
 (0)