Skip to content

Commit e8b5ee1

Browse files
authored
Merge pull request creusot-rs#802 from xldenis/no-synthetics
2 parents 4f512b6 + 76ba692 commit e8b5ee1

File tree

13 files changed

+177
-553
lines changed

13 files changed

+177
-553
lines changed

creusot/src/translation/function.rs

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,6 @@ pub struct BodyTranslator<'body, 'tcx> {
7575
assertions: IndexMap<DefId, Term<'tcx>>,
7676

7777
borrows: Option<Rc<BorrowSet<'tcx>>>,
78-
79-
synthetic_locals: Vec<(Local, Ty<'tcx>)>,
8078
}
8179

8280
impl<'body, 'tcx> BodyTranslator<'body, 'tcx> {
@@ -131,7 +129,6 @@ impl<'body, 'tcx> BodyTranslator<'body, 'tcx> {
131129
invariants,
132130
assertions,
133131
borrows,
134-
synthetic_locals: Vec::new(),
135132
}
136133
}
137134

@@ -190,8 +187,7 @@ impl<'body, 'tcx> BodyTranslator<'body, 'tcx> {
190187
}
191188

192189
fn translate_vars(&mut self) -> Vec<(LocalIdent, Span, Ty<'tcx>)> {
193-
let mut vars =
194-
Vec::with_capacity(self.body.local_decls.len() + self.synthetic_locals.len());
190+
let mut vars = Vec::with_capacity(self.body.local_decls.len());
195191

196192
for (loc, decl) in self.body.local_decls.iter_enumerated() {
197193
if self.erased_locals.contains(loc) {
@@ -202,10 +198,6 @@ impl<'body, 'tcx> BodyTranslator<'body, 'tcx> {
202198
vars.push((ident, decl.source_info.span, decl.ty))
203199
}
204200

205-
for (loc, ty) in self.synthetic_locals.iter() {
206-
vars.push((LocalIdent::anon(*loc), DUMMY_SP, *ty));
207-
}
208-
209201
vars
210202
}
211203

@@ -291,13 +283,6 @@ impl<'body, 'tcx> BodyTranslator<'body, 'tcx> {
291283
id
292284
}
293285

294-
fn fresh_local(&mut self, ty: Ty<'tcx>) -> Local {
295-
let id = self.body.local_decls.len() + self.synthetic_locals.len();
296-
let local = Local::from_usize(id);
297-
self.synthetic_locals.push((local, ty));
298-
local
299-
}
300-
301286
fn resolve_locals(&mut self, mut locals: BitSet<Local>) {
302287
locals.subtract(&self.erased_locals.to_hybrid());
303288

creusot/src/translation/function/statement.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -200,10 +200,8 @@ impl<'tcx> BodyTranslator<'_, 'tcx> {
200200
let lhs_ty = place.ty(self.body, self.tcx).ty;
201201
if !place.is_indirect() && need_resolve_before.contains(place.local)
202202
&& let Some((id, subst)) = super::resolve_predicate_of(self.ctx, self.param_env(), lhs_ty) {
203-
let tmp_local: Place = self.fresh_local(lhs_ty).into();
204-
self.emit_assignment(&tmp_local, RValue::Expr(rval));
205203
self.emit_statement(fmir::Statement::Resolve(id, subst, *place));
206-
self.emit_assignment(place, RValue::Expr(Expr::Place(tmp_local)));
204+
self.emit_assignment(place, RValue::Expr(rval));
207205
} else {
208206
self.emit_assignment(place, RValue::Expr(rval));
209207
}

creusot/tests/should_succeed/all_zero.mlcfg

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,6 @@ module AllZero_AllZero
182182
var _14 : ();
183183
var _15 : ();
184184
var _16 : ();
185-
var _17 : borrowed (AllZero_List_Type.t_list);
186185
{
187186
l_1 <- l;
188187
goto BB0
@@ -219,10 +218,9 @@ module AllZero_AllZero
219218
assume { Resolve1.resolve value_11 };
220219
_13 <- borrow_mut ( * next_12);
221220
next_12 <- { next_12 with current = ( ^ _13) };
222-
_17 <- _13;
223-
_13 <- any borrowed (AllZero_List_Type.t_list);
224221
assume { Resolve0.resolve loop_l_6 };
225-
loop_l_6 <- _17;
222+
loop_l_6 <- _13;
223+
_13 <- any borrowed (AllZero_List_Type.t_list);
226224
_9 <- ();
227225
assume { Resolve2.resolve next_12 };
228226
goto BB2

creusot/tests/should_succeed/all_zero/why3session.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<path name=".."/><path name="all_zero.mlcfg"/>
88
<theory name="AllZero_AllZero" proved="true">
99
<goal name="all_zero&#39;vc" expl="VC for all_zero" proved="true">
10-
<proof prover="1"><result status="valid" time="0.06" steps="775"/></proof>
10+
<proof prover="1"><result status="valid" time="0.06" steps="774"/></proof>
1111
</goal>
1212
</theory>
1313
</file>
-6 Bytes
Binary file not shown.

creusot/tests/should_succeed/hashmap.mlcfg

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1470,7 +1470,6 @@ module Hashmap_Impl5_Add
14701470
var _55 : Hashmap_List_Type.t_list (k, v);
14711471
var _56 : Hashmap_List_Type.t_list (k, v);
14721472
var _57 : ();
1473-
var _59 : borrowed (Hashmap_List_Type.t_list (k, v));
14741473
{
14751474
self_1 <- self;
14761475
key_2 <- key;
@@ -1584,10 +1583,9 @@ module Hashmap_Impl5_Add
15841583
tl_37 <- { tl_37 with current = ( ^ _47) };
15851584
_46 <- borrow_mut ( * _47);
15861585
_47 <- { _47 with current = ( ^ _46) };
1587-
_59 <- _46;
1588-
_46 <- any borrowed (Hashmap_List_Type.t_list (k, v));
15891586
assume { Resolve1.resolve l_17 };
1590-
l_17 <- _59;
1587+
l_17 <- _46;
1588+
_46 <- any borrowed (Hashmap_List_Type.t_list (k, v));
15911589
assume { Resolve1.resolve _47 };
15921590
_32 <- ();
15931591
assume { Resolve8.resolve tl_37 };

creusot/tests/should_succeed/hashmap/why3session.xml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,22 +61,22 @@
6161
<proof prover="6"><result status="valid" time="0.03" steps="142"/></proof>
6262
</goal>
6363
<goal name="add&#39;vc.13" expl="loop invariant preservation" proved="true">
64-
<proof prover="6"><result status="valid" time="0.56" steps="20655"/></proof>
64+
<proof prover="6"><result status="valid" time="0.56" steps="20638"/></proof>
6565
</goal>
6666
<goal name="add&#39;vc.14" expl="loop invariant preservation" proved="true">
67-
<proof prover="6"><result status="valid" time="0.40" steps="14823"/></proof>
67+
<proof prover="6"><result status="valid" time="0.40" steps="14808"/></proof>
6868
</goal>
6969
<goal name="add&#39;vc.15" expl="loop invariant preservation" proved="true">
70-
<proof prover="6"><result status="valid" time="0.22" steps="9199"/></proof>
70+
<proof prover="6"><result status="valid" time="0.22" steps="9188"/></proof>
7171
</goal>
7272
<goal name="add&#39;vc.16" expl="loop invariant preservation" proved="true">
73-
<proof prover="6"><result status="valid" time="0.48" steps="17390"/></proof>
73+
<proof prover="6"><result status="valid" time="0.48" steps="17371"/></proof>
7474
</goal>
7575
<goal name="add&#39;vc.17" expl="loop invariant preservation" proved="true">
76-
<proof prover="6"><result status="valid" time="0.07" steps="426"/></proof>
76+
<proof prover="6"><result status="valid" time="0.07" steps="424"/></proof>
7777
</goal>
7878
<goal name="add&#39;vc.18" expl="loop invariant preservation" proved="true">
79-
<proof prover="0"><result status="valid" time="0.22" steps="42104"/></proof>
79+
<proof prover="0"><result status="valid" time="0.22" steps="42085"/></proof>
8080
</goal>
8181
<goal name="add&#39;vc.19" expl="assertion" proved="true">
8282
<transf name="inline_goal" proved="true" >
-11 Bytes
Binary file not shown.

creusot/tests/should_succeed/list_index_mut.mlcfg

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,6 @@ module ListIndexMut_IndexMut
212212
var _28 : ();
213213
var _29 : ();
214214
var _30 : borrowed uint32;
215-
var _31 : borrowed (ListIndexMut_List_Type.t_list);
216215
{
217216
param_l_1 <- param_l;
218217
param_ix_2 <- param_ix;
@@ -266,10 +265,9 @@ module ListIndexMut_IndexMut
266265
l_11 <- { l_11 with current = (let ListIndexMut_List_Type.C_List a b = * l_11 in ListIndexMut_List_Type.C_List a (let ListIndexMut_Option_Type.C_Some a = ListIndexMut_List_Type.list_1 ( * l_11) in ListIndexMut_Option_Type.C_Some ( ^ n_24))) };
267266
_25 <- borrow_mut ( * n_24);
268267
n_24 <- { n_24 with current = ( ^ _25) };
269-
_31 <- _25;
270-
_25 <- any borrowed (ListIndexMut_List_Type.t_list);
271268
assume { Resolve0.resolve l_11 };
272-
l_11 <- _31;
269+
l_11 <- _25;
270+
_25 <- any borrowed (ListIndexMut_List_Type.t_list);
273271
_22 <- ();
274272
assume { Resolve1.resolve n_24 };
275273
ix_12 <- ([#"../list_index_mut.rs" 63 8 63 15] ix_12 - ([#"../list_index_mut.rs" 63 14 63 15] (1 : usize)));
6 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)