Skip to content

Commit 0226f83

Browse files
committed
Revert "Extended hacking to get snapshots labeled by line and column number."
This reverts commit 8e37a61.
1 parent 04fa29e commit 0226f83

File tree

5 files changed

+9
-19
lines changed

5 files changed

+9
-19
lines changed

verify/rust_verify/src/verifier.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ impl Verifier {
192192
air_context.set_z3_param("air_recommended_options", "true");
193193
air_context.set_rlimit(self.args.rlimit * 1000000);
194194

195-
let ctx = vir::context::Ctx::new(&krate, compiler.session().source_map(), self.args.debug)?;
195+
let ctx = vir::context::Ctx::new(&krate, self.args.debug)?;
196196

197197
air_context.blank_line();
198198
air_context.comment("Prelude");

verify/vir/src/context.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,22 @@
11
use crate::ast::{Function, Ident, Krate, Mode, Path, Variants, VirErr};
22
use crate::def::FUEL_ID;
33
use crate::scc::Graph;
4-
use rustc_span::source_map::SourceMap;
54
use air::ast::{Command, CommandX, Commands, DeclX, MultiOp, Span};
65
use air::ast_util::str_typ;
76
use std::collections::HashMap;
87
use std::rc::Rc;
98

10-
pub struct Ctx<'a> {
9+
pub struct Ctx {
1110
pub(crate) datatypes: HashMap<Path, Variants>,
1211
pub(crate) functions: Vec<Function>,
1312
pub(crate) func_map: HashMap<Ident, Function>,
1413
pub(crate) func_call_graph: Graph<Ident>,
15-
pub(crate) source_map: &'a SourceMap,
1614
pub(crate) chosen_triggers: std::cell::RefCell<Vec<(Span, Vec<Vec<String>>)>>, // diagnostics
1715
pub(crate) debug: bool,
1816
}
1917

20-
impl <'a> Ctx<'a> {
21-
pub fn new(krate: &Krate, source_map: &'a SourceMap, debug:bool) -> Result<Self, VirErr> {
18+
impl Ctx {
19+
pub fn new(krate: &Krate, debug:bool) -> Result<Self, VirErr> {
2220
let datatypes = krate
2321
.datatypes
2422
.iter()
@@ -35,7 +33,7 @@ impl <'a> Ctx<'a> {
3533
func_call_graph.compute_sccs();
3634
let chosen_triggers: std::cell::RefCell<Vec<(Span, Vec<Vec<String>>)>> =
3735
std::cell::RefCell::new(Vec::new());
38-
Ok(Ctx { datatypes, functions, func_map, func_call_graph, source_map, chosen_triggers, debug })
36+
Ok(Ctx { datatypes, functions, func_map, func_call_graph, chosen_triggers, debug })
3937
}
4038

4139
pub fn prelude(&self) -> Commands {

verify/vir/src/lib.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
1-
#![feature(rustc_private)]
21
#![feature(or_patterns)]
32

4-
extern crate rustc_span;
5-
63
pub mod ast;
74
mod ast_to_sst;
85
pub mod ast_util;

verify/vir/src/recursion.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ struct Ctxt<'a> {
2121
decreases_exp: Exp,
2222
decreases_typ: Typ,
2323
scc_rep: Ident,
24-
ctx: &'a Ctx<'a>,
24+
ctx: &'a Ctx,
2525
}
2626

2727
fn check_decrease(ctxt: &Ctxt, exp: &Exp) -> Exp {

verify/vir/src/sst_to_air.rs

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ use air::ast_util::{
1818
bool_typ, ident_apply, ident_binder, ident_typ, ident_var, int_typ, mk_and, mk_eq, mk_exists,
1919
mk_implies, mk_ite, mk_not, mk_or, str_apply, str_ident, str_typ, str_var, string_var,
2020
};
21-
use rustc_span::Pos; //CharPos, FileName, MultiSpan, Span};
2221
use std::collections::{HashMap, HashSet};
2322
use std::rc::Rc;
2423

@@ -357,14 +356,10 @@ fn stm_to_stmts(ctx: &Ctx, state: &mut State, stm: &Stm) -> Vec<Stmt> {
357356
};
358357
stmts.push(Rc::new(StmtX::Assign(suffix_local_id(&ident), exp_to_expr(ctx, rhs))));
359358
if ctx.debug {
359+
//let name = format!("{}_{}_{}", ident.clone(), start.line, start.col.to_usize());
360360
// Add a snapshot after we modify the destination
361-
// TODO: Factor out the span reasoning, so we don't pull rustc into this part of
362-
// the code base?
363-
let span: &rustc_span::Span = (*stm.span.raw_span)
364-
.downcast_ref::<rustc_span::Span>()
365-
.expect("internal error: failed to cast to Span");
366-
let (start, _end) = ctx.source_map.is_valid_span(*span).expect("internal error: invalid Span");
367-
let name = format!("{}_{}_{}", ident.clone(), start.line, start.col.to_usize());
361+
//let (start, end) = source_map.is_valid_span(*stm.span).expect("internal error: invalid Span");
362+
let name = format!("{}_{:?}", ident.clone(), stm.span.raw_span); // TODO: Use line number?
368363
let snapshot = Rc::new(StmtX::Snapshot(Rc::new(name)));
369364
stmts.push(snapshot);
370365
}

0 commit comments

Comments
 (0)