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

Specs for raw pointers & ghost ownership for pointers #1169

Merged
merged 8 commits into from
Nov 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions creusot-contracts/src/ghost.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,23 @@ impl<T: ?Sized> GhostBox<T> {
}
}

/// Conjures a `GhostBox<T>` out of thin air.
/// This would be unsound in verified code, hence the `false` precondition.
/// This function is nevertheless useful to create a `GhostBox` in "trusted"
/// contexts, when axiomatizing an API that is believed to be sound for
/// external reasons.
#[requires(false)]
pub fn conjure() -> Self {
#[cfg(creusot)]
{
loop {}
}
#[cfg(not(creusot))]
{
GhostBox(std::marker::PhantomData)
}
}

// Internal function to easily create a GhostBox in non-creusot mode.
#[cfg(not(creusot))]
#[doc(hidden)]
Expand Down
326 changes: 0 additions & 326 deletions creusot-contracts/src/ghost_ptr.rs

This file was deleted.

3 changes: 2 additions & 1 deletion creusot-contracts/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -216,9 +216,9 @@ pub mod snapshot {
impl<T: ?Sized> Copy for Snapshot<T> {}
}

pub mod ghost_ptr;
pub mod invariant;
pub mod model;
pub mod ptr_own;
pub mod resolve;
pub mod util;
pub mod well_founded;
Expand Down Expand Up @@ -251,6 +251,7 @@ mod base_prelude {
pub use crate::std::{
iter::{SkipExt as _, TakeExt as _},
ops::{FnExt as _, FnMutExt as _, FnOnceExt as _, RangeInclusiveExt as _},
ptr::PointerExt as _,
slice::SliceExt as _,
};
}
Expand Down
Loading
Loading