about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorRyan1729 <Ryan1729@gmail.com>2020-08-05 20:23:29 -0600
committerRyan1729 <Ryan1729@gmail.com>2020-08-06 04:24:25 -0600
commit94340d6e172a050bc6289e3ff87f59ea09019daf (patch)
tree6820457e4e94388a09918d43dcee4c2ae33ae950 /tests
parent19f36bc2f3ceede89f20dd1e20301eac50d9f68c (diff)
downloadrust-94340d6e172a050bc6289e3ff87f59ea09019daf.tar.gz
rust-94340d6e172a050bc6289e3ff87f59ea09019daf.zip
add documentation to functions that call `do_check` and add a test against lint ordering changing
Diffstat (limited to 'tests')
-rw-r--r--tests/ui/transmutes_expressible_as_ptr_casts.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/ui/transmutes_expressible_as_ptr_casts.rs b/tests/ui/transmutes_expressible_as_ptr_casts.rs
index db544b438a2..007526da40d 100644
--- a/tests/ui/transmutes_expressible_as_ptr_casts.rs
+++ b/tests/ui/transmutes_expressible_as_ptr_casts.rs
@@ -63,3 +63,14 @@ fn main() {
     };
     let usize_from_fn_ptr = foo as *const usize;
 }
+
+// If a ref-to-ptr cast of this form where the pointer type points to a type other
+// than the referenced type, calling `CastCheck::do_check` has been observed to
+// cause an ICE error message. `do_check` is currently called inside the
+// `transmutes_expressible_as_ptr_casts` check, but other, more specific lints
+// currently prevent it from being called in these cases. This test is meant to
+// fail if the ordering of the checks ever changes enough to cause these cases to
+// fall through into `do_check`.
+fn trigger_do_check_to_emit_error(in_param: &[i32; 1]) -> *const u8 {
+    unsafe { transmute::<&[i32; 1], *const u8>(in_param) }
+}
\ No newline at end of file