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

View File

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