Skip to content
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

Invariant trait #87

Open
wants to merge 16 commits into
base: main
Choose a base branch
from
Open

Conversation

carolynzech
Copy link

Adds an Invariant trait to core::ub_checks, and adds two invariants for Alignment and Layout.

One call-out: Kani's invariant trait enforces that the type is sized, but I wasn't sure why that would be necessary, so I didn't add it here.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 and MIT licenses.

@carolynzech carolynzech requested a review from a team as a code owner September 18, 2024 17:10
Copy link

@celinval celinval left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @carolynzech !

library/core/src/alloc/layout.rs Outdated Show resolved Hide resolved
library/core/src/alloc/layout.rs Outdated Show resolved Hide resolved
library/core/src/ptr/alignment.rs Outdated Show resolved Hide resolved
library/core/src/ub_checks.rs Show resolved Hide resolved
Copy link

@celinval celinval left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please also add empty implementations for the Invariant trait for the primitive types?

library/core/src/alloc/layout.rs Outdated Show resolved Hide resolved
Copy link
Member

@tautschnig tautschnig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

Co-authored-by: Celina G. Val <[email protected]>
Copy link

@celinval celinval left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please remove the unsafe code.

library/contracts/safety/src/lib.rs Show resolved Hide resolved
library/core/src/ptr/alignment.rs Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants