]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
gccrs: [E0308] array misamatch types
authorMuhammad Mahad <mahadtxt@gmail.com>
Sat, 5 Aug 2023 07:55:36 +0000 (12:55 +0500)
committerArthur Cohen <arthur.cohen@embecosm.com>
Tue, 16 Jan 2024 18:00:29 +0000 (19:00 +0100)
gcc/rust/ChangeLog:

* backend/rust-compile.cc (HIRCompileBase::verify_array_capacities):
Added ErrorCode.

gcc/testsuite/ChangeLog:

* rust/compile/arrays2.rs: changed comment to pass
testcase.

Signed-off-by: Muhammad Mahad <mahadtxt@gmail.com>
gcc/rust/backend/rust-compile.cc
gcc/testsuite/rust/compile/arrays2.rs

index 2c2a2361e5909f34b9d8b7a63cd939faa6738d15..93f740fb8128cb6f60c46cf9637a8bec93a8c4e8 100644 (file)
@@ -401,11 +401,12 @@ HIRCompileBase::verify_array_capacities (tree ltype, tree rtype,
 
   if (ltype_length != rtype_length)
     {
-      rust_error_at (
-       rvalue_locus,
-       "expected an array with a fixed size of " HOST_WIDE_INT_PRINT_UNSIGNED
-       " elements, found one with " HOST_WIDE_INT_PRINT_UNSIGNED " elements",
-       ltype_length, rtype_length);
+      rust_error_at (rvalue_locus, ErrorCode::E0308,
+                    "mismatched types, expected an array with a fixed size "
+                    "of " HOST_WIDE_INT_PRINT_UNSIGNED
+                    " elements, found one with " HOST_WIDE_INT_PRINT_UNSIGNED
+                    " elements",
+                    ltype_length, rtype_length);
       return false;
     }
 
index c96f4f7d820895a2dd73683039ddf632ad36e980..668bcf0951b16005c6329fcb76ac8dbc00f36e73 100644 (file)
@@ -1,5 +1,5 @@
 // { dg-additional-options "-w" }
 fn main() {
     let array: [i32; 5] = [1, 2, 3];
-    // { dg-error "expected an array with a fixed size of 5 elements, found one with 3 elements" "" { target *-*-* } .-1 }
+    // { dg-error "mismatched types, expected an array with a fixed size of 5 elements, found one with 3 elements" "" { target *-*-* } .-1 }
 }