Skip to content

Conversation

Villosse
Copy link

Check if parser throw an error to avoid cloning nullptr

Fixes #4140

gcc/rust/ChangeLog:

* expand/rust-macro-expand.cc (transcribe_expression): check if parser didn't fail (transcribe_type): check if parser didn't fail (transcribe_pattern): check if parser didn't fail

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.

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.

Check if parser throw an error to avoid cloning nullptr

Fixes Rust-GCC#4140

gcc/rust/ChangeLog:

	* expand/rust-macro-expand.cc (transcribe_expression): check if
	parser didn't fail
	(transcribe_type): check if parser didn't fail
	(transcribe_pattern): check if parser didn't fail

Signed-off-by: lenny.chiadmi-delage <[email protected]>
Copy link
Member

@CohenArthur CohenArthur left a comment

Choose a reason for hiding this comment

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

LGTM thank you!

@CohenArthur
Copy link
Member

For your commit message:

  • We usually write "Likewise." instead of repeating the description above
  • People upstream may complain if you don't use proper punctuation and grammar, so try to capitalize the first letter of your description and end it with a period. So I would change "check if parser didn't fail" to "Check if parser didn't fail."

Sorry for nitpicking, this is great otherwise!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

segfault in clone_pattern w macro

2 participants