diff options
author | Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com> | 2023-11-20 14:59:56 +0100 |
---|---|---|
committer | P-E-P <32375388+P-E-P@users.noreply.github.com> | 2023-11-21 11:15:44 +0000 |
commit | b1b0de60cd99742eb71dd909969e128ea0cd94ef (patch) | |
tree | 5563ae6000dea2159e8d6a3bb61d8c4d732e041c /gcc/rust/parse | |
parent | 1786c4fcb1caea99000c7c874f88688713a6b661 (diff) | |
download | gcc-b1b0de60cd99742eb71dd909969e128ea0cd94ef.zip gcc-b1b0de60cd99742eb71dd909969e128ea0cd94ef.tar.gz gcc-b1b0de60cd99742eb71dd909969e128ea0cd94ef.tar.bz2 |
Add check for associated items on auto traits
Reject rust code with associated items on auto traits.
gcc/rust/ChangeLog:
* checks/errors/rust-ast-validation.cc (ASTValidation::visit): Add auto
trait associated item check in AST validation pass.
* parse/rust-parse-impl.h: Remove old error emission done during
parsing pass.
gcc/testsuite/ChangeLog:
* rust/compile/auto_trait_invalid.rs: Update old test with updated
error message.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Diffstat (limited to 'gcc/rust/parse')
-rw-r--r-- | gcc/rust/parse/rust-parse-impl.h | 12 |
1 files changed, 0 insertions, 12 deletions
diff --git a/gcc/rust/parse/rust-parse-impl.h b/gcc/rust/parse/rust-parse-impl.h index 5a276d1..421b213 100644 --- a/gcc/rust/parse/rust-parse-impl.h +++ b/gcc/rust/parse/rust-parse-impl.h @@ -4989,18 +4989,6 @@ Parser<ManagedTokenSource>::parse_trait (AST::Visibility vis, return nullptr; } - if (is_auto_trait && !trait_items.empty ()) - { - 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) - add_error (Error::Hint (item->get_locus (), "remove this item")); - - return nullptr; - } - trait_items.shrink_to_fit (); return std::unique_ptr<AST::Trait> ( new AST::Trait (std::move (ident), is_unsafe, is_auto_trait, |