Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent duplicate resolution insertions #3456

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

powerboat9
Copy link
Collaborator

The 1.0 name resolver allows insertions of resolutions to duplicate (or even overwrite) past resolutions. This PR as-is introduces assertions to prevent duplicate resolution insertions. Allowing duplicate-but-identical resolution insertions (inserting (a, b) and (a, c) is allowed iff b == c) would be an alternative approach.

@powerboat9 powerboat9 marked this pull request as ready for review February 26, 2025 16:39
gcc/rust/ChangeLog:

	* expand/rust-derive-clone.cc
	(DeriveClone::clone_impl): Avoid using the same node id multiple
	times.
	(DeriveClone::clone_enum_identifier): Likewise.
	(DeriveClone::clone_enum_tuple): Likewise.
	* expand/rust-derive-copy.cc
	(DeriveCopy::copy_impl): Likewise.
	* resolve/rust-ast-resolve-item.cc
	(flatten_list): Likewise.
	* resolve/rust-ast-resolve-path.cc
	(ResolvePath::resolve_path): Prevent reinsertion of resolutions.
	* resolve/rust-ast-resolve-type.cc
	(ResolveRelativeTypePath::go): Likewise.
	* typecheck/rust-hir-type-check-expr.cc
	(TypeCheckExpr::resolve_fn_trait_call): Likewise.
	* resolve/rust-name-resolver.cc
	(Resolver::insert_resolved_name): Catch multiple resolution
	insertions.
	(Resolver::insert_resolved_type): Likewise.

gcc/testsuite/ChangeLog:

	* rust/compile/nr2/exclude: Remove entries.

Signed-off-by: Owen Avery <[email protected]>
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