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

Fix rebinding imports #2312

Merged
merged 1 commit into from
Feb 13, 2024
Merged

Conversation

powerboat9
Copy link
Collaborator

This fixes rebinding imports, and should also get us closer to working glob imports.

@powerboat9 powerboat9 force-pushed the fix-import-as branch 2 times, most recently from 8772968 to 62f5051 Compare June 21, 2023 23:11
Copy link
Member

@CohenArthur CohenArthur left a comment

Choose a reason for hiding this comment

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

Import resolution needs to happen during early name resolution and macro expansion, so not within the "late" name resolver that is rust-ast-resolve-item.cc. At the moment the system is a bit of a mess and we are working on reimplementing our name resolution from scratch - I'll send the first PR soon, and it'd be great to have your contributions on it :)

@powerboat9 powerboat9 force-pushed the fix-import-as branch 2 times, most recently from 4785b56 to e7c6e69 Compare June 30, 2023 19:53
@powerboat9 powerboat9 marked this pull request as draft August 1, 2023 21:32
@CohenArthur
Copy link
Member

@powerboat9 are you interested in updating/rebasing this PR? I think it would still be worth it to have rebinding imports fixed for the existing name resolution algorithm, since NR 2.0 is taking longer than I planned (due to me not having time to work on it at all, sorry about that)

gcc/rust/ChangeLog:

	* resolve/rust-ast-resolve-item.cc
	(flatten_glob): Use Import class.
	(flatten_rebind): Likewise.
	(flatten_list): Likewise.
	(flatten): Likewise.
	(flatten_use_dec_to_paths): Likewise.
	(flatten_use_dec_to_imports): Likewise.
	(ResolveItem::visit): Likewise.
	(Import::add_prefix): New.
	(rust_flatten_nested_glob): Adjust test.
	(rust_flatten_glob): Likewise.
	(rust_flatten_rebind_none): Likewise.
	(rust_flatten_rebind): Likewise.
	(rust_flatten_rebind_nested): Likewise.
	(rust_flatten_list): Likewise.
	* resolve/rust-ast-resolve-item.h
	(class Import): New.

gcc/testsuite/ChangeLog:

	* rust/compile/use_2.rs: New test.

Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
@powerboat9
Copy link
Collaborator Author

powerboat9 commented Feb 12, 2024

Did a quick rebase, this should work

@powerboat9 powerboat9 marked this pull request as ready for review February 12, 2024 23:26
Copy link
Member

@CohenArthur CohenArthur left a comment

Choose a reason for hiding this comment

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

thanks :)

@CohenArthur CohenArthur added this pull request to the merge queue Feb 13, 2024
Merged via the queue into Rust-GCC:master with commit 239247a Feb 13, 2024
9 checks passed
@powerboat9 powerboat9 deleted the fix-import-as branch February 13, 2024 14:46
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