Skip to content

Conversation

@CohenArthur
Copy link
Member

gcc/rust/ChangeLog:

* util/rust-hir-map.cc (Mappings::insert_module_id): New function. (Mappings::is_module): Likewise.
* util/rust-hir-map.h: Store a set of AST modules, declare functions for adding and retrieving them.
* resolve/rust-toplevel-name-resolver-2.0.cc (TopLevel::visit): Insert modules in the type namespace and store them in mappings.
* resolve/rust-late-name-resolver-2.0.cc (resolve_type_path_like): Error out when an expected type resolves to a module.

gcc/testsuite/ChangeLog:

* rust/compile/mod_in_types_ns.rs: New test.
* rust/compile/mod_in_types_ns2.rs: New test.

Fixes #4403

gcc/rust/ChangeLog:

	* util/rust-hir-map.cc (Mappings::insert_module_id): New function.
	(Mappings::is_module): Likewise.
	* util/rust-hir-map.h: Store a set of AST modules, declare functions for adding and
	retrieving them.
	* resolve/rust-toplevel-name-resolver-2.0.cc (TopLevel::visit): Insert modules in the type
	namespace and store them in mappings.
	* resolve/rust-late-name-resolver-2.0.cc (resolve_type_path_like): Error out when an
	expected type resolves to a module.

gcc/testsuite/ChangeLog:

	* rust/compile/mod_in_types_ns.rs: New test.
	* rust/compile/mod_in_types_ns2.rs: New test.
@P-E-P P-E-P self-requested a review January 22, 2026 11:37
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.

Modules need to be inserted in the type namespace

2 participants