fix test on 32 bit systems
This commit is contained in:
parent
4226a17845
commit
74e07198a0
2 changed files with 5 additions and 8 deletions
|
@ -1,8 +1,9 @@
|
||||||
// check-pass
|
// check-pass
|
||||||
#![warn(const_evaluatable_unchecked)]
|
|
||||||
|
|
||||||
const fn foo<T>() -> usize {
|
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>()
|
std::mem::size_of::<T>()
|
||||||
} else {
|
} else {
|
||||||
8
|
8
|
||||||
|
|
|
@ -1,14 +1,10 @@
|
||||||
warning: cannot use constants which depend on generic parameters in types
|
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>()];
|
LL | let _ = [0; foo::<T>()];
|
||||||
| ^^^^^^^^^^
|
| ^^^^^^^^^^
|
||||||
|
|
|
|
||||||
note: the lint level is defined here
|
= note: `#[warn(const_evaluatable_unchecked)]` on by default
|
||||||
--> $DIR/function-call.rs:2:9
|
|
||||||
|
|
|
||||||
LL | #![warn(const_evaluatable_unchecked)]
|
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
= 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>
|
= note: for more information, see issue #76200 <https://github.com/rust-lang/rust/issues/76200>
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue