Skip to content

Conversation

philberty
Copy link
Member

When we have an invalid capacity expression we can't try to then also const fold it as GCC will assert on invalid conversions.

Fixes #4168

gcc/rust/ChangeLog:

* typecheck/rust-hir-type-check-type.cc (TypeCheckType::visit): check for invalid capacity

gcc/testsuite/ChangeLog:

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

When we have an invalid capacity expression we can't try to then also
const fold it as GCC will assert on invalid conversions.

Fixes #4168

gcc/rust/ChangeLog:

	* typecheck/rust-hir-type-check-type.cc (TypeCheckType::visit): check for invalid capacity

gcc/testsuite/ChangeLog:

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

Signed-off-by: Philip Herron <[email protected]>
@philberty philberty added this to the Const generics 2 milestone Sep 17, 2025
@philberty philberty added this pull request to the merge queue Sep 17, 2025
Merged via the queue into master with commit dab88dc Sep 17, 2025
13 checks passed
@github-project-automation github-project-automation bot moved this from Todo to Done in libcore 1.49 Sep 17, 2025
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 build2, at tree.cc:5265 const fn as part of LHS

1 participant