creusot_contracts/std/
borrow.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
use crate::*;
use ::std::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 std {
        mod borrow {
            trait Borrow<Borrowed>
            where Borrowed: ?Sized
            {
                #[ensures(result.deep_model() == self.deep_model())]
                fn borrow(&self) -> &Borrowed
                where
                    Self: DeepModel,
                    Borrowed: DeepModel<DeepModelTy = Self::DeepModelTy>;
            }
        }
    }
}