-
Notifications
You must be signed in to change notification settings - Fork 200
gccrs: fix parser error on parenthesised types #4214
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
base: master
Are you sure you want to change the base?
Conversation
|
|
||
| // get value semantics trait bound | ||
| AST::TraitBound value_bound (*converted_bound); | ||
| /* |
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.
This is dead code, if it isn't required it won't be touched again, delete it and put a comment if any information should remain.
| new AST::ParenthesisedType (std::move (released_ptr), | ||
| left_delim_locus)); | ||
|
|
||
| /* HACK: attempt to convert to trait bound. if fails, parenthesised |
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.
Should probably be removed.
| // release vector pointer | ||
| std::unique_ptr<AST::Type> released_ptr = std::move (types[0]); | ||
|
|
||
| // We don't want to convert it to TraitBound as it could be a |
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.
This comment fails to cover one case, what if it isn't ?
Do not cast parenthesised types to TraitBound types Fixes Rust-GCC#4148 gcc/rust/ChangeLog: * parse/rust-parse-impl.h (Parser::parse_paren_prefixed_type): remove cast to TraitBound. gcc/testsuite/ChangeLog: * rust/compile/issue-4148.rs: test should not produce errors. Signed-off-by: lenny.chiadmi-delage <lenny.chiadmi-delage@epita.fr>
Do not cast parenthesised types to TraitBound types gcc/rust/ChangeLog: * ast/rust-path.cc (TypePath::to_trait_bound): * hir/tree/rust-hir-type.cc (ParenthesisedType::to_trait_bound): * hir/tree/rust-hir.cc (TypePath::to_trait_bound): * parse/rust-parse-impl.h (Parser::parse_paren_prefixed_type): * parse/rust-parse-impl.h (Parser::parse_paren_prefixed_type): Signed-off-by: lenny.chiadmi-delage <lenny.chiadmi-delage@epita.fr>
Do not cast parenthesised types to TraitBound types
Fixes #4148
gcc/rust/ChangeLog:
gcc/testsuite/ChangeLog:
Thank you for making Rust GCC better!
If your PR fixes an issue, you can add "Fixes #issue_number" into this
PR description and the git commit message. This way the issue will be
automatically closed when your PR is merged. If your change addresses
an issue but does not fully fix it please mark it as "Addresses #issue_number"
in the git commit message.
Here is a checklist to help you with your PR.
make check-rustpasses locallyclang-formatgcc/testsuite/rust/Note that you can skip the above if you are just opening a WIP PR in
order to get feedback.
*Please write a comment explaining your change. This is the message
that will be part of the merge commit.