diff options
author | Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com> | 2023-11-20 14:04:35 +0100 |
---|---|---|
committer | Arthur Cohen <arthur.cohen@embecosm.com> | 2024-01-30 12:36:43 +0100 |
commit | d8c1a756c426c2aba1ef0662cf49bb2760edbb3c (patch) | |
tree | b665c311d80c683a6c0ab9dd5382182ce0544a84 /gcc/rust | |
parent | 3e0e74f3e9cee9db52ef40ccacc4bc667a569455 (diff) | |
download | gcc-d8c1a756c426c2aba1ef0662cf49bb2760edbb3c.zip gcc-d8c1a756c426c2aba1ef0662cf49bb2760edbb3c.tar.gz gcc-d8c1a756c426c2aba1ef0662cf49bb2760edbb3c.tar.bz2 |
gccrs: Reject auto traits with super trait
Reject auto traits containing a super trait bound during AST validation
pass.
gcc/rust/ChangeLog:
* checks/errors/rust-ast-validation.cc (ASTValidation::visit): Reject
auto traits with super traits.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Diffstat (limited to 'gcc/rust')
-rw-r--r-- | gcc/rust/checks/errors/rust-ast-validation.cc | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/gcc/rust/checks/errors/rust-ast-validation.cc b/gcc/rust/checks/errors/rust-ast-validation.cc index 37d3668..aeae603 100644 --- a/gcc/rust/checks/errors/rust-ast-validation.cc +++ b/gcc/rust/checks/errors/rust-ast-validation.cc @@ -105,6 +105,10 @@ ASTValidation::visit (AST::Trait &trait) rust_error_at (trait.get_generic_params ()[0]->get_locus (), ErrorCode::E0567, "auto traits cannot have generic parameters"); + if (trait.has_type_param_bounds ()) + rust_error_at (trait.get_type_param_bounds ()[0]->get_locus (), + ErrorCode::E0568, + "auto traits cannot have super traits"); } AST::ContextualASTVisitor::visit (trait); |