Remove Ref::clone for MirContext mir

This commit is contained in:
Mark-Simulacrum 2016-12-17 12:56:33 -07:00 committed by Mark Simulacrum
parent 937001a1f8
commit 1804131b6d
4 changed files with 8 additions and 13 deletions

View File

@ -696,7 +696,8 @@ pub fn trans_instance<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, instance: Instance
let fcx = FunctionContext::new(ccx, lldecl, fn_ty, Some((instance, &sig, abi)), true);
mir::trans_mir(&fcx, ccx.tcx().item_mir(instance.def));
let mir = ccx.tcx().item_mir(instance.def);
mir::trans_mir(&fcx, &mir);
}
pub fn trans_ctor_shim<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,

View File

@ -19,7 +19,6 @@ use rustc::mir::{Mir, VisibilityScope};
use libc::c_uint;
use std::ptr;
use std::cell::Ref;
use syntax_pos::Pos;
@ -47,7 +46,7 @@ impl MirDebugScope {
/// If debuginfo is disabled, the returned vector is empty.
pub fn create_mir_scopes<'tcx>(
fcx: &FunctionContext,
mir: Ref<'tcx, Mir<'tcx>>,
mir: &'tcx Mir<'tcx>,
) -> IndexVec<VisibilityScope, MirDebugScope> {
let null_scope = MirDebugScope {
scope_metadata: ptr::null_mut(),

View File

@ -38,14 +38,13 @@ use super::lvalue::{LvalueRef};
use super::operand::OperandRef;
use super::operand::OperandValue::{Pair, Ref, Immediate};
use std::cell::Ref as CellRef;
use std::ptr;
impl<'bcx, 'tcx> MirContext<'bcx, 'tcx> {
pub fn trans_block(&mut self, bb: mir::BasicBlock,
funclets: &IndexVec<mir::BasicBlock, Option<Funclet>>) {
let mut bcx = self.build_block(bb);
let data = &CellRef::clone(&self.mir)[bb];
let data = &self.mir[bb];
debug!("trans_block({:?}={:?})", bb, data);

View File

@ -24,7 +24,6 @@ use type_of;
use syntax_pos::{DUMMY_SP, NO_EXPANSION, COMMAND_LINE_EXPN, BytePos, Span};
use syntax::symbol::keywords;
use std::cell::Ref;
use std::iter;
use basic_block::BasicBlock;
@ -41,7 +40,7 @@ use self::operand::{OperandRef, OperandValue};
/// Master context for translating MIR.
pub struct MirContext<'bcx, 'tcx:'bcx> {
mir: Ref<'tcx, mir::Mir<'tcx>>,
mir: &'bcx mir::Mir<'tcx>,
/// Function context
fcx: &'bcx common::FunctionContext<'bcx, 'tcx>,
@ -179,10 +178,7 @@ impl<'tcx> LocalRef<'tcx> {
///////////////////////////////////////////////////////////////////////////
pub fn trans_mir<'blk, 'tcx: 'blk>(
fcx: &'blk FunctionContext<'blk, 'tcx>,
mir: Ref<'tcx, Mir<'tcx>>
) {
pub fn trans_mir<'blk, 'tcx: 'blk>(fcx: &'blk FunctionContext<'blk, 'tcx>, mir: &'blk Mir<'tcx>) {
let bcx = fcx.get_entry_block();
// Analyze the temps to determine which must be lvalues
@ -201,10 +197,10 @@ pub fn trans_mir<'blk, 'tcx: 'blk>(
}).collect();
// Compute debuginfo scopes from MIR scopes.
let scopes = debuginfo::create_mir_scopes(fcx, Ref::clone(&mir));
let scopes = debuginfo::create_mir_scopes(fcx, mir);
let mut mircx = MirContext {
mir: Ref::clone(&mir),
mir: mir,
fcx: fcx,
llpersonalityslot: None,
blocks: block_bcxs,