Skip to content

Commit ee49a27

Browse files
committed
compiletests: update ptr_copy stderr for extra pointer-cast diagnostic
1 parent 2f54cdf commit ee49a27

1 file changed

Lines changed: 40 additions & 1 deletion

File tree

tests/compiletests/ui/dis/ptr_copy.normal.stderr

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,44 @@ note: called by `main`
2525
LL | pub fn main(i: f32, o: &mut f32) {
2626
| ^^^^
2727

28-
error: aborting due to 1 previous error
28+
error: cannot cast between pointer types
29+
from `*f32`
30+
to `*struct () { }`
31+
--> <$CORE_SRC/ptr/mod.rs>:630:9
32+
|
33+
LL | / ub_checks::assert_unsafe_precondition!(
34+
LL | | check_language_ub,
35+
LL | | "ptr::copy requires that both pointer arguments are aligned and non-null",
36+
... |
37+
LL | | && ub_checks::maybe_is_aligned_and_not_null(dst, align, zero_size)
38+
LL | | );
39+
| |_________^
40+
|
41+
note: used from within `core::ptr::copy::<f32>`
42+
--> <$CORE_SRC/ptr/mod.rs>:630:9
43+
|
44+
LL | / ub_checks::assert_unsafe_precondition!(
45+
LL | | check_language_ub,
46+
LL | | "ptr::copy requires that both pointer arguments are aligned and non-null",
47+
... |
48+
LL | | && ub_checks::maybe_is_aligned_and_not_null(dst, align, zero_size)
49+
LL | | );
50+
| |_________^
51+
note: called by `ptr_copy::copy_via_raw_ptr`
52+
--> <$DIR/ptr_copy.rs>:29:18
53+
|
54+
LL | unsafe { core::ptr::copy(src, dst, 1) }
55+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
56+
note: called by `ptr_copy::main`
57+
--> <$DIR/ptr_copy.rs>:34:5
58+
|
59+
LL | copy_via_raw_ptr(&i, o);
60+
| ^^^^^^^^^^^^^^^^^^^^^^^
61+
note: called by `main`
62+
--> <$DIR/ptr_copy.rs>:33:8
63+
|
64+
LL | pub fn main(i: f32, o: &mut f32) {
65+
| ^^^^
66+
67+
error: aborting due to 2 previous errors
2968

0 commit comments

Comments
 (0)