Skip to content

Rpitit const param type check compares wrong type - #164858

Draft
bit-aloo wants to merge 5 commits into
rust-lang:mainfrom
bit-aloo:2026-10-24-rpitit-const-param-type-ic
Draft

bit-aloo wants to merge 5 commits into
rust-lang:mainfrom
bit-aloo:2026-10-24-rpitit-const-param-type-ic

Conversation

@bit-aloo

@bit-aloo bit-aloo commented Oct 24, 2026 •

Copy link
Copy Markdown
Member

closes: #164710
surprisingly closes: #153375

This started with #162908, where we started translating the traits const parameter types into the impls context before comparing them.

However, in case of RPITIT, the impl item hidden type reuses the traits generic params, so their types are still written using the traits param indices. We were reading them using the impls indices instead, causing a mismatch. This kinda hit an error path that calls name() on the hidden type, which has no name, and cause ICE.

r? @khyperia

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Oct 24, 2026
@khyperia

khyperia commented Oct 27, 2026 •

Copy link
Copy Markdown
Member

looks good to me! r=me but could you add some sort of comment here in reference to the fact that this ideally would not be needed and instead we have proper impl generic args whose types are in impl generic arg format? (if you'd like, perhaps adding same comment, just above, in the comment added by #164318 - both this and that should probably be reverted when things are synthed)

it's also up to you on whether you'd like to merge this patch-over-the-hack fix, or only just do the proper fix and close this.

@bit-aloo
bit-aloo marked this pull request as draft October 27, 2026 10:05
@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Oct 27, 2026
@rust-cloud-vms
rust-cloud-vms Bot force-pushed the 2026-10-24-rpitit-const-param-type-ic branch from cd9a80f to 1044405 Compare October 30, 2026 10:03
query ty_span(def_id: LocalDefId) -> Span {
desc { "looking up span for `{}`'s type", tcx.def_path_str(def_id) }
cache_on_disk
feedable

@bit-aloo bit-aloo Oct 30, 2026 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

We are making ty_span feedable here, so its not great for incremental compilation making this query forever_red_node

View changes since the review

@rust-cloud-vms
rust-cloud-vms Bot force-pushed the 2026-10-24-rpitit-const-param-type-ic branch from 1044405 to e66d46c Compare October 30, 2026 10:32
@@ -0,0 +1,29 @@
//! Regression test for #153375.

@bit-aloo bit-aloo Oct 30, 2026 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This is the test which used to crash earlier.

View changes since the review

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[ICE]: name of non-Rpitit assoc item [ICE]: "DefId::expect_local: … isn't local" in phantom-lifetime heavy traits

3 participants