]> git.lizzy.rs Git - rust.git/commitdiff
Some small changes
authorbjorn3 <bjorn3@users.noreply.github.com>
Sat, 1 Dec 2018 10:49:44 +0000 (11:49 +0100)
committerbjorn3 <bjorn3@users.noreply.github.com>
Sat, 1 Dec 2018 10:49:44 +0000 (11:49 +0100)
src/base.rs
src/common.rs

index 35fbf6454e9acc36149bcf1c5621febb1b187551..66bd3e995234fd1bcd2f9a386574e309fa43c3b8 100644 (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,
index a74abc8ef24ca84e87164dd2287ff9029587b981..1eef977fa24b375320951af9b4f4bf926884a17b 100644 (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 @@ pub fn monomorphize<T>(&self, value: &T) -> T
         T: TypeFoldable<'tcx>,
     {
         self.tcx.subst_and_normalize_erasing_regions(
-            self.param_substs,
+            self.instance.substs,
             ty::ParamEnv::reveal_all(),
             value,
         )