Skip to content

fixed generics of crate node ICE#153615

Open
enthropy7 wants to merge 1 commit intorust-lang:mainfrom
enthropy7:fix-ice-generics-of-crate-node
Open

fixed generics of crate node ICE#153615
enthropy7 wants to merge 1 commit intorust-lang:mainfrom
enthropy7:fix-ice-generics-of-crate-node

Conversation

@enthropy7
Copy link
Contributor

@enthropy7 enthropy7 commented Mar 9, 2026

when note_and_explain_type_err is called during dyn-compatibility checking, the body_owner_def_id can be CRATE_DEF_ID because ObligationCause::dummy() uses it as a placeholder when there is no real body owner. calling generics_of on CRATE_DEF_ID caused an ICE because the crate root is a module and modules don't have generics. the fix guards all generics_of call sites by checking whether body_owner_def_id is CRATE_DEF_ID before attempting to look up generics, and skips the type parameter span labeling in that case.

i also added regression test with original ice reproduce

fixes #152335

@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 Mar 9, 2026
@rustbot
Copy link
Collaborator

rustbot commented Mar 9, 2026

r? @fee1-dead

rustbot has assigned @fee1-dead.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: compiler
  • compiler expanded to 69 candidates
  • Random selection from 14 candidates

@rustbot
Copy link
Collaborator

rustbot commented Mar 9, 2026

⚠️ Warning ⚠️

@rust-log-analyzer

This comment has been minimized.

@enthropy7 enthropy7 force-pushed the fix-ice-generics-of-crate-node branch from b6c1120 to 948df5b Compare March 9, 2026 16:46
@enthropy7 enthropy7 force-pushed the fix-ice-generics-of-crate-node branch from 948df5b to 8aec809 Compare March 9, 2026 17:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[ICE]: generics_of: unexpected node kind Crate(Mod..

4 participants