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-7925] gccrs: [E0380] Use of auto trait with method or associated item
Date: Tue, 16 Jan 2024 18:07:51 +0000 (GMT)	[thread overview]
Message-ID: <20240116180751.29CE438582B9@sourceware.org> (raw)

https://gcc.gnu.org/g:0ae1af0eb31d99f4cd5ba05a199770aeee764567

commit r14-7925-g0ae1af0eb31d99f4cd5ba05a199770aeee764567
Author: Muhammad Mahad <mahadtxt@gmail.com>
Date:   Thu Aug 17 10:25:33 2023 +0500

    gccrs: [E0380] Use of auto trait with method or associated item
    
    gcc/rust/ChangeLog:
    
            * parse/rust-parse-impl.h (Parser::parse_trait):
            added errorcode & updated error message.
    
    gcc/testsuite/ChangeLog:
    
            * rust/compile/auto_trait_invalid.rs:
            Updated comment.
    
    Signed-off-by: Muhammad Mahad <mahadtxt@gmail.com>

Diff:
---
 gcc/rust/parse/rust-parse-impl.h                 | 4 ++--
 gcc/testsuite/rust/compile/auto_trait_invalid.rs | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/gcc/rust/parse/rust-parse-impl.h b/gcc/rust/parse/rust-parse-impl.h
index ca58d5e571a..971d8c84955 100644
--- a/gcc/rust/parse/rust-parse-impl.h
+++ b/gcc/rust/parse/rust-parse-impl.h
@@ -4923,8 +4923,8 @@ Parser<ManagedTokenSource>::parse_trait (AST::Visibility vis,
 
   if (is_auto_trait && !trait_items.empty ())
     {
-      add_error (
-	Error (locus, "associated items are forbidden within auto traits"));
+      add_error (Error (locus, ErrorCode::E0380,
+			"auto traits cannot have associated items"));
 
       // FIXME: unsure if this should be done at parsing time or not
       for (const auto &item : trait_items)
diff --git a/gcc/testsuite/rust/compile/auto_trait_invalid.rs b/gcc/testsuite/rust/compile/auto_trait_invalid.rs
index 16dca571849..66e45531f5d 100644
--- a/gcc/testsuite/rust/compile/auto_trait_invalid.rs
+++ b/gcc/testsuite/rust/compile/auto_trait_invalid.rs
@@ -2,7 +2,7 @@
 
 #![feature(optin_builtin_traits)]
 
-unsafe auto trait Invalid { // { dg-error "associated items are forbidden within auto traits" }
+unsafe auto trait Invalid { // { dg-error "auto traits cannot have associated items" }
     fn foo(); // { dg-message "remove this item" }
 
     fn bar() {} // { dg-message "remove this item" }

                 reply	other threads:[~2024-01-16 18:07 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=20240116180751.29CE438582B9@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: link
Be 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).