Skip to content

Conversation

Polygonalr
Copy link
Contributor

@Polygonalr Polygonalr commented Aug 27, 2025

Fixes #3930

Also optimized the code for the NO_REST case and implemented the missing HAS_REST case for the read-only checker while I'm at it, since the read-only checker's test does not compile without #3930's fix.

GIMPLE dump from compiling issue-3930.rs:

...
  const i32 b;
  const i32 a;

  D.114.__0 = 2;
  D.114.__1 = 3;
  RUSTTMP.1 = D.114;
  a = RUSTTMP.1.__0;
  b = RUSTTMP.1.__1;
...

gcc/rust/ChangeLog:

	* backend/rust-compile-var-decl.h (CompileVarDecl::visit(TuplePattern)): Implement
	variable declaration bindings for tuple patterns with rest pattern (i.e.
	TuplePatternItemsHasRest).

Signed-off-by: Yap Zhi Heng <[email protected]>
gcc/rust/ChangeLog:

	* checks/errors/rust-readonly-check.cc (collect_assignment_tuple): Implement
	read-only checker for tuple patterns with rest pattern.

Signed-off-by: Yap Zhi Heng <[email protected]>
@Polygonalr Polygonalr changed the title Implement missing variable declaration binding case for TuplePatternItemsHasRest Implement missing var decl binding & read-only checker cases for TuplePatternItemsHasRest Aug 28, 2025
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.

ICE in visit, at rust/backend/rust-compile-pattern.cc:846 let (a, .., b) = (2, 3)
1 participant