From: Pierre-Emmanuel Patry Date: Mon, 20 Nov 2023 13:04:35 +0000 (+0100) Subject: gccrs: Reject auto traits with super trait X-Git-Tag: basepoints/gcc-15~1597 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d8c1a756c426c2aba1ef0662cf49bb2760edbb3c;p=thirdparty%2Fgcc.git 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 --- 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);