Skip to content

Commit

Permalink
Reject auto traits with super trait
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
P-E-P committed Nov 21, 2023
1 parent c500e77 commit e361ece
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions gcc/rust/checks/errors/rust-ast-validation.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit e361ece

Please sign in to comment.