Skip to content

gccrs: Add new resolution mode CANONICAL/REFERNECE to type-check-type - #4840

Merged
philberty merged 1 commit into
masterfrom
phil/where-clause
Sep 3, 2026
Merged

gccrs: Add new resolution mode CANONICAL/REFERNECE to type-check-type#4840
philberty merged 1 commit into
masterfrom
phil/where-clause

Conversation

@philberty

@philberty philberty commented Sep 3, 2026

Copy link
Copy Markdown
Member

When handling where clause items such as:

  fn check<P>()
    where
      P: Deref,
      P::Target: Marker

What happens is the first 'P' used to get resolved to a reference hir-id item which meant that adding the bound to this position had no effect what needed to occur was bind it to the parent which meant i used name resolution to reverse lookup as a hack. This new mode for canonical gives us that parent in the first place so we can just add the bound directly now so no need for name resolution here

Fixes #4829

gcc/rust/ChangeLog:

* typecheck/rust-hir-type-check-type.cc (TypeCheckType::Resolve): new mode
(TypeCheckType::visit): likewise
(ResolveWhereClauseItem::visit): remove nr usage
* typecheck/rust-hir-type-check-type.h: new mode

gcc/testsuite/ChangeLog:

* rust/compile/issue-4829-1.rs: New test.
* rust/compile/issue-4829-2.rs: New test.

@philberty philberty added the core Issue related to the compilation of the `core` crate label Sep 3, 2026
When handling where clause items such as:

  fn check<P>()
    where
      P: Deref,
      P::Target: Marker

What happens is the first 'P' used to get resolved to a reference hir-id
item which meant that adding the bound to this position had no effect what
needed to occur was bind it to the parent which meant i used name resolution
to reverse lookup as a hack. This new mode for canonical gives us that
parent in the first place so we can just add the bound directly now so no
need for name resolution here

Fixes #4829

gcc/rust/ChangeLog:

	* typecheck/rust-hir-type-check-type.cc (TypeCheckType::Resolve): new mode
	(TypeCheckType::visit): likewise
	(ResolveWhereClauseItem::visit): remove nr usage
	* typecheck/rust-hir-type-check-type.h: new mode

gcc/testsuite/ChangeLog:

	* rust/compile/issue-4829-1.rs: New test.
	* rust/compile/issue-4829-2.rs: New test.

Signed-off-by: Philip Herron <herron.philip@googlemail.com>
@philberty
philberty added this pull request to the merge queue Sep 3, 2026
Merged via the queue into master with commit 2c76456 Sep 3, 2026
13 of 14 checks passed
@github-project-automation github-project-automation Bot moved this from Todo to Done in libcore 1.49 Sep 3, 2026
@philberty
philberty deleted the phil/where-clause branch September 4, 2026 19:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core Issue related to the compilation of the `core` crate

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Failed to lookup type reference for node

1 participant