about summary refs log tree commit diff
path: root/tests/ui/consts
diff options
context:
space:
mode:
authorJacob Pratt <jacob@jhpratt.dev>2025-04-13 17:37:52 -0400
committerGitHub <noreply@github.com>2025-04-13 17:37:52 -0400
commit60c76b9dfd6e52f6605e0a63b7a33ad09dab96d3 (patch)
tree2b1b147444ade59436a237550ad51536051ec025 /tests/ui/consts
parentd04df1cba9fa67c597e58311623ce1053ee23b92 (diff)
parenta34c42fefabc774af2d8b2c5a5a100c0697d2ba9 (diff)
downloadrust-60c76b9dfd6e52f6605e0a63b7a33ad09dab96d3.tar.gz
rust-60c76b9dfd6e52f6605e0a63b7a33ad09dab96d3.zip
Rollup merge of #138962 - xizheyin:issue-138836, r=compiler-errors
Expect an array when expected and acutal types are both arrays during cast

Closes #138836
Diffstat (limited to 'tests/ui/consts')
-rw-r--r--tests/ui/consts/const-cast-wrong-type.rs2
-rw-r--r--tests/ui/consts/const-cast-wrong-type.stderr6
2 files changed, 4 insertions, 4 deletions
diff --git a/tests/ui/consts/const-cast-wrong-type.rs b/tests/ui/consts/const-cast-wrong-type.rs
index 6e055a2bcd3..9936a660936 100644
--- a/tests/ui/consts/const-cast-wrong-type.rs
+++ b/tests/ui/consts/const-cast-wrong-type.rs
@@ -1,5 +1,5 @@
 const a: [u8; 3] = ['h' as u8, 'i' as u8, 0 as u8];
-const b: *const i8 = &a as *const i8; //~ ERROR mismatched types
+const b: *const i8 = &a as *const i8; //~ ERROR casting `&[u8; 3]` as `*const i8` is invalid
 
 fn main() {
 }
diff --git a/tests/ui/consts/const-cast-wrong-type.stderr b/tests/ui/consts/const-cast-wrong-type.stderr
index 44361f15d8a..0730bac2235 100644
--- a/tests/ui/consts/const-cast-wrong-type.stderr
+++ b/tests/ui/consts/const-cast-wrong-type.stderr
@@ -1,9 +1,9 @@
-error[E0308]: mismatched types
+error[E0606]: casting `&[u8; 3]` as `*const i8` is invalid
   --> $DIR/const-cast-wrong-type.rs:2:22
    |
 LL | const b: *const i8 = &a as *const i8;
-   |                      ^^^^^^^^^^^^^^^ expected `u8`, found `i8`
+   |                      ^^^^^^^^^^^^^^^
 
 error: aborting due to 1 previous error
 
-For more information about this error, try `rustc --explain E0308`.
+For more information about this error, try `rustc --explain E0606`.