summaryrefslogtreecommitdiffstats
path: root/src/test/mir-opt/const_prop/control-flow-simplification.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/mir-opt/const_prop/control-flow-simplification.rs')
-rw-r--r--src/test/mir-opt/const_prop/control-flow-simplification.rs20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/test/mir-opt/const_prop/control-flow-simplification.rs b/src/test/mir-opt/const_prop/control-flow-simplification.rs
new file mode 100644
index 000000000..aa4ce19f6
--- /dev/null
+++ b/src/test/mir-opt/const_prop/control-flow-simplification.rs
@@ -0,0 +1,20 @@
+// compile-flags: -Zmir-opt-level=1
+
+trait NeedsDrop:Sized{
+ const NEEDS:bool=std::mem::needs_drop::<Self>();
+}
+
+impl<This> NeedsDrop for This{}
+
+// EMIT_MIR control_flow_simplification.hello.ConstProp.diff
+// EMIT_MIR control_flow_simplification.hello.PreCodegen.before.mir
+fn hello<T>(){
+ if <bool>::NEEDS {
+ panic!()
+ }
+}
+
+pub fn main() {
+ hello::<()>();
+ hello::<Vec<()>>();
+}