-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #892 from xldenis/borroed-ghost
Forbid the use of borrowed variables in ghost code
- Loading branch information
Showing
19 changed files
with
768 additions
and
635 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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
extern crate creusot_contracts; | ||
use creusot_contracts::*; | ||
|
||
pub fn use_borrowed() { | ||
let mut x = gh! { true }; | ||
let r = &mut x; // x = ?, r = (gh true, x) | ||
*r = gh! { !x.inner() }; // r = (gh (not (inner x)), x) | ||
// resolve r: x = gh (not (inner x)) | ||
proof_assert! { x.inner() == !x.inner() } // UNSOUND! | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
error[creusot]: Use of borrowed variable x | ||
--> borrowed_ghost.rs:7:10 | ||
| | ||
7 | *r = gh! { !x.inner() }; // r = (gh (not (inner x)), x) | ||
| ^^^^^^^^^^^^^^^^^^ | ||
| | ||
= note: this error originates in the macro `gh` (in Nightly builds, run with -Z macro-backtrace for more info) | ||
|
||
error: aborting due to previous error | ||
|
Oops, something went wrong.