Some small changes

This commit is contained in:
bjorn3 2018-12-01 11:49:44 +01:00
parent 3f423c0933
commit a8d52d13f4
2 changed files with 9 additions and 7 deletions

View File

@ -20,6 +20,7 @@ pub fn trans_mono_item<'a, 'tcx: 'a>(
MonoItem::Fn(inst) => { MonoItem::Fn(inst) => {
let _inst_guard = let _inst_guard =
PrintOnPanic(|| format!("{:?} {}", inst, tcx.symbol_name(inst).as_str())); PrintOnPanic(|| format!("{:?} {}", inst, tcx.symbol_name(inst).as_str()));
debug_assert!(!inst.substs.needs_infer());
let _mir_guard = PrintOnPanic(|| { let _mir_guard = PrintOnPanic(|| {
match inst.def { match inst.def {
InstanceDef::Item(_) InstanceDef::Item(_)
@ -88,15 +89,14 @@ fn trans_fn<'a, 'tcx: 'a>(
tcx, tcx,
module, module,
pointer_type, pointer_type,
instance, instance,
mir, mir,
bcx, bcx,
param_substs: {
assert!(!instance.substs.needs_infer());
instance.substs
},
ebb_map, ebb_map,
local_map: HashMap::new(), local_map: HashMap::new(),
comments: HashMap::new(), comments: HashMap::new(),
constants, constants,
caches, caches,

View File

@ -615,12 +615,14 @@ pub struct FunctionCx<'a, 'tcx: 'a, B: Backend> {
pub tcx: TyCtxt<'a, 'tcx, 'tcx>, pub tcx: TyCtxt<'a, 'tcx, 'tcx>,
pub module: &'a mut Module<B>, pub module: &'a mut Module<B>,
pub pointer_type: Type, // Cached from module pub pointer_type: Type, // Cached from module
pub instance: Instance<'tcx>, pub instance: Instance<'tcx>,
pub mir: &'tcx Mir<'tcx>, pub mir: &'tcx Mir<'tcx>,
pub param_substs: &'tcx Substs<'tcx>,
pub bcx: FunctionBuilder<'a>, pub bcx: FunctionBuilder<'a>,
pub ebb_map: HashMap<BasicBlock, Ebb>, pub ebb_map: HashMap<BasicBlock, Ebb>,
pub local_map: HashMap<Local, CPlace<'tcx>>, pub local_map: HashMap<Local, CPlace<'tcx>>,
pub comments: HashMap<Inst, String>, pub comments: HashMap<Inst, String>,
pub constants: &'a mut crate::constant::ConstantCx, pub constants: &'a mut crate::constant::ConstantCx,
pub caches: &'a mut Caches<'tcx>, pub caches: &'a mut Caches<'tcx>,
@ -631,7 +633,7 @@ pub struct FunctionCx<'a, 'tcx: 'a, B: Backend> {
impl<'a, 'tcx: 'a, B: Backend + 'a> fmt::Debug for FunctionCx<'a, 'tcx, B> { impl<'a, 'tcx: 'a, B: Backend + 'a> fmt::Debug for FunctionCx<'a, 'tcx, B> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
writeln!(f, "{:?}", self.param_substs)?; writeln!(f, "{:?}", self.instance.substs)?;
writeln!(f, "{:?}", self.local_map)?; writeln!(f, "{:?}", self.local_map)?;
let mut clif = String::new(); let mut clif = String::new();
@ -690,7 +692,7 @@ impl<'a, 'tcx: 'a, B: Backend + 'a> FunctionCx<'a, 'tcx, B> {
T: TypeFoldable<'tcx>, T: TypeFoldable<'tcx>,
{ {
self.tcx.subst_and_normalize_erasing_regions( self.tcx.subst_and_normalize_erasing_regions(
self.param_substs, self.instance.substs,
ty::ParamEnv::reveal_all(), ty::ParamEnv::reveal_all(),
value, value,
) )