Skip to content

Commit

Permalink
Use MIR without regions for pure functions.
Browse files Browse the repository at this point in the history
  • Loading branch information
vakaras committed Jul 18, 2023
1 parent 95c4305 commit db00af1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
18 changes: 9 additions & 9 deletions prusti-interface/src/environment/body.rs
Original file line number Diff line number Diff line change
Expand Up @@ -321,15 +321,15 @@ impl<'tcx> EnvBody<'tcx> {

pub(crate) fn load_pure_fn_body(&mut self, def_id: LocalDefId) {
assert!(!self.pure_fns.local.contains_key(&def_id));
if config::no_verify() {
let body = Self::load_local_mir(self.tcx, def_id);
self.pure_fns.local.insert(def_id, body);
} else {
let bwbf = Self::load_local_mir_with_facts(self.tcx, def_id);
self.pure_fns.local.insert(def_id, bwbf.body.clone());
// Also add to `impure_fns` since we'll also be encoding this as impure
self.local_impure_fns.borrow_mut().insert(def_id, bwbf);
}
// if config::no_verify() {
let body = Self::load_local_mir(self.tcx, def_id);
self.pure_fns.local.insert(def_id, body);
// } else {
let bwbf = Self::load_local_mir_with_facts(self.tcx, def_id);
// self.pure_fns.local.insert(def_id, bwbf.body.clone());
// Also add to `impure_fns` since we'll also be encoding this as impure
self.local_impure_fns.borrow_mut().insert(def_id, bwbf);
// }
}

pub(crate) fn load_closure_body(&mut self, def_id: LocalDefId) {
Expand Down
4 changes: 1 addition & 3 deletions prusti-viper/src/encoder/procedure_encoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5511,10 +5511,8 @@ impl<'p, 'v: 'p, 'tcx: 'v> ProcedureEncoder<'p, 'v, 'tcx> {
}
} else {
// FIXME: why are we getting the MIR body for this?
let mir = self.encoder.env().body.get_impure_fn_body(
let mir = self.encoder.env().body.get_impure_fn_body_identity(
containing_def_id.expect_local(),
// TODO(tymap): identity substs here are probably wrong?
self.encoder.env().query.identity_substs(containing_def_id),
);
let return_ty = mir.return_ty();
let arg_tys = mir.args_iter().map(|arg| mir.local_decls[arg].ty).collect();
Expand Down

0 comments on commit db00af1

Please sign in to comment.