public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r14-8542] gccrs: Reject auto traits with super trait
@ 2024-01-30 11:58 Arthur Cohen
  0 siblings, 0 replies; only message in thread
From: Arthur Cohen @ 2024-01-30 11:58 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:d8c1a756c426c2aba1ef0662cf49bb2760edbb3c

commit r14-8542-gd8c1a756c426c2aba1ef0662cf49bb2760edbb3c
Author: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Date:   Mon Nov 20 14:04:35 2023 +0100

    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>

Diff:
---
 gcc/rust/checks/errors/rust-ast-validation.cc | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/gcc/rust/checks/errors/rust-ast-validation.cc b/gcc/rust/checks/errors/rust-ast-validation.cc
index 37d3668a9e04..aeae6035db8f 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);

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-01-30 11:58 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-30 11:58 [gcc r14-8542] gccrs: Reject auto traits with super trait Arthur Cohen

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).