-
Notifications
You must be signed in to change notification settings - Fork 13.8k
Port all viable contracts from verify-rust-std #147148
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
base: master
Are you sure you want to change the base?
Port all viable contracts from verify-rust-std #147148
Conversation
Ports over all contracts (other than those for `Alignment`, see the separate PR) that can be expressed using the current, experimental contracts syntax. (Notably, this excludes all contracts that refer to pointer validity.)
Updated via `./x.py test mir-opt --bless --stage 1`.
} | ||
|
||
#[inline] | ||
#[allow(unused_parens)] |
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.
(I know it's a draft so feel free to ignore, but I'd really prefer to see that lint bug being fixed first before merging so we don't have add all the allow)
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.
I believe this is fixed as part of #144438. Not sure exactly what caused the issue in the first place.
The job Click to see the possible cause of the failure (guessed by this bot)
|
#[core::contracts::requires(!self.overflowing_mul(rhs).1)] | ||
pub const unsafe fn unchecked_mul(self, rhs: Self) -> Self { | ||
assert_unsafe_precondition!( | ||
check_language_ub, |
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.
Many contracts are duplicating existing assert_unsafe_precondition!()
. How should we handle this duplication?
+ _7 = &_4; | ||
+ _6 = {closure@$SRC_DIR/core/src/num/uint_macros.rs:LL:COL} { 0: copy _7 }; | ||
+ StorageDead(_7); | ||
+ _5 = contract_check_requires::<{closure@core::num::<impl u16>::unchecked_shl::{closure#0}}>(move _6) -> [return: bb1, unwind continue]; |
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.
All these extra checks would slow down debug builds a lot in terms of runtime performance and likely a bit in build times, right? Can we check by how much exactly?
☔ The latest upstream changes (presumably #142771) made this pull request unmergeable. Please resolve the merge conflicts. |
Ports over all contracts (other than those for
Alignment
, see the separate PR) that can be expressed using the current, experimental contracts syntax. (Notably, this excludes all contracts that refer to pointer validity.)