creusot-std 0.14.0

Standard library of Creusot: provides specification macros, contracts for Rust standard library and logic helpers
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use crate::prelude::*;
#[cfg(creusot)]
use core::borrow::Borrow;

// "In particular Eq, Ord and Hash must be equivalent for borrowed and owned values:
// x.borrow() == y.borrow() should give the same result as x == y."
// https://doc.rust-lang.org/std/borrow/trait.Borrow.html

extern_spec! {
    mod core {
        mod borrow {
            trait Borrow<Borrowed: ?Sized + DeepModel<DeepModelTy = Self::DeepModelTy>>: DeepModel {
                #[ensures(result.deep_model() == self.deep_model())]
                fn borrow(&self) -> &Borrowed;
            }
        }
    }
}