Skip to content

trait_selection: project.rs todo! ICE on UnsafeBinder for DiscriminantKind/Pointee #610

Description

@SebTardif

Bug

Classic trait projection (assemble_candidates_from_impls in rustc_trait_selection) still has todo!("FIXME(unsafe_binder)") for ty::UnsafeBinder when assembling built-in candidates for:

  1. DiscriminantKind (known-discriminant match arm)
  2. Pointee / metadata (struct-tail match arm)

These are separate from the new solver path in #584 / PR #587 (rustc_next_trait_solver normalizes_to), which has its own todo! arms.

Affected code

compiler/rustc_trait_selection/src/traits/project.rs (two sites)

Impact

ICE when projecting DiscriminantKind or Pointee metadata for unsafe-binder types on the classic selection/projection path.

Origin

Lines Commit Date Author
DiscriminantKind / Pointee arms 9a1c5eb5b385 2024-12-21 Michael Goulet

Suggested fix

Delegate to the erased inner type (same pattern as discriminant_ty / PR #565 for pointer_kind and ptr_metadata_ty_or_tail): instantiate bound regions with erased, then treat like the inner type for candidate assembly.

Related

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-type-systemType systemI-crashUnexpected panic or crashP-mediumMedium impact: affects specific usage patternsbugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions