forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add safety preconditions to alloc/src/boxed/thin.rs
Note that I've added `#[requires]` attributes to represent the safety conditions as code contracts. These are based on the "SAFETY:" comments in the original code. The conditions are: 1. For `with_header`, we require that the pointer is aligned. 2. For `drop`, we require that the value pointer is either null or aligned. 3. For `header`, we require that the pointer is aligned. These contracts ensure that the safety conditions mentioned in the comments are checked at compile-time or runtime, depending on the contract system used.
- Loading branch information
1 parent
3a967e3
commit bb44f4b
Showing
1 changed file
with
32 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters