Skip to content

Conversation

0xllx0
Copy link
Contributor

@0xllx0 0xllx0 commented Sep 8, 2025

Adds a test to verify extra parentheses are discarded, and the source is compiled as expected.

Resolves: #2886, #4148

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.

@CohenArthur
Copy link
Member

Thanks for the contribution @0xllx0! Your test is correct but unfortunately gccrs parses it as a trait and does the wrong thing, and errors out 😬 could you create an issue for this? You can also work on fixing it within this PR if you want

@0xllx0
Copy link
Contributor Author

0xllx0 commented Sep 10, 2025

gccrs parses it as a trait and does the wrong thing, and errors out 😬 could you create an issue for this? You can also work on fixing it within this PR if you want

How do I get the test to fail then? That's what I was expecting, but marking it as a "should fail" test didn't feel right, as the test is expected to eventually pass, but should fail now.

I opened a tracking issue for the test mismatch: #4148

I'd be happy to work on the fix in this PR.

@0xllx0 0xllx0 marked this pull request as draft September 10, 2025 23:10
@0xllx0
Copy link
Contributor Author

0xllx0 commented Sep 18, 2025

Your test is correct but unfortunately gccrs parses it as a trait and does the wrong thing, and errors out 😬 could you create an issue for this? You can also work on fixing it within this PR if you want

I think I figured out the problem, just needed to add dg-warning directive comments. The parens test now fails as expected, and includes checks for the expected warning messages (can be adjusted based on the actual warnings output by gccrs after a parsing fix).

@0xllx0 0xllx0 marked this pull request as ready for review September 18, 2025 18:28
@powerboat9
Copy link
Collaborator

If gccrs is behaving incorrectly, I'd think it'd be proper to add a test verifying gccrs behaves ~correctly after/while making sure that gccrs behaves correctly.

@0xllx0
Copy link
Contributor Author

0xllx0 commented Sep 23, 2025

If gccrs is behaving incorrectly, I'd think it'd be proper to add a test verifying gccrs behaves ~correctly after/while making sure that gccrs behaves correctly.

Alright, so while the ICE exists, mark this test as xfail, and change the test to check for expected warnings once the fix is in?

@0xllx0 0xllx0 force-pushed the tests/extra-parens branch 3 times, most recently from 51bef28 to 7ec196a Compare September 30, 2025 04:38
Adds a test to verify extra parentheses are discarded, and the source is
compiled as expected.

Resolves: Rust-GCC#2886

gcc/testsuite/ChangeLog:

	* rust/compile/issue-4148.rs: New test.

Signed-off-by: Elle Rhumsaa <[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.

That looks good, thank you!

@CohenArthur CohenArthur added this pull request to the merge queue Oct 1, 2025
Merged via the queue into Rust-GCC:master with commit d6118c7 Oct 1, 2025
13 checks passed
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.

Unused parentheses in parameters causes internal compiler error

3 participants