summaryrefslogtreecommitdiffstats
path: root/src/test/ui/cast/cast-macro-lhs.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ui/cast/cast-macro-lhs.rs')
-rw-r--r--src/test/ui/cast/cast-macro-lhs.rs12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/test/ui/cast/cast-macro-lhs.rs b/src/test/ui/cast/cast-macro-lhs.rs
new file mode 100644
index 000000000..b509b3239
--- /dev/null
+++ b/src/test/ui/cast/cast-macro-lhs.rs
@@ -0,0 +1,12 @@
+// Test to make sure we suggest "consider casting" on the right span
+
+macro_rules! foo {
+ () => { 0 }
+}
+
+fn main() {
+ let x = foo!() as *const [u8];
+ //~^ ERROR cannot cast `usize` to a pointer that is wide
+ //~| NOTE creating a `*const [u8]` requires both an address and a length
+ //~| NOTE consider casting this expression to `*const ()`, then using `core::ptr::from_raw_parts`
+}