about summary refs log tree commit diff
path: root/compiler/rustc_mir_build/src
diff options
context:
space:
mode:
authorEllen <supbscripter@gmail.com>2021-09-06 02:27:41 +0100
committerEllen <supbscripter@gmail.com>2021-09-09 01:32:03 +0100
commit2987f4ba42b002c58ae485f7ae528cb29c3b1611 (patch)
tree5e2b41f111b7a18e2fcd5dbc17a15bc8589d6fb7 /compiler/rustc_mir_build/src
parent97032a6dfacdd3548e4bff98c90a6b3875a14077 (diff)
downloadrust-2987f4ba42b002c58ae485f7ae528cb29c3b1611.tar.gz
rust-2987f4ba42b002c58ae485f7ae528cb29c3b1611.zip
WIP state
Diffstat (limited to 'compiler/rustc_mir_build/src')
-rw-r--r--compiler/rustc_mir_build/src/build/mod.rs8
-rw-r--r--compiler/rustc_mir_build/src/thir/cx/expr.rs3
-rw-r--r--compiler/rustc_mir_build/src/thir/cx/mod.rs1
3 files changed, 10 insertions, 2 deletions
diff --git a/compiler/rustc_mir_build/src/build/mod.rs b/compiler/rustc_mir_build/src/build/mod.rs
index 0a760a740dc..390ce59cb48 100644
--- a/compiler/rustc_mir_build/src/build/mod.rs
+++ b/compiler/rustc_mir_build/src/build/mod.rs
@@ -28,6 +28,7 @@ crate fn mir_built<'tcx>(
     if let Some(def) = def.try_upgrade(tcx) {
         return tcx.mir_built(def);
     }
+    debug!("mir_built: def={:?}", def);
 
     let mut body = mir_build(tcx, def);
     if def.const_param_did.is_some() {
@@ -40,6 +41,7 @@ crate fn mir_built<'tcx>(
 
 /// Construct the MIR for a given `DefId`.
 fn mir_build(tcx: TyCtxt<'_>, def: ty::WithOptConstParam<LocalDefId>) -> Body<'_> {
+    debug!("mir_build: def={:?}", def);
     let id = tcx.hir().local_def_id_to_hir_id(def.did);
     let body_owner_kind = tcx.hir().body_owner_kind(id);
     let typeck_results = tcx.typeck_opt_const_arg(def);
@@ -47,10 +49,12 @@ fn mir_build(tcx: TyCtxt<'_>, def: ty::WithOptConstParam<LocalDefId>) -> Body<'_
     // Ensure unsafeck is ran before we steal the THIR.
     match def {
         ty::WithOptConstParam { did, const_param_did: Some(const_param_did) } => {
-            tcx.ensure().thir_check_unsafety_for_const_arg((did, const_param_did))
+            tcx.ensure().thir_check_unsafety_for_const_arg((did, const_param_did));
+            tcx.ensure().mir_abstract_const_of_const_arg((did, const_param_did));
         }
         ty::WithOptConstParam { did, const_param_did: None } => {
-            tcx.ensure().thir_check_unsafety(did)
+            tcx.ensure().thir_check_unsafety(did);
+            tcx.ensure().mir_abstract_const(did);
         }
     }
 
diff --git a/compiler/rustc_mir_build/src/thir/cx/expr.rs b/compiler/rustc_mir_build/src/thir/cx/expr.rs
index 66005be05df..70a5a9286b0 100644
--- a/compiler/rustc_mir_build/src/thir/cx/expr.rs
+++ b/compiler/rustc_mir_build/src/thir/cx/expr.rs
@@ -149,7 +149,9 @@ impl<'tcx> Cx<'tcx> {
     }
 
     fn make_mirror_unadjusted(&mut self, expr: &'tcx hir::Expr<'tcx>) -> Expr<'tcx> {
+        debug!("Expr::make_mirror_unadjusted: expr={:?}", expr);
         let expr_ty = self.typeck_results().expr_ty(expr);
+        debug!("Expr::make_mirror_unadjusted: expr_ty={:?}", expr_ty);
         let temp_lifetime = self.region_scope_tree.temporary_scope(expr.hir_id.local_id);
 
         let kind = match expr.kind {
@@ -762,6 +764,7 @@ impl<'tcx> Cx<'tcx> {
             hir::ExprKind::Err => unreachable!(),
         };
 
+        debug!("Expr::make_mirror_unadjusted: finish");
         Expr { temp_lifetime, ty: expr_ty, span: expr.span, kind }
     }
 
diff --git a/compiler/rustc_mir_build/src/thir/cx/mod.rs b/compiler/rustc_mir_build/src/thir/cx/mod.rs
index 5059dd939d9..5310efbccd6 100644
--- a/compiler/rustc_mir_build/src/thir/cx/mod.rs
+++ b/compiler/rustc_mir_build/src/thir/cx/mod.rs
@@ -20,6 +20,7 @@ crate fn thir_body<'tcx>(
     tcx: TyCtxt<'tcx>,
     owner_def: ty::WithOptConstParam<LocalDefId>,
 ) -> (&'tcx Steal<Thir<'tcx>>, ExprId) {
+    debug!("thir_body: {:?}", owner_def);
     let hir = tcx.hir();
     let body = hir.body(hir.body_owned_by(hir.local_def_id_to_hir_id(owner_def.did)));
     let mut cx = Cx::new(tcx, owner_def);