Skip to content

Conversation

@Villosse
Copy link
Contributor

Do not cast parenthesised types to TraitBound types

Fixes #4148

gcc/rust/ChangeLog:

* parse/rust-parse-impl.h (Parser::parse_paren_prefixed_type):

gcc/testsuite/ChangeLog:

* rust/compile/issue-4148.rs:

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.

@Villosse Villosse force-pushed the 4148 branch 8 times, most recently from 7c5bd8d to 68fc3aa Compare December 15, 2025 13:55
Do not cast parenthesised types to TraitBound types.

Fixes Rust-GCC#4148

gcc/rust/ChangeLog:

	* ast/rust-path.cc (TypePath::to_trait_bound): Check if in
	parenthesis.
	* hir/tree/rust-hir-type.cc (ParenthesisedType::to_trait_bound):
	Likewise.
	* hir/tree/rust-hir.cc (TypePath::to_trait_bound): Likewise.

gcc/testsuite/ChangeLog:

	* rust/compile/issue-4148.rs: Test should produce errors.

Signed-off-by: lenny.chiadmi-delage <[email protected]>
@P-E-P P-E-P added this pull request to the merge queue Dec 16, 2025
@P-E-P P-E-P removed this pull request from the merge queue due to a manual request Dec 16, 2025
@P-E-P P-E-P added this pull request to the merge queue Dec 16, 2025
Merged via the queue into Rust-GCC:master with commit 6996255 Dec 16, 2025
12 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.

tests: make check-rust fails to catch a parsing error

2 participants