Skip to content

Fix Self macro and partial macro invocation parsing null check #4073

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

Merged
merged 1 commit into from
Aug 14, 2025

Conversation

P-E-P
Copy link
Member

@P-E-P P-E-P commented Aug 12, 2025

Fixes #3974

No check was performed and the value was assumed non null.
Path conversion returned an empty path for "Self" due to a hack in
generics Self injection that prevented any "Self!" macro from beeing
recognized correctly.

gcc/rust/ChangeLog:

	* parse/rust-parse-impl.h (Parser::parse_stmt_or_expr): Add null check
	on parse_macro_invocation_partial call.
	* ast/rust-path.cc (Path::convert_to_simple_path): Do not exclude
	capitalized "Self".

gcc/testsuite/ChangeLog:

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

Signed-off-by: Pierre-Emmanuel Patry <[email protected]>
@P-E-P P-E-P added this pull request to the merge queue Aug 14, 2025
Merged via the queue into Rust-GCC:master with commit a67aafd Aug 14, 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.

segfault in parsing / parse_stmt_or_expr
1 participant