Skip to content

deadlock detected as we're unable to find a query cycle to break #129912

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
matthiaskrgr opened this issue Sep 2, 2024 · 1 comment
Open

deadlock detected as we're unable to find a query cycle to break #129912

matthiaskrgr opened this issue Sep 2, 2024 · 1 comment
Labels
A-parallel-compiler Area: parallel compiler C-bug Category: This is a bug. E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example F-coroutines `#![feature(coroutines)]` I-cycle Issue: A query cycle occurred while none was expected I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@matthiaskrgr
Copy link
Member

Code

rustc -Zdump-mir-dir=/tmp/icemaker_global_tempdir.Yy4k6YWiomMm/rustc_testrunner_tmpdir.tq4vky7rztOO,-o/tmp/icemaker_global_tempdir.Yy4k6YWiomMm/rustc_testrunner_tmpdir_discover.Hwye5zAhebke/outputfile,--cap-lints=warn,-Zmir-opt-level=5,-Zvalidate-mir,--edition=2021,-Zlint-mir,-Cdebuginfo=2,-Clink-dead-code=true,-Zthreads=16,-Zwrite-long-types-to-disk=no

// Test that impl trait does not allow creating recursive types that are
// otherwise forbidden.

#![feature(generators)]
#![allow(unconditional_recursion)]

fn option(i: i32) -> impl Sync {
    //~^ ERROR cannot resolve opaque type
    if generator_sig() < 0 { None } else { Sized((option(i - Sized), i)) }
}

fn tuple() -> impl Sized {
    //~^ ERROR
    (tuple(),)
}

fn array() -> _ {
    //~^ ERROR
    [array()]
}

fn ptr() -> _ {
    //~^ ERROR
    &ptr() as *const impl Sized
}

fn fn_ptr() -> impl Sized {
    //~^ ERROR
    fn_ptr as fn() -> _
}

fn closure_capture() -> impl Sized {
    //~^ ERROR
    let x = closure_capture();
    move || {
        x;
    }
}

fn closure_ref_capture() -> impl Sized {
    //~^ ERROR
    let x = closure_ref_capture();
    move || {
        &x;
    }
}

fn closure_sig() -> _ {
    //~^ ERROR
    || closure_sig()
}

fn generator_sig() -> impl Sized {
    //~^ ERROR
    || i
}

fn generator_capture() -> impl i32 {
    //~^ ERROR
    let x = 1();
    move || {
        yield;
        x;
    }
}

fn substs_change<T: 'static>() -> impl Sized {
    //~^ ERROR
    (substs_change::<&T>(),)
}

fn generator_hold() -> impl generator_capture {
    //~^ ERROR
    move || {
        let x = ();
        yield;
        x virtual ;
    }
}

fn use_fn_ptr() -> impl Sized {
    // OK, error already reported
    fn_ptr()
}

fn mutual_recursion() -> impl Sync {
    //~^ ERROR
    mutual_recursion_b()
}

fn mutual_recursion_b() -> impl Sized {
    //~^ ERROR
    mutual_recursion()
}

fn main() {}

Meta

rustc --version --verbose:

rustc 1.83.0-nightly (94885bc69 2024-09-01)
binary: rustc
commit-hash: 94885bc699512cfee8560e73c2a01ee6b4b76563
commit-date: 2024-09-01
host: x86_64-unknown-linux-gnu
release: 1.83.0-nightly
LLVM version: 19.1.0

Error output

error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found reserved keyword `virtual`
  --> /home/matthias/vcs/github/fuzz_input/fuzzcorpus/inactive/purgatory-x-impl_type_alias_104551/33b1504231498ba3eb4e991aa6e484d728c66cd5.rs:77:11
   |
77 |         x virtual ;
   |           ^^^^^^^ expected one of 8 possible tokens

error[E0557]: feature has been removed
 --> /home/matthias/vcs/github/fuzz_input/fuzzcorpus/inactive/purgatory-x-impl_type_alias_104551/33b1504231498ba3eb4e991aa6e484d728c66cd5.rs:4:12
  |
4 | #![feature(generators)]
  |            ^^^^^^^^^^ feature has been removed
  |
  = note: renamed to `coroutines`

error[E0423]: expected value, found trait `Sized`
 --> /home/matthias/vcs/github/fuzz_input/fuzzcorpus/inactive/purgatory-x-impl_type_alias_104551/33b1504231498ba3eb4e991aa6e484d728c66cd5.rs:9:62
  |
9 |     if generator_sig() < 0 { None } else { Sized((option(i - Sized), i)) }
  |                                                              ^^^^^ not a value

error[E0425]: cannot find value `i` in this scope
  --> /home/matthias/vcs/github/fuzz_input/fuzzcorpus/inactive/purgatory-x-impl_type_alias_104551/33b1504231498ba3eb4e991aa6e484d728c66cd5.rs:55:8
   |
55 |     || i
   |        ^ not found in this scope

error[E0404]: expected trait, found builtin type `i32`
  --> /home/matthias/vcs/github/fuzz_input/fuzzcorpus/inactive/purgatory-x-impl_type_alias_104551/33b1504231498ba3eb4e991aa6e484d728c66cd5.rs:58:32
   |
58 | fn generator_capture() -> impl i32 {
   |                                ^^^ not a trait

error[E0404]: expected trait, found function `generator_capture`
  --> /home/matthias/vcs/github/fuzz_input/fuzzcorpus/inactive/purgatory-x-impl_type_alias_104551/33b1504231498ba3eb4e991aa6e484d728c66cd5.rs:72:29
   |
72 | fn generator_hold() -> impl generator_capture {
   |                             ^^^^^^^^^^^^^^^^^ not a trait

error[E0658]: yield syntax is experimental
  --> /home/matthias/vcs/github/fuzz_input/fuzzcorpus/inactive/purgatory-x-impl_type_alias_104551/33b1504231498ba3eb4e991aa6e484d728c66cd5.rs:62:9
   |
62 |         yield;
   |         ^^^^^
   |
   = note: see issue #43122 <https://github.com/rust-lang/rust/issues/43122> for more information
   = help: add `#![feature(coroutines)]` to the crate attributes to enable
   = note: this compiler was built on 2024-09-02; consider upgrading it if it is out of date

error[E0658]: yield syntax is experimental
  --> /home/matthias/vcs/github/fuzz_input/fuzzcorpus/inactive/purgatory-x-impl_type_alias_104551/33b1504231498ba3eb4e991aa6e484d728c66cd5.rs:76:9
   |
76 |         yield;
   |         ^^^^^
   |
   = note: see issue #43122 <https://github.com/rust-lang/rust/issues/43122> for more information
   = help: add `#![feature(coroutines)]` to the crate attributes to enable
   = note: this compiler was built on 2024-09-02; consider upgrading it if it is out of date

error[E0562]: `impl Trait` is not allowed in cast expression types
  --> /home/matthias/vcs/github/fuzz_input/fuzzcorpus/inactive/purgatory-x-impl_type_alias_104551/33b1504231498ba3eb4e991aa6e484d728c66cd5.rs:24:22
   |
24 |     &ptr() as *const impl Sized
   |                      ^^^^^^^^^^
   |
   = note: `impl Trait` is only allowed in arguments and return types of functions and methods

error[E0658]: yield syntax is experimental
  --> /home/matthias/vcs/github/fuzz_input/fuzzcorpus/inactive/purgatory-x-impl_type_alias_104551/33b1504231498ba3eb4e991aa6e484d728c66cd5.rs:62:9
   |
62 |         yield;
   |         ^^^^^
   |
   = note: see issue #43122 <https://github.com/rust-lang/rust/issues/43122> for more information
   = help: add `#![feature(coroutines)]` to the crate attributes to enable
   = note: this compiler was built on 2024-09-02; consider upgrading it if it is out of date

error: `yield` can only be used in `#[coroutine]` closures, or `gen` blocks
  --> /home/matthias/vcs/github/fuzz_input/fuzzcorpus/inactive/purgatory-x-impl_type_alias_104551/33b1504231498ba3eb4e991aa6e484d728c66cd5.rs:62:9
   |
62 |         yield;
   |         ^^^^^
   |
help: use `#[coroutine]` to make this closure a coroutine
   |
61 |     #[coroutine] move || {
   |     ++++++++++++

error[E0658]: yield syntax is experimental
  --> /home/matthias/vcs/github/fuzz_input/fuzzcorpus/inactive/purgatory-x-impl_type_alias_104551/33b1504231498ba3eb4e991aa6e484d728c66cd5.rs:76:9
   |
76 |         yield;
   |         ^^^^^
   |
   = note: see issue #43122 <https://github.com/rust-lang/rust/issues/43122> for more information
   = help: add `#![feature(coroutines)]` to the crate attributes to enable
   = note: this compiler was built on 2024-09-02; consider upgrading it if it is out of date

error: `yield` can only be used in `#[coroutine]` closures, or `gen` blocks
  --> /home/matthias/vcs/github/fuzz_input/fuzzcorpus/inactive/purgatory-x-impl_type_alias_104551/33b1504231498ba3eb4e991aa6e484d728c66cd5.rs:76:9
   |
76 |         yield;
   |         ^^^^^
   |
help: use `#[coroutine]` to make this closure a coroutine
   |
74 |     #[coroutine] move || {
   |     ++++++++++++

error[E0720]: cannot resolve opaque type
  --> /home/matthias/vcs/github/fuzz_input/fuzzcorpus/inactive/purgatory-x-impl_type_alias_104551/33b1504231498ba3eb4e991aa6e484d728c66cd5.rs:27:16
   |
27 | fn fn_ptr() -> impl Sized {
   |                ^^^^^^^^^^ recursive opaque type
28 |     //~^ ERROR
29 |     fn_ptr as fn() -> _
   |     ------------------- returning here with type `fn() -> impl Sized`

error[E0720]: cannot resolve opaque type
  --> /home/matthias/vcs/github/fuzz_input/fuzzcorpus/inactive/purgatory-x-impl_type_alias_104551/33b1504231498ba3eb4e991aa6e484d728c66cd5.rs:12:15
   |
12 | fn tuple() -> impl Sized {
   |               ^^^^^^^^^^ recursive opaque type
13 |     //~^ ERROR
14 |     (tuple(),)
   |     ---------- returning here with type `(impl Sized,)`

error[E0720]: cannot resolve opaque type
  --> /home/matthias/vcs/github/fuzz_input/fuzzcorpus/inactive/purgatory-x-impl_type_alias_104551/33b1504231498ba3eb4e991aa6e484d728c66cd5.rs:40:29
   |
40 |   fn closure_ref_capture() -> impl Sized {
   |                               ^^^^^^^^^^ recursive opaque type
...
43 | /     move || {
44 | |         &x;
   | |          - closure captures itself here
45 | |     }
   | |_____- returning here with type `{closure@/home/matthias/vcs/github/fuzz_input/fuzzcorpus/inactive/purgatory-x-impl_type_alias_104551/33b1504231498ba3eb4e991aa6e484d728c66cd5.rs:43:5: 43:12}`

error[E0720]: cannot resolve opaque type
  --> /home/matthias/vcs/github/fuzz_input/fuzzcorpus/inactive/purgatory-x-impl_type_alias_104551/33b1504231498ba3eb4e991aa6e484d728c66cd5.rs:67:35
   |
67 | fn substs_change<T: 'static>() -> impl Sized {
   |                                   ^^^^^^^^^^ recursive opaque type
68 |     //~^ ERROR
69 |     (substs_change::<&T>(),)
   |     ------------------------ returning here with type `(impl Sized,)`

error[E0369]: binary operation `<` cannot be applied to type `impl Sized`
 --> /home/matthias/vcs/github/fuzz_input/fuzzcorpus/inactive/purgatory-x-impl_type_alias_104551/33b1504231498ba3eb4e991aa6e484d728c66cd5.rs:9:24
  |
9 |     if generator_sig() < 0 { None } else { Sized((option(i - Sized), i)) }
  |        --------------- ^ - {integer}
  |        |
  |        impl Sized

error[E0720]: cannot resolve opaque type
  --> /home/matthias/vcs/github/fuzz_input/fuzzcorpus/inactive/purgatory-x-impl_type_alias_104551/33b1504231498ba3eb4e991aa6e484d728c66cd5.rs:32:25
   |
32 |   fn closure_capture() -> impl Sized {
   |                           ^^^^^^^^^^ recursive opaque type
...
35 | /     move || {
36 | |         x;
   | |         - closure captures itself here
37 | |     }
   | |_____- returning here with type `{closure@/home/matthias/vcs/github/fuzz_input/fuzzcorpus/inactive/purgatory-x-impl_type_alias_104551/33b1504231498ba3eb4e991aa6e484d728c66cd5.rs:35:5: 35:12}`

error[E0720]: cannot resolve opaque type
  --> /home/matthias/vcs/github/fuzz_input/fuzzcorpus/inactive/purgatory-x-impl_type_alias_104551/33b1504231498ba3eb4e991aa6e484d728c66cd5.rs:86:26
   |
86 | fn mutual_recursion() -> impl Sync {
   |                          ^^^^^^^^^ recursive opaque type
87 |     //~^ ERROR
88 |     mutual_recursion_b()
   |     -------------------- returning here with type `impl Sized`
...
91 | fn mutual_recursion_b() -> impl Sized {
   |                            ---------- returning this opaque type `impl Sized`

error[E0423]: expected function, tuple struct or tuple variant, found trait `Sized`
 --> /home/matthias/vcs/github/fuzz_input/fuzzcorpus/inactive/purgatory-x-impl_type_alias_104551/33b1504231498ba3eb4e991aa6e484d728c66cd5.rs:9:44
  |
9 |     if generator_sig() < 0 { None } else { Sized((option(i - Sized), i)) }
  |                                            ^^^^^ not a function, tuple struct or tuple variant

error[E0720]: cannot resolve opaque type
  --> /home/matthias/vcs/github/fuzz_input/fuzzcorpus/inactive/purgatory-x-impl_type_alias_104551/33b1504231498ba3eb4e991aa6e484d728c66cd5.rs:91:28
   |
86 | fn mutual_recursion() -> impl Sync {
   |                          --------- returning this opaque type `impl Sync`
...
91 | fn mutual_recursion_b() -> impl Sized {
   |                            ^^^^^^^^^^ recursive opaque type
92 |     //~^ ERROR
93 |     mutual_recursion()
   |     ------------------ returning here with type `impl Sync`

error[E0121]: the placeholder `_` is not allowed within types on item signatures for return types
  --> /home/matthias/vcs/github/fuzz_input/fuzzcorpus/inactive/purgatory-x-impl_type_alias_104551/33b1504231498ba3eb4e991aa6e484d728c66cd5.rs:48:21
   |
48 | fn closure_sig() -> _ {
   |                     ^ not allowed in type signatures
@matthiaskrgr matthiaskrgr added I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. C-bug Category: This is a bug. A-parallel-compiler Area: parallel compiler labels Sep 2, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Sep 2, 2024
@matthiaskrgr
Copy link
Member Author

Backtrace

thread 'rustc query cycle handler' panicked at compiler/rustc_query_system/src/query/job.rs:535:9:
deadlock detected as we're unable to find a query cycle to break
current query map:
{
    QueryJobId(
        9504,
    ): QueryJobInfo {
        query: QueryStackFrame {
            description: "type-checking `ptr`",
            span: Some(
                Span {
                    lo: BytePos(
                        421,
                    ),
                    hi: BytePos(
                        434,
                    ),
                    ctxt: #0,
                },
            ),
            def_id: Some(
                DefId(0:8),
            ),
            def_kind: Some(
                Fn,
            ),
            ty_def_id: None,
            dep_kind: DepKind {
                variant: 112,
            },
            hash: 11651504159124012526,
        },
        job: QueryJob {
            id: QueryJobId(
                9504,
            ),
            span: Span {
                lo: BytePos(
                    0,
                ),
                hi: BytePos(
                    0,
                ),
                ctxt: #0,
            },
            parent: Some(
                QueryJobId(
                    9503,
                ),
            ),
            latch: None,
        },
    },
    QueryJobId(
        9597,
    ): QueryJobInfo {
        query: QueryStackFrame {
            description: "checking that `closure_sig` is well-formed",
            span: Some(
                Span {
                    lo: BytePos(
                        800,
                    ),
                    hi: BytePos(
                        821,
                    ),
                    ctxt: #0,
                },
            ),
            def_id: Some(
                DefId(0:18),
            ),
            def_kind: Some(
                Fn,
            ),
            ty_def_id: None,
            dep_kind: DepKind {
                variant: 199,
            },
            hash: 11075076046781938640,
        },
        job: QueryJob {
            id: QueryJobId(
                9597,
            ),
            span: Span {
                lo: BytePos(
                    0,
                ),
                hi: BytePos(
                    0,
                ),
                ctxt: #0,
            },
            parent: Some(
                QueryJobId(
                    9493,
                ),
            ),
            latch: None,
        },
    },
    QueryJobId(
        9610,
    ): QueryJobInfo {
        query: QueryStackFrame {
            description: "type-checking `closure_sig`",
            span: Some(
                Span {
                    lo: BytePos(
                        800,
                    ),
                    hi: BytePos(
                        821,
                    ),
                    ctxt: #0,
                },
            ),
            def_id: Some(
                DefId(0:18),
            ),
            def_kind: Some(
                Fn,
            ),
            ty_def_id: None,
            dep_kind: DepKind {
                variant: 112,
            },
            hash: 18204575851403231095,
        },
        job: QueryJob {
            id: QueryJobId(
                9610,
            ),
            span: Span {
                lo: BytePos(
                    0,
                ),
                hi: BytePos(
                    0,
                ),
                ctxt: #0,
            },
            parent: Some(
                QueryJobId(
                    9609,
                ),
            ),
            latch: None,
        },
    },
    QueryJobId(
        10119,
    ): QueryJobInfo {
        query: QueryStackFrame {
            description: "checking that `array` is well-formed",
            span: Some(
                Span {
                    lo: BytePos(
                        371,
                    ),
                    hi: BytePos(
                        386,
                    ),
                    ctxt: #0,
                },
            ),
            def_id: Some(
                DefId(0:7),
            ),
            def_kind: Some(
                Fn,
            ),
            ty_def_id: None,
            dep_kind: DepKind {
                variant: 199,
            },
            hash: 16489098153851727744,
        },
        job: QueryJob {
            id: QueryJobId(
                10119,
            ),
            span: Span {
                lo: BytePos(
                    0,
                ),
                hi: BytePos(
                    0,
                ),
                ctxt: #0,
            },
            parent: Some(
                QueryJobId(
                    9493,
                ),
            ),
            latch: None,
        },
    },
    QueryJobId(
        10126,
    ): QueryJobInfo {
        query: QueryStackFrame {
            description: "computing function signature of `array`",
            span: Some(
                Span {
                    lo: BytePos(
                        371,
                    ),
                    hi: BytePos(
                        386,
                    ),
                    ctxt: #0,
                },
            ),
            def_id: Some(
                DefId(0:7),
            ),
            def_kind: Some(
                Fn,
            ),
            ty_def_id: None,
            dep_kind: DepKind {
                variant: 98,
            },
            hash: 10059093386988276792,
        },
        job: QueryJob {
            id: QueryJobId(
                10126,
            ),
            span: Span {
                lo: BytePos(
                    0,
                ),
                hi: BytePos(
                    0,
                ),
                ctxt: #0,
            },
            parent: Some(
                QueryJobId(
                    10119,
                ),
            ),
            latch: Some(
                QueryLatch {
                    info: Mutex {
                        data: QueryLatchInfo {
                            complete: false,
                            waiters: [],
                        },
                    },
                },
            ),
        },
    },
    QueryJobId(
        9493,
    ): QueryJobInfo {
        query: QueryStackFrame {
            description: "checking that types are well-formed in top-level module",
            span: Some(
                Span {
                    lo: BytePos(
                        98,
                    ),
                    hi: BytePos(
                        1533,
                    ),
                    ctxt: #0,
                },
            ),
            def_id: Some(
                DefId(0:0),
            ),
            def_kind: Some(
                Mod,
            ),
            ty_def_id: None,
            dep_kind: DepKind {
                variant: 110,
            },
            hash: 18152105939214545336,
        },
        job: QueryJob {
            id: QueryJobId(
                9493,
            ),
            span: Span {
                lo: BytePos(
                    0,
                ),
                hi: BytePos(
                    0,
                ),
                ctxt: #0,
            },
            parent: Some(
                QueryJobId(
                    9267,
                ),
            ),
            latch: None,
        },
    },
    QueryJobId(
        9503,
    ): QueryJobInfo {
        query: QueryStackFrame {
            description: "computing function signature of `ptr`",
            span: Some(
                Span {
                    lo: BytePos(
                        421,
                    ),
                    hi: BytePos(
                        434,
                    ),
                    ctxt: #0,
                },
            ),
            def_id: Some(
                DefId(0:8),
            ),
            def_kind: Some(
                Fn,
            ),
            ty_def_id: None,
            dep_kind: DepKind {
                variant: 98,
            },
            hash: 6185555293333606712,
        },
        job: QueryJob {
            id: QueryJobId(
                9503,
            ),
            span: Span {
                lo: BytePos(
                    0,
                ),
                hi: BytePos(
                    0,
                ),
                ctxt: #0,
            },
            parent: Some(
                QueryJobId(
                    9494,
                ),
            ),
            latch: Some(
                QueryLatch {
                    info: Mutex {
                        data: QueryLatchInfo {
                            complete: false,
                            waiters: [],
                        },
                    },
                },
            ),
        },
    },
    QueryJobId(
        10127,
    ): QueryJobInfo {
        query: QueryStackFrame {
            description: "type-checking `array`",
            span: Some(
                Span {
                    lo: BytePos(
                        371,
                    ),
                    hi: BytePos(
                        386,
                    ),
                    ctxt: #0,
                },
            ),
            def_id: Some(
                DefId(0:7),
            ),
            def_kind: Some(
                Fn,
            ),
            ty_def_id: None,
            dep_kind: DepKind {
                variant: 112,
            },
            hash: 7590287379614927217,
        },
        job: QueryJob {
            id: QueryJobId(
                10127,
            ),
            span: Span {
                lo: BytePos(
                    0,
                ),
                hi: BytePos(
                    0,
                ),
                ctxt: #0,
            },
            parent: Some(
                QueryJobId(
                    10126,
                ),
            ),
            latch: None,
        },
    },
    QueryJobId(
        9609,
    ): QueryJobInfo {
        query: QueryStackFrame {
            description: "computing function signature of `closure_sig`",
            span: Some(
                Span {
                    lo: BytePos(
                        800,
                    ),
                    hi: BytePos(
                        821,
                    ),
                    ctxt: #0,
                },
            ),
            def_id: Some(
                DefId(0:18),
            ),
            def_kind: Some(
                Fn,
            ),
            ty_def_id: None,
            dep_kind: DepKind {
                variant: 98,
            },
            hash: 13742418840351289062,
        },
        job: QueryJob {
            id: QueryJobId(
                9609,
            ),
            span: Span {
                lo: BytePos(
                    0,
                ),
                hi: BytePos(
                    0,
                ),
                ctxt: #0,
            },
            parent: Some(
                QueryJobId(
                    9597,
                ),
            ),
            latch: Some(
                QueryLatch {
                    info: Mutex {
                        data: QueryLatchInfo {
                            complete: true,
                            waiters: [],
                        },
                    },
                },
            ),
        },
    },
    QueryJobId(
        9494,
    ): QueryJobInfo {
        query: QueryStackFrame {
            description: "checking that `ptr` is well-formed",
            span: Some(
                Span {
                    lo: BytePos(
                        421,
                    ),
                    hi: BytePos(
                        434,
                    ),
                    ctxt: #0,
                },
            ),
            def_id: Some(
                DefId(0:8),
            ),
            def_kind: Some(
                Fn,
            ),
            ty_def_id: None,
            dep_kind: DepKind {
                variant: 199,
            },
            hash: 13638682658483624016,
        },
        job: QueryJob {
            id: QueryJobId(
                9494,
            ),
            span: Span {
                lo: BytePos(
                    0,
                ),
                hi: BytePos(
                    0,
                ),
                ctxt: #0,
            },
            parent: Some(
                QueryJobId(
                    9493,
                ),
            ),
            latch: None,
        },
    },
    QueryJobId(
        9267,
    ): QueryJobInfo {
        query: QueryStackFrame {
            description: "running analysis passes on this crate",
            span: Some(
                Span {
                    lo: BytePos(
                        0,
                    ),
                    hi: BytePos(
                        0,
                    ),
                    ctxt: #0,
                },
            ),
            def_id: None,
            def_kind: None,
            ty_def_id: None,
            dep_kind: DepKind {
                variant: 25,
            },
            hash: 5462938028500440564,
        },
        job: QueryJob {
            id: QueryJobId(
                9267,
            ),
            span: Span {
                lo: BytePos(
                    0,
                ),
                hi: BytePos(
                    0,
                ),
                ctxt: #0,
            },
            parent: None,
            latch: None,
        },
    },
}
stack backtrace:
   0:     0x7f7006dd729a - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::hfc0aee4a4221f096
   1:     0x7f7007603317 - core::fmt::write::h655d4eadfdb8502a
   2:     0x7f700888f951 - std::io::Write::write_fmt::h2ea0d082230e5925
   3:     0x7f7006dd70f2 - std::sys::backtrace::BacktraceLock::print::h555af74c3fa97861
   4:     0x7f7006dd9611 - std::panicking::default_hook::{{closure}}::h32dd0e51fb8a1c14
   5:     0x7f7006dd9444 - std::panicking::default_hook::he779bc9edc472a77
   6:     0x7f7005f3fdaf - std[63c7f4189113d68b]::panicking::update_hook::<alloc[9af95e251f161f13]::boxed::Box<rustc_driver_impl[6dfec13e581e6fc4]::install_ice_hook::{closure#0}>>::{closure#0}
   7:     0x7f7006dd9d38 - std::panicking::rust_panic_with_hook::hec7edd9f676c76e4
   8:     0x7f7006dd9b07 - std::panicking::begin_panic_handler::{{closure}}::h43f780043993528c
   9:     0x7f7006dd7749 - std::sys::backtrace::__rust_end_short_backtrace::h0b7ce6c7faed17fc
  10:     0x7f7006dd97d4 - rust_begin_unwind
  11:     0x7f7003c99273 - core::panicking::panic_fmt::ha6a3dabea814cefc
  12:     0x7f700697177a - rustc_query_system[26a2ce1bdac1a5fd]::query::job::break_query_cycles
  13:     0x7f7005f3710a - std[63c7f4189113d68b]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[63329f6f0d786be0]::util::run_in_thread_pool_with_globals<rustc_interface[63329f6f0d786be0]::interface::run_compiler<core[a8c4229f0667717c]::result::Result<(), rustc_span[45af8eb5a0447248]::ErrorGuaranteed>, rustc_driver_impl[6dfec13e581e6fc4]::run_compiler::{closure#0}>::{closure#1}, core[a8c4229f0667717c]::result::Result<(), rustc_span[45af8eb5a0447248]::ErrorGuaranteed>>::{closure#2}::{closure#1}, ()>
  14:     0x7f7005f41f1c - <<std[63c7f4189113d68b]::thread::Builder>::spawn_unchecked_<rustc_interface[63329f6f0d786be0]::util::run_in_thread_pool_with_globals<rustc_interface[63329f6f0d786be0]::interface::run_compiler<core[a8c4229f0667717c]::result::Result<(), rustc_span[45af8eb5a0447248]::ErrorGuaranteed>, rustc_driver_impl[6dfec13e581e6fc4]::run_compiler::{closure#0}>::{closure#1}, core[a8c4229f0667717c]::result::Result<(), rustc_span[45af8eb5a0447248]::ErrorGuaranteed>>::{closure#2}::{closure#1}, ()>::{closure#1} as core[a8c4229f0667717c]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  15:     0x7f70084888ab - std::sys::pal::unix::thread::Thread::new::thread_start::h7743ab69b2bb6790
  16:     0x7f7009a8239d - <unknown>
  17:     0x7f7009b0749c - <unknown>
  18:                0x0 - <unknown>

error: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: please make sure that you have updated to the latest nightly

note: rustc 1.83.0-nightly (a4601859a 2024-09-02) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z dump-mir-dir=/tmp/icemaker_global_tempdir.Yy4k6YWiomMm/rustc_testrunner_tmpdir.tq4vky7rztOO -Z mir-opt-level=5 -Z validate-mir -Z lint-mir -C debuginfo=2 -C link-dead-code=true -Z threads=16 -Z write-long-types-to-disk=no

query stack during panic:
end of query stack
query cycle handler thread panicked, aborting process

@lolbinarycat lolbinarycat added I-hang Issue: The compiler never terminates, due to infinite loops, deadlock, livelock, etc. I-cycle Issue: A query cycle occurred while none was expected E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example F-coroutines `#![feature(coroutines)]` and removed I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ I-hang Issue: The compiler never terminates, due to infinite loops, deadlock, livelock, etc. needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Sep 2, 2024
@matthiaskrgr matthiaskrgr added the I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ label Sep 3, 2024
jieyouxu added a commit to jieyouxu/rust that referenced this issue Mar 5, 2025
Resume one waiter at once in deadlock handler

When multiple query loop errors occur in the code, only one waiter should be resumed at a time to avoid waking up multiple waiters at the same time and causing deadlock due to thread grabbing.

This fixes the UI failures in rust-lang#132051

cc `@Zoxc` `@cjgillot` `@nnethercote` `@bjorn3` `@Kobzol`

Zulip discussion [here](https://rust-lang.zulipchat.com/#narrow/channel/187679-t-compiler.2Fwg-parallel-rustc/topic/Deadlocks.20and.20Rayon)

Edit: We can't reproduce these bugs with the existing test suits, so we keep them until we merge rust-lang#132051
UPDATES rust-lang#129912
UPDATES rust-lang#120757
UPDATES rust-lang#129911
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Mar 5, 2025
Rollup merge of rust-lang#137731 - SparrowLii:waiter, r=nnethercote

Resume one waiter at once in deadlock handler

When multiple query loop errors occur in the code, only one waiter should be resumed at a time to avoid waking up multiple waiters at the same time and causing deadlock due to thread grabbing.

This fixes the UI failures in rust-lang#132051

cc `@Zoxc` `@cjgillot` `@nnethercote` `@bjorn3` `@Kobzol`

Zulip discussion [here](https://rust-lang.zulipchat.com/#narrow/channel/187679-t-compiler.2Fwg-parallel-rustc/topic/Deadlocks.20and.20Rayon)

Edit: We can't reproduce these bugs with the existing test suits, so we keep them until we merge rust-lang#132051
UPDATES rust-lang#129912
UPDATES rust-lang#120757
UPDATES rust-lang#129911
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-parallel-compiler Area: parallel compiler C-bug Category: This is a bug. E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example F-coroutines `#![feature(coroutines)]` I-cycle Issue: A query cycle occurred while none was expected I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

3 participants