Skip to content

Conversation

@P-E-P
Copy link
Member

@P-E-P P-E-P commented Jan 21, 2026

Fixes #4399

@P-E-P P-E-P changed the title Name resolution fix module border name resolution: fixes resolution through modules Jan 21, 2026
@P-E-P P-E-P force-pushed the name_resolution_fix_module_border branch from fec9fde to 704f5b2 Compare January 21, 2026 15:35
@P-E-P P-E-P requested a review from CohenArthur January 21, 2026 15:35
@P-E-P P-E-P added this to the Name Resolution 2.0 rework milestone Jan 21, 2026
P-E-P added 2 commits January 21, 2026 21:36
An item from a parent module should be brought into scope with a Use
declaration and not implicitly. This means we should not continue
iterating over the upper ribs when meeting a module rib.

This fix breaks the compilation of core since the items from the
uppermost ribs are brought within scope with the prelude mechanism which
is not complete yet.

gcc/rust/ChangeLog:

	* resolve/rust-forever-stack.hxx: Prevent iteration on parent ribs.

gcc/testsuite/ChangeLog:

	* rust/compile/name_resolution26.rs: New test.
	* rust/compile/derive-default1.rs: Add no_core attribute and fix the
	testcase with a proper name usage which does not break name resolution
	rules.
	* rust/compile/derive-eq-invalid.rs: Likewise.
	* rust/compile/derive-hash1.rs: Likewise.
	* rust/compile/issue-2905-2.rs: Likewise.
	* rust/compile/issue-3402-1.rs: Likewise.
	* rust/compile/issue-3403.rs: Likewise.
	* rust/compile/name_resolution18.rs: Likewise.
	* rust/compile/privacy2.rs: Likewise.
	* rust/execute/torture/derive-default1.rs: Likewise.
	* rust/core/core.exp: Revert last compilation step to attribute check.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Those tokens were not generated correctly from the AST and thus made
some macros erroneous.

gcc/rust/ChangeLog:

	* ast/rust-ast-collector.cc (TokenCollector::visit): Add colon and
	type param bound tokens when collecting a trait ast node.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
@P-E-P P-E-P force-pushed the name_resolution_fix_module_border branch from 704f5b2 to 58fc82b Compare January 21, 2026 20:37
@P-E-P P-E-P added this pull request to the merge queue Jan 22, 2026
Merged via the queue into Rust-GCC:master with commit d47331f Jan 23, 2026
12 checks passed
@github-project-automation github-project-automation bot moved this from Todo to Done in name resolution 2.0 Jan 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

Name resolution does not reject code

1 participant