summaryrefslogtreecommitdiffstats
path: root/tests/ui/cast/issue-89497.fixed
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/cast/issue-89497.fixed')
-rw-r--r--tests/ui/cast/issue-89497.fixed10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/ui/cast/issue-89497.fixed b/tests/ui/cast/issue-89497.fixed
new file mode 100644
index 000000000..04c10a5f7
--- /dev/null
+++ b/tests/ui/cast/issue-89497.fixed
@@ -0,0 +1,10 @@
+// Regression test for issue #89497.
+
+// run-rustfix
+
+fn main() {
+ let pointer: usize = &1_i32 as *const i32 as usize;
+ let _reference: &'static i32 = unsafe { &*(pointer as *const i32) };
+ //~^ ERROR: non-primitive cast
+ //~| HELP: consider borrowing the value
+}