File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2598,6 +2598,25 @@ impl<'a> Emitter<'a> {
25982598 )
25992599 }
26002600
2601+ StmtT :: GhostStmt ( code) => {
2602+ let env = & mut env. clone ( ) ;
2603+ let ghost_doc = self . emit_inline_pulse_tokens ( env, code) ;
2604+ let rest = self . emit_pure_body ( env, & stmts[ 1 ..] ) ;
2605+ parens (
2606+ Doc :: text ( "let" )
2607+ . append ( Doc :: line ( ) )
2608+ . append ( "_" )
2609+ . append ( Doc :: line ( ) )
2610+ . append ( "=" )
2611+ . group ( )
2612+ . nest ( 2 )
2613+ . append ( Doc :: line ( ) . append ( ghost_doc) . nest ( 2 ) )
2614+ . append ( Doc :: line ( ) )
2615+ . append ( "in" )
2616+ . append ( Doc :: line ( ) . append ( rest) . nest ( 2 ) ) ,
2617+ )
2618+ }
2619+
26012620 StmtT :: Decl ( x, ty) => {
26022621 // Look for the assignment to this variable in the next statement
26032622 if stmts. len ( ) >= 3 {
Original file line number Diff line number Diff line change @@ -49,3 +49,10 @@ void test() {
4949 bool pure_not_result = pure_not (true);
5050 _assert (pure_not_result == false);
5151}
52+
53+ _pure int pure_ghost_stmt ()
54+ _ensures (1 == 0 )
55+ {
56+ _ghost_stmt (assume False );
57+ return 1 ;
58+ }
You can’t perform that action at this time.
0 commit comments