rust-lang / rust-lang/rust

ICE: `assertion failed: !t.has_escaping_bound_vars()'`

Open
#132,055 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

C-bug E-needs-test F-non_lifetime_binders I-ICE requires-debug-assertions S-has-mcve T-compiler
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

auto-reduced (treereduce-rust):

#![feature(non_lifetime_binders)]

trait Trait<T: ?Sized> {
    type Assoc<'a> = i32;
}

fn produce() -> impl for<T> Trait<(), Assoc = impl Trait<T>> {
    16
}


original:

#![allow(incomplete_features)]
#![feature(non_lifetime_binders)]

trait Trait<T: ?Sized> {
    type Assoc<'a> = i32;

    fn with_assoc(f: impl FnOnce(Self::Assoc<'_>)) {
        f(5i32)
    }
}

fn produce() -> impl for<T> Trait<(), Assoc = impl Trait<T>> {
    //~^ ERROR associated type `Assoc` not found for `Trait`
    //~| ERROR associated type `Assoc` not found for `Trait`
    //~| the trait bound `{integer}: Trait<()>` is not satisfied
    16
}

fn main() {}

Version information

rustc 1.84.0-dev
binary: rustc
commit-hash: unknown
commit-date: unknown
host: x86_64-unknown-linux-gnu
release: 1.84.0-dev
LLVM version: 19.1.1

Command:
/home/gh-matthiaskrgr/.rustup/toolchains/local-debug-assertions/bin/rustc

@rustbot label +F-non_lifetime_binders

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by compiling the reduced example with the reported rustc command and inspect compiler/rustc_trait_selection/src/traits/select/mod.rs:643:21 alongside the evaluate_obligation query stack. Trace why the example reaches the assertion, then add coverage for the reduced case and verify that compilation reports a diagnostic instead of panicking.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.