Skip to content

gen blocks causing "unexpected autoderef error" since nightly 2025-11-25 #21217

@cyb0124

Description

@cyb0124

rust-analyzer version:
Works on:
1.93.0-nightly (c23ed3ef 2025-11-23) [C:\Users\cyb\.rustup\toolchains\nightly-2025-11-24-x86_64-pc-windows-msvc\bin\rust-analyzer.exe]
Stopped working since:
1.93.0-nightly (c871d09d 2025-11-24) [C:\Users\cyb\.rustup\toolchains\nightly-2025-11-25-x86_64-pc-windows-msvc\bin\rust-analyzer.exe]
Still not working on:
1.94.0-nightly (1aa9bab4 2025-12-05) [C:\Users\cyb\.rustup\toolchains\nightly-2025-12-06-x86_64-pc-windows-msvc\bin\rust-analyzer.exe]

editor or extension: VSCode

code snippet to reproduce:

#![feature(gen_blocks)]

pub struct Outer<T> {
    pub inner: Inner<T>,
    pub flag: bool,
}

pub enum Inner<T> {
    A([T; 1]),
    B(T),
}

impl<T> Outer<T> {
    pub fn func<'a>(&'a self) -> impl Iterator<Item = &'a T> {
        gen {
            if self.flag {
                return;
            }
            match &self.inner {
                Inner::A(x) => drop(x.iter()),
                Inner::B(x) => yield x,
            }
        }
    }
}

fn main() {}

Many actions (typing, hovering, selecting) result in this same error:
thread 'Worker2' (8520) panicked at src\tools\rust-analyzer\crates\hir-ty\src\method_resolution\probe.rs:1553:17: internal error: entered unreachable code: unexpected autoderef error [TrueError(Obligation { cause: ObligationCause { _private: () }, param_env: ParamEnv { clauses: [Clause(Binder { value: TraitPredicate(#0: Sized, polarity:Positive), bound_vars: [] })] }, predicate: Binder { value: AliasRelate(Alias(Opaque, AliasTy { args: [#0, #1], def_id: InternedOpaqueTyId(InternedOpaqueTyId { loc: ReturnTypeImplTrait(FunctionId(36c00), Idx::<ImplTrait<'_>>(0)) }), .. }), Equate, ()), bound_vars: [] }, recursion_depth: 0 })]

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions