about summary refs log tree commit diff
path: root/src/test/mir-opt/const_prop
diff options
context:
space:
mode:
authorWesley Wiser <wwiser@gmail.com>2019-06-04 21:51:30 -0400
committerWesley Wiser <wwiser@gmail.com>2019-06-06 08:31:28 -0400
commit529b94ea6a3f0606d38e4bb32ec5eb692c3c0d71 (patch)
tree004dc3f436ef8623af4f893ef280fb09338134a0 /src/test/mir-opt/const_prop
parentdaf1ed0e98e75c64c3b883fd845b37bfa42358de (diff)
downloadrust-529b94ea6a3f0606d38e4bb32ec5eb692c3c0d71.tar.gz
rust-529b94ea6a3f0606d38e4bb32ec5eb692c3c0d71.zip
[const-prop] Fix ICE when casting function pointers
This fixes an ICE when building libcore with `-Z mir-opt-level=3`.
Diffstat (limited to 'src/test/mir-opt/const_prop')
-rw-r--r--src/test/mir-opt/const_prop/reify_fn_ptr.rs25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/test/mir-opt/const_prop/reify_fn_ptr.rs b/src/test/mir-opt/const_prop/reify_fn_ptr.rs
new file mode 100644
index 00000000000..809eb19ade8
--- /dev/null
+++ b/src/test/mir-opt/const_prop/reify_fn_ptr.rs
@@ -0,0 +1,25 @@
+fn main() {
+    let _ = main as usize as *const fn();
+}
+
+// END RUST SOURCE
+// START rustc.main.ConstProp.before.mir
+//  bb0: {
+//      ...
+//      _3 = const main as fn() (Pointer(ReifyFnPointer));
+//      _2 = move _3 as usize (Misc);
+//      ...
+//      _1 = move _2 as *const fn() (Misc);
+//      ...
+//  }
+// END rustc.main.ConstProp.before.mir
+// START rustc.main.ConstProp.after.mir
+//  bb0: {
+//      ...
+//      _3 = const Scalar(AllocId(1).0x0) : fn();
+//      _2 = move _3 as usize (Misc);
+//      ...
+//      _1 = const Scalar(AllocId(1).0x0) : *const fn();
+//      ...
+//  }
+// END rustc.main.ConstProp.after.mir