]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
gccrs: [E0380] Use of auto trait with method or associated item
authorMuhammad Mahad <mahadtxt@gmail.com>
Thu, 17 Aug 2023 05:25:33 +0000 (10:25 +0500)
committerArthur Cohen <arthur.cohen@embecosm.com>
Tue, 16 Jan 2024 18:00:31 +0000 (19:00 +0100)
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>
gcc/rust/parse/rust-parse-impl.h
gcc/testsuite/rust/compile/auto_trait_invalid.rs

index ca58d5e571a32679dcf214388507b1b4e80c66df..971d8c84955147c326c47e386a7b6b9db48956f6 100644 (file)
@@ -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)
index 16dca571849126b17679e9c2eaeb291582ada1f9..66e45531f5d808a8274c774cb85335f58a03a656 100644 (file)
@@ -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" }