Skip to content

nr2.0: Add more checks for alternate patterns#3829

Merged
P-E-P merged 1 commit into
Rust-GCC:masterfrom
powerboat9:fix-alt
Jun 30, 2025
Merged

nr2.0: Add more checks for alternate patterns#3829
P-E-P merged 1 commit into
Rust-GCC:masterfrom
powerboat9:fix-alt

Conversation

@powerboat9

Copy link
Copy Markdown
Collaborator

No description provided.

visit_identifier_as_pattern (ctx, identifier.get_ident (),
identifier.get_locus (),
identifier.get_node_id ());
identifier.get_node_id (),

@P-E-P P-E-P Jun 17, 2025

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.

At this point we'd better pass the identifier down the function instead of it's fields separately.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

That would require some modifications to AST::StructPatternFieldIdent -- which I suppose I could do

@P-E-P P-E-P Jun 20, 2025

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.

I've taken a closer look and I'm not sure it's worth the changes.

gcc/rust/ChangeLog:

	* resolve/rust-late-name-resolver-2.0.cc
	(visit_identifier_as_pattern): Handle is_ref and is_mut.
	(Late::visit): Likewise.
	* resolve/rust-name-resolution-context.cc
	(BindingLayer::insert_ident): Likewise.
	(BindingLayer::bind_test): Handle changes to BindingLayer
	fields.
	(BindingLayer::merge): Likewise and emit more error messages.
	* resolve/rust-name-resolution-context.h
	(struct IdentifierMode): New.
	(Binding::has_expected_bindings): New field.
	(Binding::set): Rename field to...
	(Binding::idents): ...here and convert from a set to a map.
	(Binding::Binding): Initialize has_expected_bindings.
	(BindingLayer::insert_ident): Adjust parameters.

gcc/testsuite/ChangeLog:

	* rust/compile/nr2/exclude: Remove torture/alt_patterns1.rs.

Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
@P-E-P P-E-P added this pull request to the merge queue Jun 30, 2025
Merged via the queue into Rust-GCC:master with commit ff61ba4 Jun 30, 2025
13 checks passed
@powerboat9 powerboat9 deleted the fix-alt branch June 30, 2025 15:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants