Skip to content

Conversation

@tautschnig
Copy link
Contributor

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.)

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Sep 29, 2025
}

#[inline]
#[allow(unused_parens)]
Copy link
Member

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)

Copy link
Contributor

@dawidl022 dawidl022 Oct 1, 2025

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.

@rust-log-analyzer

This comment has been minimized.

#[core::contracts::requires(!self.overflowing_mul(rhs).1)]
pub const unsafe fn unchecked_mul(self, rhs: Self) -> Self {
assert_unsafe_precondition!(
check_language_ub,
Copy link
Member

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];
Copy link
Member

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?

@bors
Copy link
Collaborator

bors commented Oct 3, 2025

☔ The latest upstream changes (presumably #142771) made this pull request unmergeable. Please resolve the merge conflicts.

@tautschnig tautschnig force-pushed the upstream-contracts/not-alignment branch from fc56734 to f47406e Compare October 29, 2025 12:46
@rust-log-analyzer

This comment has been minimized.

@tautschnig tautschnig force-pushed the upstream-contracts/not-alignment branch from f47406e to fa3bb5c Compare October 29, 2025 18:33
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`.
@tautschnig tautschnig force-pushed the upstream-contracts/not-alignment branch from fa3bb5c to b38b44c Compare October 29, 2025 19:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants