-
Notifications
You must be signed in to change notification settings - Fork 161
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
gccrs: fix a compiler crash when path expression contains nothing #3286
base: master
Are you sure you want to change the base?
Conversation
This should probably be handled by the parser, rather than the type checker, but good catch |
I want to handle this in the parser, but there seems to be a curious comment in the parser code (https://github.com/Rust-GCC/gccrs/pull/3286/files#diff-0ec0ef9112d5a4a50636e9fde592f348f936f51b4139796976c7ad1608f935f8R6716-R6717) that states: // skip after somewhere?
// don't necessarily throw error but yeah |
Yeah, that's a bit odd. It looks like that comment was introduced by |
I agree with @powerboat9. I think this case should be handled in the parser, this is how |
8b039e3
to
658ca0f
Compare
gcc/rust/ChangeLog: * ast/rust-path.h: allows error nodes to specify the source location, so that it could be used in diagnostics later. * parse/rust-parse-impl.h: creates the PathInExpression error node with source location and prints proper diagnostics if the path is empty. gcc/testsuite/ChangeLog: * rust/compile/paamayim-nekudotayim.rs: add a test for testing proper error recovery logic when there is no path names.
658ca0f
to
b963d59
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we need for #3295 to go through or this PR will also fail if it gets rebased. but I'm happy to merge it
{ | ||
rust_error_at (path.get_locus (), "expected identifier"); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
{ | |
rust_error_at (path.get_locus (), "expected identifier"); | |
} | |
rust_error_at (path.get_locus (), "expected identifier"); |
small formatting nit :)
gcc/rust/ChangeLog:
gcc/testsuite/ChangeLog: