Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[E0380] Use of auto trait with method or associated item #2527

Merged
merged 1 commit into from
Aug 17, 2023

Conversation

MahadMuhammad
Copy link
Contributor

Use of auto trait with a method or an associated item - E0380

  • Updated add_error to rust_error_at

Running testcase:


gcc/rust/ChangeLog:

* parse/rust-parse-impl.h (Parser::parse_trait): added errorcode.

gcc/testsuite/ChangeLog:

* rust/compile/auto_trait_invalid.rs: New comment.

@P-E-P P-E-P added enhancement diagnostic diagnostic static analysis labels Aug 7, 2023
@MahadMuhammad MahadMuhammad marked this pull request as draft August 9, 2023 18:14
@philberty philberty added this to the GCC 14 Stage 3 milestone Aug 10, 2023
@philberty
Copy link
Member

@MahadMuhammad is this ready to go? It looks good

Comment on lines 4925 to 4926
rust_error_at (locus, ErrorCode::E0380,
"auto traits cannot have methods or associated items");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, this does change the behavior of the code. add_error adds the created error to an internal table in the parser, which can choose to emit them later on or not. so we need to keep using add_error instead of rust_error_at

gcc/rust/ChangeLog:

	* parse/rust-parse-impl.h (Parser::parse_trait):
	added errorcode & updated error message.

gcc/testsuite/ChangeLog:

	* rust/compile/auto_trait_invalid.rs:
	Updated comment.

Signed-off-by: Muhammad Mahad <mahadtxt@gmail.com>
Copy link
Member

@philberty philberty left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@philberty philberty added this pull request to the merge queue Aug 17, 2023
Merged via the queue into Rust-GCC:master with commit 3ef836f Aug 17, 2023
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
diagnostic diagnostic static analysis enhancement
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

None yet

4 participants