Repository navigation
ExistentialTraitRef::with_self_ty gets called with escaping bound vars since a few months ago #157122
Copy link
Copy link
Closed
Labels
A-dyn-traitArea: trait objects, vtable layoutArea: trait objects, vtable layoutC-bugCategory: This is a bug.Category: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.T-typesRelevant to the types team, which will review and decide on the PR/issue.Relevant to the types team, which will review and decide on the PR/issue.
Description
Activity
added on May 29, 2026
T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
C-bugCategory: This is a bug.Category: This is a bug.
T-typesRelevant to the types team, which will review and decide on the PR/issue.Relevant to the types team, which will review and decide on the PR/issue.
A-dyn-traitArea: trait objects, vtable layoutArea: trait objects, vtable layout
added on May 29, 2026
needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triagingThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
removed on Jun 9, 2026
needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triagingThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
added 2 commits that reference this issue on Jun 10, 2026
added 6 commits that reference this issue on Jun 10, 2026
added a commit that references this issue on Jun 11, 2026
Metadata
Metadata
Assignees
Labels
A-dyn-traitArea: trait objects, vtable layoutArea: trait objects, vtable layoutC-bugCategory: This is a bug.Category: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.T-typesRelevant to the types team, which will review and decide on the PR/issue.Relevant to the types team, which will review and decide on the PR/issue.
Back in March I opened PR #153497 which among other things uncommented a debug assertion that was accidentally commented out in refactoring PR #53816 all the way back in 2018 (that's 8 years ago!), see file
src/librustc/ty/sty.rsin the patch set. CI was happy but then after I rebased one month later in April, CI suddenly failed since rustc@stage1 could no longer build rustc@stage2 as it now triggered the assertion when trying to compileitertools(raw logs). It would be pretty crazy if this assertion never(?) triggered for 8+ years only to start triggering one month after me opening my PR, so I don't exactly know what's going on. Honestly, I don't even know for sure if this assertion is correct in the first place, somebody please enlighten me. Otherwise this needs a bisection.For now, I'm keeping it commented out but I'll at least add a FIXME.
Side note: By now I do know of the unimplemented but accepted MCP 433 | Introduce ty::WhereClause to align chalk and rustc dyn representation from 2021 which would considerably change the representation & API of existential entities and would probably lead to this function getting completely replaced by
Bindermethods but of course it's been 5 years and in any case I think it's worth investigating what's going wrong here even if all of this ends up getting rewritten.To reproduce the ICE: Uncomment the
debug_assert!(!self_ty.has_escaping_bound_vars());inExistentialTraitRef::with_self_tyincompiler/rustc_type_ir/src/predicate.rs. Then./x build library --stage 2.