diff options
author | Muhammad Mahad <mahadtxt@gmail.com> | 2023-08-17 10:25:33 +0500 |
---|---|---|
committer | Arthur Cohen <arthur.cohen@embecosm.com> | 2024-01-16 19:00:31 +0100 |
commit | 0ae1af0eb31d99f4cd5ba05a199770aeee764567 (patch) | |
tree | 86f50c698edaba1d458f4a4a942e8ad5c4c5f78e /gcc | |
parent | c0b25c9a3b25510d47cdf6b37afaf208c00a1c0d (diff) | |
download | gcc-0ae1af0eb31d99f4cd5ba05a199770aeee764567.zip gcc-0ae1af0eb31d99f4cd5ba05a199770aeee764567.tar.gz gcc-0ae1af0eb31d99f4cd5ba05a199770aeee764567.tar.bz2 |
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>
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/rust/parse/rust-parse-impl.h | 4 | ||||
-rw-r--r-- | 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 ca58d5e..971d8c8 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 16dca57..66e4553 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" } |