Skip to content

gccrs: Fix missing error diag on const parser and crash in typecheck - #4781

Merged
philberty merged 1 commit into
masterfrom
phil/crash
Aug 16, 2026
Merged

gccrs: Fix missing error diag on const parser and crash in typecheck#4781
philberty merged 1 commit into
masterfrom
phil/crash

Conversation

@philberty

Copy link
Copy Markdown
Member

We need to force braces on the default expression in the parser but also the typecheck cant const eval when the typecheck fails otherwise it will crash because invalid error mark node.

Fixes #4173

gcc/rust/ChangeLog:

* parse/rust-parse-impl.hxx:
* typecheck/rust-hir-type-check-base.cc:

gcc/testsuite/ChangeLog:

* rust/compile/issue-4173-1.rs: New test.
* rust/compile/issue-4173-2.rs: New test.
* rust/compile/issue-4173-3.rs: New test.

We need to force braces on the default expression in the parser but also
the typecheck cant const eval when the typecheck fails otherwise it will
crash because invalid error mark node.

Fixes #4173

gcc/rust/ChangeLog:

	* parse/rust-parse-impl.hxx:
	* typecheck/rust-hir-type-check-base.cc:

gcc/testsuite/ChangeLog:

	* rust/compile/issue-4173-1.rs: New test.
	* rust/compile/issue-4173-2.rs: New test.
	* rust/compile/issue-4173-3.rs: New test.

Signed-off-by: Philip Herron <herron.philip@googlemail.com>
@philberty
philberty added this pull request to the merge queue Aug 16, 2026
Merged via the queue into master with commit a8487d8 Aug 16, 2026
13 checks passed
@github-project-automation github-project-automation Bot moved this from Todo to Done in libcore 1.49 Aug 16, 2026
@philberty
philberty deleted the phil/crash branch August 30, 2026 18:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

ICE in get_expression, at rust/ast/rust-path.h:239 struct S<const N: u32 = u32::MAX>;

1 participant