Skip to content

ICE: queries overflow the depth limit , ice when trying to get query map #142159

Open
@matthiaskrgr

Description

@matthiaskrgr

Note: the lints are not strictly neccessary but they make it easiert to hit the ICE

auto-reduced (treereduce-rust):

//@compile-flags: --edition=2024 -Zthreads=8 -Wunused-import-braces -Wunused-lifetimes -Wunused-macro-rules -Wunused-qualifications -Wunused-results -Wvariant-size-differences --crate-type=lib
#![feature(async_drop)]
// This testcase used to ICE in codegen due to inconsistent field reordering
// in the coroutine state, claiming a ZST field was after a non-ZST field,
// while those two fields were at the same offset (which is impossible).

//@ build-pass
//@ edition:2018

async fn foo<F>(_: &(), _: F) {
    async {
        foo(&(), || {}).await;
    };
}

fn main() {
    foo(&(), || {});
    async {};
}

original:

// This testcase used to ICE in codegen due to inconsistent field reordering
// in the coroutine state, claiming a ZST field was after a non-ZST field,
// while those two fields were at the same offset (which is impossible).
// That is, memory ordering of `(X, ())`, but offsets of `((), X)`.

//@ build-pass
//@ edition:2018

async fn foo<F>(_: &(), _: F) {
    foo(&(), || {});
    async {
        foo(&(), || {}).await;
    };
}

fn main() {
    foo(&(), || {});
    async {
        foo(&(), || {}).await;
    };
}

Version information

rustc 1.89.0-nightly (c57119b9a 2025-06-07)
binary: rustc
commit-hash: c57119b9a1c86968188bb9703a7859c17f8bc71c
commit-date: 2025-06-07
host: x86_64-unknown-linux-gnu
release: 1.89.0-nightly
LLVM version: 20.1.5

Command:
/home/matthias/.rustup/toolchains/master/bin/rustc --edition=2024 -Zcrate-attr=feature(async_drop) -Zthreads=8 -Wunused-import-braces -Wunused-lifetimes -Wunused-macro-rules -Wunused-qualifications -Wunused-results -Wvariant-size-differences --crate-type=lib

@rustbot label +F-async_drop

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-parallel-compilerArea: parallel compilerC-bugCategory: This is a bug.F-async_drop`#![feature(async_drop)]`I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions