-
Couldn't load subscription status.
- Fork 13.9k
Make more arithmetic functions unstably const #68809
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
6742dd7 to
a5f40bb
Compare
A release just happened, so it can't be long until the bootstrap compiler gets bumped. Work is in progress at #68708. |
|
The bootstrap compiler has been bumped |
Co-Authored-By: 9999years <rbt@sent.as>
Co-Authored-By: 9999years <rbt@sent.as>
Co-Authored-By: 9999years <rbt@sent.as>
Co-Authored-By: 9999years <rbt@sent.as>
Co-Authored-By: 9999years <rbt@sent.as>
Co-Authored-By: 9999years <rbt@sent.as>
a5f40bb to
ecad633
Compare
This comment has been minimized.
This comment has been minimized.
a4eee60 to
8d856cb
Compare
This comment has been minimized.
This comment has been minimized.
|
@oli-obk. This should be ready now, and with no conditional compilation. I updated the feature names to jibe with the preexisting This PR also implements five unchecked arithmetic intrinsics in MIRI and marks them as |
Not sure what you want FCP for... landing the gates unstably? That doesn't need FCP, Oliver can just r+. |
1df3d6b to
78f8ad3
Compare
|
Your PR failed (pretty log, raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem. Click to expand the log.I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
|
@bors r+ |
|
📌 Commit 78f8ad3 has been approved by |
… r=oli-obk Make more arithmetic functions unstably const This is a smaller version of rust-lang#66884 (thanks @9999years) that constifies many of the arithmetic functions on integer primitives from rust-lang#53718 that were blocked on rust-lang#49146. This makes the following things unstably const. - `feature = const_int_unchecked_arith` - `intrinsics::unchecked_add` - `intrinsics::unchecked_sub` - `intrinsics::unchecked_mul` - `intrinsics::unchecked_div` - `intrinsics::unchecked_rem` - `feature = const_checked_int_methods` - `checked_add` - `checked_sub` - `checked_mul` - `checked_div` (Uses `intrinsics::unchecked_div` internally) - `checked_rem` (Uses `intrinsics::unchecked_rem` internally) - `checked_neg` - `checked_shl` - `checked_shr` - `checked_abs` - `feature = const_saturating_int_methods` - `saturating_mul` - `saturating_neg` (Uses `intrinsics::unchecked_sub` internally) - `saturating_abs` (Uses `intrinsics::unchecked_sub` internally) - `feature = const_wrapping_int_methods` - `wrapping_div` - `wrapping_rem` - `feature = const_overflowing_int_methods` - `overflowing_div` - `overflowing_rem` - `feature = const_euclidean_int_methods` - `checked_div_euclid` - `checked_rem_euclid` - `wrapping_div_euclid` - `wrapping_rem_euclid` - `overflowing_div_euclid` - `overflowing_rem_euclid` Exponentiation and operations on the `NonZero` types are left to a later PR. r? @oli-obk cc @rust-lang/wg-const-eval @rust-lang/libs
Rollup of 8 pull requests Successful merges: - #68762 (Strip unnecessary subexpression) - #68790 (Improve `merge_from_succ`) - #68809 (Make more arithmetic functions unstably const) - #68832 (Clean up E0264, E0267 and E0268 explanations) - #68840 (On suggesting `#![recursion_limit = "X"]`, note current crate name) - #68846 (doc fix on doc attribute) - #68851 (Fix issue number of `capacity` method) - #68858 (Merge item id stable hashing functions) Failed merges: r? @ghost
Rollup of 8 pull requests Successful merges: - #68762 (Strip unnecessary subexpression) - #68790 (Improve `merge_from_succ`) - #68809 (Make more arithmetic functions unstably const) - #68832 (Clean up E0264, E0267 and E0268 explanations) - #68840 (On suggesting `#![recursion_limit = "X"]`, note current crate name) - #68846 (doc fix on doc attribute) - #68851 (Fix issue number of `capacity` method) - #68858 (Merge item id stable hashing functions) Failed merges: r? @ghost
| if let sym::unchecked_shl | sym::unchecked_shr = intrinsic_name { | ||
| throw_ub_format!("Overflowing shift by {} in `{}`", r_val, intrinsic_name); | ||
| } else { | ||
| throw_ub_format!("Overflow executing `{}`", intrinsic_name); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are there any tests that check that these errors work? Miri has them, but so far I think nothing tests this on the CTFE side.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added in #68937.
…-test, r=RalfJung Test failure of unchecked arithmetic intrinsics in const eval Test that the unchecked arithmetic intrinsics that were made unstably const in rust-lang#68809 emit an error during const-eval if given invalid input. Addresses [this comment](rust-lang#68809 (comment)). r? @RalfJung
This is a smaller version of #66884 (thanks @9999years) that constifies many of the arithmetic functions on integer primitives from #53718 that were blocked on #49146.
This makes the following things unstably const.
feature = const_int_unchecked_arithintrinsics::unchecked_addintrinsics::unchecked_subintrinsics::unchecked_mulintrinsics::unchecked_divintrinsics::unchecked_remfeature = const_checked_int_methodschecked_addchecked_subchecked_mulchecked_div(Usesintrinsics::unchecked_divinternally)checked_rem(Usesintrinsics::unchecked_reminternally)checked_negchecked_shlchecked_shrchecked_absfeature = const_saturating_int_methodssaturating_mulsaturating_neg(Usesintrinsics::unchecked_subinternally)saturating_abs(Usesintrinsics::unchecked_subinternally)feature = const_wrapping_int_methodswrapping_divwrapping_remfeature = const_overflowing_int_methodsoverflowing_divoverflowing_remfeature = const_euclidean_int_methodschecked_div_euclidchecked_rem_euclidwrapping_div_euclidwrapping_rem_euclidoverflowing_div_euclidoverflowing_rem_euclidExponentiation and operations on the
NonZerotypes are left to a later PR.r? @oli-obk
cc @rust-lang/wg-const-eval @rust-lang/libs