diff --git a/benches/helpers/miri_helper.rs b/benches/helpers/miri_helper.rs index ff4087cb14a..cdd1412204f 100644 --- a/benches/helpers/miri_helper.rs +++ b/benches/helpers/miri_helper.rs @@ -58,7 +58,7 @@ impl<'a> CompilerCalls<'a> for MiriCompilerCalls<'a> { let mut mir_map = MirMap { map: mir_map.map.clone() }; run_mir_passes(tcx, &mut mir_map); - bencher.borrow_mut().iter(|| { eval_main(tcx, &mir_map, node_id, state.session); }); + bencher.borrow_mut().iter(|| { eval_main(tcx, &mir_map, node_id); }); state.session.abort_if_errors(); }); diff --git a/src/bin/miri.rs b/src/bin/miri.rs index 8bf6adde14b..cc0132e4090 100644 --- a/src/bin/miri.rs +++ b/src/bin/miri.rs @@ -75,7 +75,7 @@ impl<'a> CompilerCalls<'a> for MiriCompilerCalls { mir_map_copy.map.insert(def_id, mir_map.map.get(&def_id).unwrap().clone()); } run_mir_passes(tcx, &mut mir_map_copy); - eval_main(tcx, &mir_map_copy, entry_def_id, memory_size, step_limit, stack_limit, state.session); + eval_main(tcx, &mir_map_copy, entry_def_id, memory_size, step_limit, stack_limit); state.session.abort_if_errors(); }); diff --git a/src/interpreter/mod.rs b/src/interpreter/mod.rs index 8fb899572c4..e6c4c4eb022 100644 --- a/src/interpreter/mod.rs +++ b/src/interpreter/mod.rs @@ -6,7 +6,6 @@ use rustc::traits::Reveal; use rustc::ty::layout::{self, Layout, Size}; use rustc::ty::subst::{self, Subst, Substs}; use rustc::ty::{self, Ty, TyCtxt, TypeFoldable}; -use rustc::session::Session; use rustc::util::nodemap::DefIdMap; use rustc_data_structures::indexed_vec::Idx; use std::cell::RefCell; @@ -32,10 +31,6 @@ pub struct EvalContext<'a, 'tcx: 'a> { /// The results of the type checker, from rustc. tcx: TyCtxt<'a, 'tcx, 'tcx>, - /// The Session, from rustc. - /// Used to extract info from other crates - session: &'a Session, - /// A mapping from NodeIds to Mir, from rustc. Only contains MIR for crate-local items. mir_map: &'a MirMap<'tcx>, @@ -159,7 +154,7 @@ pub enum StackPopCleanup { } impl<'a, 'tcx> EvalContext<'a, 'tcx> { - pub fn new(tcx: TyCtxt<'a, 'tcx, 'tcx>, mir_map: &'a MirMap<'tcx>, memory_size: usize, stack_limit: usize, session: &'a Session) -> Self { + pub fn new(tcx: TyCtxt<'a, 'tcx, 'tcx>, mir_map: &'a MirMap<'tcx>, memory_size: usize, stack_limit: usize) -> Self { EvalContext { tcx: tcx, mir_map: mir_map, @@ -168,7 +163,6 @@ impl<'a, 'tcx> EvalContext<'a, 'tcx> { statics: HashMap::new(), stack: Vec::new(), stack_limit: stack_limit, - session: session, } } @@ -1197,10 +1191,9 @@ pub fn eval_main<'a, 'tcx: 'a>( memory_size: usize, step_limit: u64, stack_limit: usize, - session: &'a Session, ) { let mir = mir_map.map.get(&def_id).expect("no mir for main function"); - let mut ecx = EvalContext::new(tcx, mir_map, memory_size, stack_limit, session); + let mut ecx = EvalContext::new(tcx, mir_map, memory_size, stack_limit); let substs = subst::Substs::empty(tcx); let return_ptr = ecx.alloc_ret_ptr(mir.return_ty, substs) .expect("should at least be able to allocate space for the main function's return value"); diff --git a/src/interpreter/step.rs b/src/interpreter/step.rs index cd1e9a18117..fe386ea5fb6 100644 --- a/src/interpreter/step.rs +++ b/src/interpreter/step.rs @@ -212,7 +212,7 @@ impl<'a, 'b, 'tcx> Visitor<'tcx> for ConstantExtractor<'a, 'b, 'tcx> { bug!("static def id doesn't point to item"); } } else { - let def = self.ecx.session.cstore.describe_def(def_id).expect("static not found"); + let def = self.ecx.tcx.sess.cstore.describe_def(def_id).expect("static not found"); if let hir::def::Def::Static(_, mutable) = def { self.global_item(def_id, substs, span, !mutable); } else {