Skip to content

Parse deferred const generics#3886

Merged
CohenArthur merged 3 commits into
Rust-GCC:masterfrom
CohenArthur:parse-deferred-consts
Jul 21, 2025
Merged

Parse deferred const generics#3886
CohenArthur merged 3 commits into
Rust-GCC:masterfrom
CohenArthur:parse-deferred-consts

Conversation

@CohenArthur

Copy link
Copy Markdown
Member
  • ast: Use AnonConst for array type sizes
  • hir: Handle deferred const inference variables

@CohenArthur CohenArthur force-pushed the parse-deferred-consts branch from 910132e to 0c31e59 Compare July 9, 2025 09:23

@philberty philberty left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

gcc/rust/ChangeLog:

	* ast/rust-expr.h: Add handling for deferred consts.
	* ast/rust-ast-visitor.cc (DefaultASTVisitor::visit): Likewise.
	* ast/rust-ast.cc (AnonConst::as_string): Likewise.
	(ArrayType::as_string): Likewise.
	* ast/rust-type.h (class ArrayType): Use AnonConst for sizes.
	* parse/rust-parse-impl.h (Parser::parse_anon_const): New function.
	(Parser::parse_slice_or_array_type): Call it.
	* parse/rust-parse.h: Declare it.
gcc/rust/ChangeLog:

	* hir/rust-ast-lower-expr.cc (ASTLoweringExpr::visit): Handle defered consts.
	* hir/tree/rust-hir-expr.cc (AnonConst::AnonConst): Likewise.
	(AnonConst::operator=): Likewise.
	* hir/tree/rust-hir-expr.h: Likewise.
	* hir/tree/rust-hir-visitor.cc (DefaultHIRVisitor::walk): Likewise.
	* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): Likewise.

gcc/testsuite/ChangeLog:

	* rust/compile/deferred_const_inference.rs: New test.
gcc/rust/ChangeLog:

	* ast/rust-expr.h: Fix formatting.
@CohenArthur CohenArthur force-pushed the parse-deferred-consts branch from 0c31e59 to 8da5614 Compare July 21, 2025 07:40
@CohenArthur CohenArthur enabled auto-merge July 21, 2025 07:41
@CohenArthur CohenArthur added this pull request to the merge queue Jul 21, 2025
Merged via the queue into Rust-GCC:master with commit 032e053 Jul 21, 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.

2 participants