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>
This commit is contained in:
Pierre-Emmanuel Patry 2023-11-20 14:04:35 +01:00 committed by Arthur Cohen
parent 3e0e74f3e9
commit d8c1a756c4

View file

@ -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);