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

Support for rich-loc & errorcode in parser & expansion errors #2542

Merged
merged 1 commit into from
Aug 16, 2023

Conversation

MahadMuhammad
Copy link
Contributor

@MahadMuhammad MahadMuhammad commented Aug 10, 2023

Binding rich-loc & errorcode in parser & expansion errors

Added method of binding ErrorCode & rich location to parser and expansion errors.

Currently, the Error struct only supports simple location to parser and expansion errors. Updated the code to handle all cases for errorcode and parsing errors. Now, we can rich-loation to Error struct by using ampersand & operator.

The rust_error_at function immediately emits the error. But in some contexts we wish to collect them and discard them. Now, we can use errorcode and rich location in Error struct's context.


gcc/rust/ChangeLog:

* rust-diagnostics.cc (va_constructor): Added constructor for all possible cases. (Error::Error): Updated error struct for all possible cases.
* rust-diagnostics.h (struct Error): Updated error struct to support error code & rich location support.

@P-E-P P-E-P self-requested a review August 11, 2023 10:32
@P-E-P P-E-P added enhancement diagnostic diagnostic static analysis labels Aug 11, 2023
@P-E-P P-E-P added this to the GCC 14 Stage 3 milestone Aug 11, 2023
Added method of binding ErrorCode & rich location to
parser and expansion errors.
Fixes Rust-GCC#2385

gcc/rust/ChangeLog:

	* rust-diagnostics.cc (va_constructor):
	Added constructor for all possible cases.
	(Error::Error): Updated error struct
	for all possible cases.
	* rust-diagnostics.h (struct Error):
	Updated error struct to support error
	code & rich location support.

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 16, 2023
Merged via the queue into Rust-GCC:master with commit efa3041 Aug 16, 2023
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.

Add method of binding an ErrorCode to parser errors
3 participants