Skip to content

Instrument the Rust standard library with safety contracts #126

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

Open
1 of 8 tasks
nikomatsakis opened this issue Jul 25, 2024 · 8 comments
Open
1 of 8 tasks

Instrument the Rust standard library with safety contracts #126

nikomatsakis opened this issue Jul 25, 2024 · 8 comments
Assignees
Milestone

Comments

@nikomatsakis
Copy link
Contributor

nikomatsakis commented Jul 25, 2024

Metadata
Point of contact @celinval
Team(s) compiler, libs
Goal document 2025h1/std-contracts

Summary

Finish the implementation of the contract attributes proposed in the compiler [MCP-759],
and port safety contracts from the [verify-rust-std] fork to the Rust standard library.

Tasks and status

  • Discussion and moral support (libs Team)

Experimental Contract attributes

Standard Library Contracts

@nikomatsakis nikomatsakis added this to the 2024h2 milestone Jul 25, 2024
@rust-lang rust-lang locked and limited conversation to collaborators Jul 25, 2024
@nikomatsakis
Copy link
Contributor Author

This issue is intended for status updates only.

For general questions or comments, please contact the owner(s) directly.

@celinval
Copy link
Contributor

Update: So far we have integrated Kani into our repository and we have successfully instrumented and verified 22 functions in the standard library. We have also published 11 challenges.

We are currently investigating the integration of other tools, such as Gillian Rust and Verus.

@celinval
Copy link
Contributor

celinval commented Oct 1, 2024

Key developments: We have welcome the help of students from the CMU Practicum Project. They have started writing functions contracts that include the safety conditions for some unsafe functions in the core library, as well as verifying that safe abstractions respect those pre-conditions and are indeed safe.
Help wanted: Contracts and verification harnesses are being added to our existing fork: https://github.com/model-checking/verify-rust-std. Help needed to write more contracts, to integrate new tools, to review pull requests or to participate in the repository discussions.

@celinval
Copy link
Contributor

Key developments: A new partnership between the Rust Foundation and AWS will help fund this effort [ref]. The verification challenges in the verify-rust-std fork now have financial rewards for those completing them.
Help wanted: Help needed to write more contracts, to integrate new tools, to review pull requests or to participate in the repository discussions.

@celinval
Copy link
Contributor

celinval commented Jan 3, 2025

Key developments: We have written and verified around 220 safety contracts in the verify-rust-std fork. 3 out of 14 challenges have been solved. We have successfully integrated Kani in the repository CI, and we are working on the integration of 2 other verification tools: VeriFast and Goto-transcoder (ESBMC)

@nikomatsakis nikomatsakis modified the milestones: 2024h2, 2025h1 Feb 18, 2025
@nikomatsakis
Copy link
Contributor Author

This is a continuing project goal, and the updates below this comment will be for the new period 2025h1

@nikomatsakis nikomatsakis changed the title Survey tools suitability for Std safety verification Instrument the Rust standard library with safety contracts Feb 26, 2025
@celinval
Copy link
Contributor

We have been able to merge the initial support for contracts in the Rust compiler under the contracts unstable feature. @tautschnig has created the first PR to incorporate contracts in the standard library and uncovered a few limitations that we've been working on.

@celinval
Copy link
Contributor

celinval commented Apr 30, 2025

We fixed issue rust-lang/rust#136925 that was blocking contract annotations on constant functions, which unblocks the initial PR to add some contract annotations in the standard library (rust-lang/rust#136578). The PR currently triggers a CI failure which we are investigating.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants