about summary refs log tree commit diff
path: root/src/librustc/mir
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2020-01-21 15:29:18 +0000
committerbors <bors@rust-lang.org>2020-01-21 15:29:18 +0000
commit2cf24ab89123532f0e84995301ee734a88bf4701 (patch)
treea5a5ecd488d56781a4e3ff1634545444ec2f4b47 /src/librustc/mir
parentce361fb24f0896bf7d983549117cbe1f70f32dcf (diff)
parent7b4dca282a0bfad265238d04b22f7bdb0d498d74 (diff)
downloadrust-2cf24ab89123532f0e84995301ee734a88bf4701.tar.gz
rust-2cf24ab89123532f0e84995301ee734a88bf4701.zip
Auto merge of #65672 - ecstatic-morse:unified-dataflow-proto, r=pnkfelix
A single framework for gen-kill and generic dataflow problems

This is the prototype implementation discussed in rust-lang/compiler-team#202. You can read a high-level description of it in [the proposal](https://hackmd.io/@39Qr_z9cQhasi25sGjmFnA/Skvd9rztS) for that design meeting. This would eventually supersede the existing `BitDenotation` interface.

r? @ghost

cc @rust-lang/compiler (esp. @eddyb and @pnkfelix)
Diffstat (limited to 'src/librustc/mir')
-rw-r--r--src/librustc/mir/mod.rs25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/librustc/mir/mod.rs b/src/librustc/mir/mod.rs
index ccd2a968ded..3a7c650c461 100644
--- a/src/librustc/mir/mod.rs
+++ b/src/librustc/mir/mod.rs
@@ -215,6 +215,31 @@ impl<'tcx> Body<'tcx> {
         }
     }
 
+    /// Returns a partially initialized MIR body containing only a list of basic blocks.
+    ///
+    /// The returned MIR contains no `LocalDecl`s (even for the return place) or source scopes. It
+    /// is only useful for testing but cannot be `#[cfg(test)]` because it is used in a different
+    /// crate.
+    pub fn new_cfg_only(basic_blocks: IndexVec<BasicBlock, BasicBlockData<'tcx>>) -> Self {
+        Body {
+            phase: MirPhase::Build,
+            basic_blocks,
+            source_scopes: IndexVec::new(),
+            yield_ty: None,
+            generator_drop: None,
+            generator_layout: None,
+            local_decls: IndexVec::new(),
+            user_type_annotations: IndexVec::new(),
+            arg_count: 0,
+            spread_arg: None,
+            span: DUMMY_SP,
+            control_flow_destroyed: Vec::new(),
+            generator_kind: None,
+            var_debug_info: Vec::new(),
+            ignore_interior_mut_in_const_validation: false,
+        }
+    }
+
     #[inline]
     pub fn basic_blocks(&self) -> &IndexVec<BasicBlock, BasicBlockData<'tcx>> {
         &self.basic_blocks