public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Arthur Cohen <cohenarthur@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r14-7903] gccrs: [E0308] array misamatch types Date: Tue, 16 Jan 2024 18:05:57 +0000 (GMT) [thread overview] Message-ID: <20240116180557.627893858420@sourceware.org> (raw) https://gcc.gnu.org/g:c24d0e9033df80b564e7e72803195ad10c1e4221 commit r14-7903-gc24d0e9033df80b564e7e72803195ad10c1e4221 Author: Muhammad Mahad <mahadtxt@gmail.com> Date: Sat Aug 5 12:55:36 2023 +0500 gccrs: [E0308] array misamatch types 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> Diff: --- gcc/rust/backend/rust-compile.cc | 11 ++++++----- gcc/testsuite/rust/compile/arrays2.rs | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/gcc/rust/backend/rust-compile.cc b/gcc/rust/backend/rust-compile.cc index 2c2a2361e59..93f740fb812 100644 --- a/gcc/rust/backend/rust-compile.cc +++ b/gcc/rust/backend/rust-compile.cc @@ -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; } diff --git a/gcc/testsuite/rust/compile/arrays2.rs b/gcc/testsuite/rust/compile/arrays2.rs index c96f4f7d820..668bcf0951b 100644 --- a/gcc/testsuite/rust/compile/arrays2.rs +++ b/gcc/testsuite/rust/compile/arrays2.rs @@ -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 } }
reply other threads:[~2024-01-16 18:05 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20240116180557.627893858420@sourceware.org \ --to=cohenarthur@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).