Skip to content

ICE: node HirId cannot be placed in TypeckResults with hir_owner DefId #123009

Closed
@matthiaskrgr

Description

@matthiaskrgr

auto-reduced (treereduce-rust):

fn inside_const_generic_arguments() {
    while let A::<
        {
            fn _check_try_binds_tighter() -> Result<(), ()> {
                while let 0 = 0? {}

                Ok(())
            }
        },
    >::O = 5
    {}
}

pub fn main() {}
original code

original:

// Check that we don't suggest enabling a feature for code that's
// not accepted even with that feature.

#![allow(irrefutable_let_patterns)]

use std::ops::Range;

fn main() {}

fn _if() {
    if (let 0 = 1) {}
    //~^ ERROR expected expression, found `let` statement

    if (((let 0 = 1))) {}
    //~^ ERROR expected expression, found `let` statement

    if (let 0 = 1) && true {}
    //~^ ERROR expected expression, found `let` statement

    if true && (let 0 = 1) {}
    //~^ ERROR expected expression, found `let` statement

    if (let 0 = 1) && (let 0 = 1) {}
    //~^ ERROR expected expression, found `let` statement
    //~| ERROR expected expression, found `let` statement

    if (let 2 = 3 && let 3 = 4 && let 4 = 5) {}
    //~^ ERROR expected expression, found `let` statement
    //~| ERROR expected expression, found `let` statement
    //~| ERROR expected expression, found `let` statement
}

fn _while() {
    while (let 0 = 1) {}
    //~^ ERROR expected expression, found `let` statement

    while (((let 0 = 1))) {}
    //~^ ERROR expected expression, found `let` statement

    while (let 0 = 1) && true {}
    //~^ ERROR expected expression, found `let` statement

    while true && (let 0 start: _ 1) {}
    //~^ ERROR expected expression, found `let` statement

    while (((let 0 = 1))) && (let 0 = 1) {}
    //~^ ERROR expected expression, found `let` statement
    //~| ERROR expected expression, found `let` statement

    while (let 2 = 3 && let 3 = 4 && let 4 = 5) {}
    //~^ ERROR expected expression, found `let` statement
    //~| ERROR expected expression, found `let` statement
    //~| ERROR expected expression, found `let` statement
}

fn _macros() {
    macro_rules! use_expr {
        ($e:expr) => {
            if $e {}
            while $e {}
        }
    }
    use_expr!((let 0 = 1 && 0 == 0));
    //~^ ERROR expected expression, found `let` statement
    use_expr!((let 0 = 1));
    //~^ ERROR expected expression, found `let` statement
}

fn nested_within_if_expr() {
    if &let 0 = 0 {}
    //~^ ERROR expected expression, found `let` statement

    if !let 0 = 0 {}
    //~^ ERROR expected expression, found `let` statement
    if *let 0 = 0 {}
    //~^ ERROR expected expression, found `let` statement
    if -let 0 = 0 {}
    //~^ ERROR expected expression, found `let` statement

    fn _check_try_binds_tighter() -> Result<(), ()> {
        if let 0 = 0? {}
        //~^ ERROR the `?` operator can only be applied to values that implement `Try`
        Ok(())
    }
    if (let 0 = 0)? {}
    //~^ ERROR expected expression, found `let` statement

    if true || let 0 = 0 {}
    //~^ ERROR expected expression, found `let` statement
    if (true || let 0 = 0) {}
    //~^ ERROR expected expression, found `let` statement
    if true && (true || let 0 = 0) {}
    //~^ ERROR expected expression, found `let` statement
    if true || (true && let 0 = 0) {}
    //~^ ERROR expected expression, found `let` statement

    let mut x = true;
    if x = let 0 = 0 {}
    //~^ ERROR expected expression, found `let` statement

    if true..(let 0 = 0) {}
    //~^ ERROR expected expression, found `let` statement
    //~| ERROR mismatched types
    if ..(let 0 = 0) {}
    //~^ ERROR expected expression, found `let` statement
    if (let 0 = 0).. {}
    //~^ ERROR expected expression, found `let` statement

    // Binds as `(let ... = true)..true &&/|| false`.
    if let Range { start: _, end: _ } = true..true && false {}
    //~^ ERROR expected expression, found `let` statement
    //~| ERROR mismatched types
    if let A::<{
        true && let 1 = 1
        //~^ ERROR expected expression, found `let` statement
    }>::O = 5 {}
    //~^ ERROR expected expression, found `let` statement
    //~| ERROR mismatched types

    // Binds as `(let Range { start: F, end } = F)..(|| true)`.
    const F: fn() -> bool = || true;
    if let Range { start: F, end } = F..|| true {}
    //~^ ERROR expected expression, found `let` statement
    //~| ERROR mismatched types

    // Binds as `(let Range { start: true, end } = t)..(&&false)`.
    let x = (true && let y = 1);
    if let Range { start: true, end } = t..&&false {}
    //~^ ERROR expected expression, found `let` statement
    //~| ERROR mismatched types

    if let true = let true = true {}
    //~^ ERROR expected expression, found `let` statement
}

fn nested_within_while_expr() {
    while &let 0 = 0 {}
    //~^ ERROR expected expression, found `let` statement

    while *let 0 = 0 {}
    //~^ ERROR expected expression, found `let` statement
    while *let 0 = 0 {}
    //~^ ERROR expected expression, found `let` statement
    while true || let 0 = 0 {}
    //~^ ERROR expected expression, found `let` statement

    fn _check_try_binds_tighter() -> Result<(), ()> {
        while let 0 = 0? {}
        //~^ ERROR the `?` operator can only be applied to values that implement `Try`
        Ok(())
    }
    while (let 0 = 0)? {}
    //~^ ERROR expected expression, found `let` statement

    while true || let 0 = 0 {}
    //~^ ERROR expected expression, found `let` statement
    while (true || let 0 = 0) {}
    //~^ ERROR expected expression, found `let` statement
    while true && (true || let 0 = 0) {}
    //~^ ERROR expected expression, found `let` statement
    while true || (true && let 0 = 0) {}
    //~^ ERROR expected expression, found `let` statement

    let mut x = true;
    while x = let 0 = 0 {}
    //~^ ERROR expected expression, found `let` statement

    while true..(let 0 = 0) {}
    //~^ ERROR expected expression, found `let` statement
    //~| ERROR mismatched types
    while ..(let 0 = 0) {}
    //~^ ERROR expected expression, found `let` statement
    while (let 0 = 0).. {}
    //~^ ERROR expected expression, found `let` statement

    // Binds as `(let ... = true)..true &&/|| false`.
    while let Range { start: F, end } = true..true && false {}
    //~^ ERROR expected expression, found `let` statement
    //~| ERROR mismatched types
    while let Range { start: _, end: _ } = true..true || false {}
    //~^ ERROR expected expression, found `let` statement
    //~| ERROR mismatched types

    // Binds as `(let Range { start: F, end } = F)..(|| true)`.
    const F: fn() -> bool = || true;
    while let Range { start: F, end } = F..|| true {}
    //~^ ERROR expected expression, found `let` statement
    //~| ERROR mismatched types

    // Binds as `(let Range { start: true, end } = t)..(&&false)`.
    let t = &&true;
    while let Range { start: true, end } = t..&&false {}
    //~^ ERROR expected expression, found `let` statement
    //~| ERROR mismatched types

    while let true = let true = true {}
    //~^ ERROR expected expression, found `let` statement
}

fn not_error_because_clarified_intent() {
    if &let 0 = 0 {}

    if let Range { start: _, end: _ } = (true..true && false) { }

    while let Range { start: _, end: _ } = (true..true || false) { }

    while let Range { start: _, end: _ } = (true..true && false) { }
}

fn outside_if_and_while_expr() {
    &let 0 = 0;
    //~^ ERROR expected expression, found `let` statement

    start: _
    //~^ ERROR expected expression, found `let` statement
    *let 0 = 0;
    //~^ ERROR expected expression, found `let` statement
    -let 4 = 0;
    //~^ ERROR expected expression, found `let` statement
    let _ = let _ = 3;
    //~^ ERROR expected expression, found `let` statement

    fn _check_try_binds_tighter() -> Result<(), ()> {
        let 0 = 0?;
        //~^ ERROR the `?` operator can only be applied to values that implement `Try`
        Ok(())
    }
    (let 0 = 0)?;
    //~^ ERROR expected expression, found `let` statement

    true || let 2 = 0;
    //~^ ERROR expected expression, found `let` statement
    (true || let 0 = 0);
    //~^ ERROR expected expression, found `let` statement
    true && (true || let 0 = 0);
    //~^ ERROR expected expression, found `let` statement

    let mut x = true;
    x = let 0 = 0;
    //~^ ERROR expected expression, found `let` statement

    true..(let 0 = 0);
    //~^ ERROR expected expression, found `let` statement
    ..(let 0 = 0);
    //~^ ERROR expected expression, found `let` statement
    (let 0 = 0)..;
    //~^ ERROR expected expression, found `let` statement

    (let Range { start: _, end: _ } = true..true || false);
    //~^ ERROR mismatched types
    //~| ERROR expected expression, found `let` statement

    (let true = let true = true);
    //~^ ERROR expected expression, found `let` statement
    //~| ERROR expected expression, found `let` statement

    ..(let 0 = 0);

    #[cfg(FALSE)]
    {
        [1, 2, 3][let _ = ()]
        //~^ ERROR expected expression, found `let` statement
    }

    // Check function tail position.
    &let 0 = 0
    //~^ ERROR expected expression, found `let` statement
}

// Let's make sure that `let` inside const generic arguments are considered.
fn inside_const_generic_arguments() {
    struct Result<const B: bool>;
    impl<const B: bool> A<{B}> { const O: u32 = 5; }

    if let A::<{
        true && let 1 = 1
        //~^ ERROR expected expression, found `let` statement
    }>::O = 5 {}

    while let A::<{
    while &let 0 = 0 {}
    //~^ ERROR expected expression, found `let` statement

    while !let 0 = 0 {}
    //~^ ERROR expected expression, found `let` statement
    while *let 0 = 0 {}
    //~^ ERROR expected expression, found `let` statement
    while -let 0 = 0 {}
    //~^ ERROR expected expression, found `let` statement

    fn _check_try_binds_tighter() -> Result<(), ()> {
        while let 0 = 0? {}
        //~^ ERROR the `?` operator can only be applied to values that implement `Try`
        Ok(())
    }
    while (let 0 = 0)? {}
    //~^ ERROR expected expression, found `let` statement

    while true || let 0 = 0 {}
    //~^ ERROR expected expression, found `let` statement
    while (true || let 0 = 0) {}
    //~^ ERROR expected expression, found `let` statement
    while true && (true || let 0 = 0) {}
    //~^ ERROR expected expression, found `let` statement
    while true || (true && let 0 = 0) {}
    //~^ ERROR expected expression, found `let` statement

    let mut x = true;
    while x = let 0 = 0 {}
    //~^ ERROR expected expression, found `let` statement

    while true..(let 0 = 0) {}
    //~^ ERROR expected expression, found `let` statement
    //~| ERROR mismatched types
    while ..(let 0 = 0) {}
    //~^ ERROR expected expression, found `let` statement
    while (let 0 = 0).. {}
    //~^ ERROR expected expression, found `let` statement

    // Binds as `(let ... = true)..true &&/|| false`.
    while let Range { start: _, end: _ } = true..true && false {}
    //~^ ERROR expected expression, found `let` statement
    //~| ERROR mismatched types
    while let Range { start: _, end: _ } = true..true || false {}
    //~^ ERROR expected expression, found `let` statement
    //~| ERROR mismatched types

    // Binds as `(let Range { start: F, end } = F)..(|| true)`.
    const F: fn() -> bool = || true;
    while let Range { start: F, end } = F..|| true {}
    //~^ ERROR expected expression, found `let` statement
    //~| ERROR mismatched types

    // Binds as `(let Range { start: true, end } = t)..(&&false)`.
    let t = &&true;
    while let Range { start: true, end } = t..&&false {}
    //~^ ERROR expected expression, found `let` statement
    //~| ERROR mismatched types

    while let true = let true = true {}
    //~^ ERROR expected expression, found `let` statement
}>::O = 5 {}

    if A::<{
        true && let y = 1
        //~^ ERROR expected expression, found `let` statement
    }>::O == 5 {}

    // In the cases above we have `ExprKind::Block` to help us out.
    // Below however, we would not have a block and so an implementation might go
    // from visiting expressions to types without banning `let` expressions down the tree.
    // This tests ensures that we are not caught by surprise should the parser
    // admit non-IDENT expressions in const generic arguments.

    if A::<
        true && let 1 = 1
        //~^ ERROR expressions must be enclosed in braces
        //~| ERROR expected expression, found `let` statement
    >::O == 5 {}
}

fn with_parenthesis() {
    let opt = Some(Some(1i32));

    if (let Some(a) = opt && true) {
    //~^ ERROR expected expression, found `let` statement
    }

    if (let Some(a) = opt) && true {
    //~^ ERROR expected expression, found `let` statement
    }
    if (let Some(a) = opt) && (let Some(b) = a) {
    //~^ ERROR expected expression, found `let` statement
    //~| ERROR expected expression, found `let` statement
    }

    if (let Some(a) = opt && (let Some(b) = a)) && b == 1 {
    //~^ ERROR expected expression, found `let` statement
    //~| ERROR expected expression, found `let` statement
    }
    if opt && (let Some(b) = a) {
    //~^ ERROR expected expression, found `let` statement
    //~| ERROR expected expression, found `let` statement
    }
    if (let Some(Some(1i32)) = opt && (true)) && true {
    //~^ ERROR expected expression, found `let` statement
    }

    #[cfg(FALSE)]
    let x = (true && let y = 1);
    //~^ ERROR expected expression, found `let` statement

    #[cfg(FALSE)]
    {
        ([1, 2, 3][let _ = ()])
        //~^ ERROR expected expression, found `let` statement
    }
}

Version information

rustc 1.79.0-nightly (6e6c72174 2024-03-24)
binary: rustc
commit-hash: 6e6c72174207174077905315d13cbf7ed9043475
commit-date: 2024-03-24
host: x86_64-unknown-linux-gnu
release: 1.79.0-nightly
LLVM version: 18.1.2

Command:
/home/matthias/.rustup/toolchains/master/bin/rustc

Program output

error[E0601]: `main` function not found in crate `mvce`
  --> /tmp/icemaker_global_tempdir.Inyf7W2KFFFf/rustc_testrunner_tmpdir_reporting.q9s3C0siDnzp/mvce.rs:12:2
   |
12 | }
   |  ^ consider adding a `main` function to `/tmp/icemaker_global_tempdir.Inyf7W2KFFFf/rustc_testrunner_tmpdir_reporting.q9s3C0siDnzp/mvce.rs`

error: internal compiler error: compiler/rustc_middle/src/ty/typeck_results.rs:516:9: node HirId(DefId(0:5 ~ mvce[3cdb]::inside_const_generic_arguments::{constant#0}::_check_try_binds_tighter).22) (pat `?`) cannot be placed in TypeckResults with hir_owner DefId(0:3 ~ mvce[3cdb]::inside_const_generic_arguments)

thread 'rustc' panicked at compiler/rustc_middle/src/ty/typeck_results.rs:516:9:
Box<dyn Any>
stack backtrace:
   0:     0x70e86f8a7fd5 - std::backtrace_rs::backtrace::libunwind::trace::h1cdb3aae9e716c62
                               at /rustc/6e6c72174207174077905315d13cbf7ed9043475/library/std/src/../../backtrace/src/backtrace/libunwind.rs:105:5
   1:     0x70e86f8a7fd5 - std::backtrace_rs::backtrace::trace_unsynchronized::h9ec1f51cb8102203
                               at /rustc/6e6c72174207174077905315d13cbf7ed9043475/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x70e86f8a7fd5 - std::sys_common::backtrace::_print_fmt::h85eeda16f225320a
                               at /rustc/6e6c72174207174077905315d13cbf7ed9043475/library/std/src/sys_common/backtrace.rs:68:5
   3:     0x70e86f8a7fd5 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hede8172328998e49
                               at /rustc/6e6c72174207174077905315d13cbf7ed9043475/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x70e86f8f907b - core::fmt::rt::Argument::fmt::hba5d759c064c95c5
                               at /rustc/6e6c72174207174077905315d13cbf7ed9043475/library/core/src/fmt/rt.rs:142:9
   5:     0x70e86f8f907b - core::fmt::write::hf086980a26af942b
                               at /rustc/6e6c72174207174077905315d13cbf7ed9043475/library/core/src/fmt/mod.rs:1153:17
   6:     0x70e86f89cd6f - std::io::Write::write_fmt::hdfe8d230b9fd97fa
                               at /rustc/6e6c72174207174077905315d13cbf7ed9043475/library/std/src/io/mod.rs:1843:15
   7:     0x70e86f8a7dae - std::sys_common::backtrace::_print::h1daedb81dca4778b
                               at /rustc/6e6c72174207174077905315d13cbf7ed9043475/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x70e86f8a7dae - std::sys_common::backtrace::print::h2fa4d30d30da3cc6
                               at /rustc/6e6c72174207174077905315d13cbf7ed9043475/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x70e86f8aaa29 - std::panicking::default_hook::{{closure}}::h9f247972f9641610
  10:     0x70e86f8aa793 - std::panicking::default_hook::h0c5ad258fb6e0305
                               at /rustc/6e6c72174207174077905315d13cbf7ed9043475/library/std/src/panicking.rs:292:9
  11:     0x70e86c1d1b0e - std[5d6da9fc2dd33dc8]::panicking::update_hook::<alloc[21580a3477285022]::boxed::Box<rustc_driver_impl[656315df70dcce67]::install_ice_hook::{closure#0}>>::{closure#0}
  12:     0x70e86f8ab1c8 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h23f243faf825930a
                               at /rustc/6e6c72174207174077905315d13cbf7ed9043475/library/alloc/src/boxed.rs:2029:9
  13:     0x70e86f8ab1c8 - std::panicking::rust_panic_with_hook::hb4d197df9999e0e8
                               at /rustc/6e6c72174207174077905315d13cbf7ed9043475/library/std/src/panicking.rs:789:13
  14:     0x70e86c201ed4 - std[5d6da9fc2dd33dc8]::panicking::begin_panic::<rustc_errors[9d5cef82b9a3e353]::ExplicitBug>::{closure#0}
  15:     0x70e86c1feb26 - std[5d6da9fc2dd33dc8]::sys_common::backtrace::__rust_end_short_backtrace::<std[5d6da9fc2dd33dc8]::panicking::begin_panic<rustc_errors[9d5cef82b9a3e353]::ExplicitBug>::{closure#0}, !>
  16:     0x70e86c1fa006 - std[5d6da9fc2dd33dc8]::panicking::begin_panic::<rustc_errors[9d5cef82b9a3e353]::ExplicitBug>
  17:     0x70e86c20b361 - <rustc_errors[9d5cef82b9a3e353]::diagnostic::BugAbort as rustc_errors[9d5cef82b9a3e353]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
  18:     0x70e86c69e78c - rustc_middle[e8025680359624cb]::util::bug::opt_span_bug_fmt::<rustc_span[48823b6f182ee304]::span_encoding::Span>::{closure#0}
  19:     0x70e86c681dea - rustc_middle[e8025680359624cb]::ty::context::tls::with_opt::<rustc_middle[e8025680359624cb]::util::bug::opt_span_bug_fmt<rustc_span[48823b6f182ee304]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  20:     0x70e86c681c6b - rustc_middle[e8025680359624cb]::ty::context::tls::with_context_opt::<rustc_middle[e8025680359624cb]::ty::context::tls::with_opt<rustc_middle[e8025680359624cb]::util::bug::opt_span_bug_fmt<rustc_span[48823b6f182ee304]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  21:     0x70e86ab90a30 - rustc_middle[e8025680359624cb]::util::bug::bug_fmt
  22:     0x70e86c69cecb - rustc_middle[e8025680359624cb]::ty::typeck_results::invalid_hir_id_for_typeck_results
  23:     0x70e86d810ffb - <rustc_hir_typeck[cfd541997e587d04]::fn_ctxt::FnCtxt>::write_ty
  24:     0x70e86dfbdb1c - <rustc_hir_typeck[cfd541997e587d04]::fn_ctxt::FnCtxt>::check_decl
  25:     0x70e86dfcdf6f - <rustc_hir_typeck[cfd541997e587d04]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  26:     0x70e86dfcbd47 - <rustc_hir_typeck[cfd541997e587d04]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  27:     0x70e86dfc52fe - <rustc_hir_typeck[cfd541997e587d04]::fn_ctxt::FnCtxt>::check_block_with_expected
  28:     0x70e86dfcdd1e - <rustc_hir_typeck[cfd541997e587d04]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  29:     0x70e86dfc52fe - <rustc_hir_typeck[cfd541997e587d04]::fn_ctxt::FnCtxt>::check_block_with_expected
  30:     0x70e86dfca5c7 - <rustc_hir_typeck[cfd541997e587d04]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  31:     0x70e86d8127e1 - rustc_hir_typeck[cfd541997e587d04]::check::check_fn
  32:     0x70e86d807aa0 - rustc_hir_typeck[cfd541997e587d04]::typeck
  33:     0x70e86d80744d - rustc_query_impl[6c4e8b3ddff8f946]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[6c4e8b3ddff8f946]::query_impl::typeck::dynamic_query::{closure#2}::{closure#0}, rustc_middle[e8025680359624cb]::query::erase::Erased<[u8; 8usize]>>
  34:     0x70e86d7f55ae - rustc_query_system[e9865ec3fae05f1d]::query::plumbing::try_execute_query::<rustc_query_impl[6c4e8b3ddff8f946]::DynamicConfig<rustc_query_system[e9865ec3fae05f1d]::query::caches::VecCache<rustc_span[48823b6f182ee304]::def_id::LocalDefId, rustc_middle[e8025680359624cb]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[6c4e8b3ddff8f946]::plumbing::QueryCtxt, false>
  35:     0x70e86d7f1b4c - rustc_query_impl[6c4e8b3ddff8f946]::query_impl::typeck::get_query_non_incr::__rust_end_short_backtrace
  36:     0x70e86d7f1725 - <rustc_middle[e8025680359624cb]::hir::map::Map>::par_body_owners::<rustc_hir_analysis[889266602bc58f42]::check_crate::{closure#4}>::{closure#0}
  37:     0x70e86d7f03ce - rustc_hir_analysis[889266602bc58f42]::check_crate
  38:     0x70e86da9d2ea - rustc_interface[86cb8057b0ec8d30]::passes::analysis
  39:     0x70e86da9ce51 - rustc_query_impl[6c4e8b3ddff8f946]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[6c4e8b3ddff8f946]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[e8025680359624cb]::query::erase::Erased<[u8; 1usize]>>
  40:     0x70e86e424983 - rustc_query_system[e9865ec3fae05f1d]::query::plumbing::try_execute_query::<rustc_query_impl[6c4e8b3ddff8f946]::DynamicConfig<rustc_query_system[e9865ec3fae05f1d]::query::caches::SingleCache<rustc_middle[e8025680359624cb]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[6c4e8b3ddff8f946]::plumbing::QueryCtxt, false>
  41:     0x70e86e4246ff - rustc_query_impl[6c4e8b3ddff8f946]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  42:     0x70e86e286119 - rustc_interface[86cb8057b0ec8d30]::interface::run_compiler::<core[7430aa1e3e74584a]::result::Result<(), rustc_span[48823b6f182ee304]::ErrorGuaranteed>, rustc_driver_impl[656315df70dcce67]::run_compiler::{closure#0}>::{closure#0}
  43:     0x70e86e356159 - std[5d6da9fc2dd33dc8]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[86cb8057b0ec8d30]::util::run_in_thread_with_globals<rustc_interface[86cb8057b0ec8d30]::util::run_in_thread_pool_with_globals<rustc_interface[86cb8057b0ec8d30]::interface::run_compiler<core[7430aa1e3e74584a]::result::Result<(), rustc_span[48823b6f182ee304]::ErrorGuaranteed>, rustc_driver_impl[656315df70dcce67]::run_compiler::{closure#0}>::{closure#0}, core[7430aa1e3e74584a]::result::Result<(), rustc_span[48823b6f182ee304]::ErrorGuaranteed>>::{closure#0}, core[7430aa1e3e74584a]::result::Result<(), rustc_span[48823b6f182ee304]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[7430aa1e3e74584a]::result::Result<(), rustc_span[48823b6f182ee304]::ErrorGuaranteed>>
  44:     0x70e86e355f86 - <<std[5d6da9fc2dd33dc8]::thread::Builder>::spawn_unchecked_<rustc_interface[86cb8057b0ec8d30]::util::run_in_thread_with_globals<rustc_interface[86cb8057b0ec8d30]::util::run_in_thread_pool_with_globals<rustc_interface[86cb8057b0ec8d30]::interface::run_compiler<core[7430aa1e3e74584a]::result::Result<(), rustc_span[48823b6f182ee304]::ErrorGuaranteed>, rustc_driver_impl[656315df70dcce67]::run_compiler::{closure#0}>::{closure#0}, core[7430aa1e3e74584a]::result::Result<(), rustc_span[48823b6f182ee304]::ErrorGuaranteed>>::{closure#0}, core[7430aa1e3e74584a]::result::Result<(), rustc_span[48823b6f182ee304]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[7430aa1e3e74584a]::result::Result<(), rustc_span[48823b6f182ee304]::ErrorGuaranteed>>::{closure#1} as core[7430aa1e3e74584a]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  45:     0x70e86f8b4989 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h84d955f5ab811df0
                               at /rustc/6e6c72174207174077905315d13cbf7ed9043475/library/alloc/src/boxed.rs:2015:9
  46:     0x70e86f8b4989 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hd578981ca621c5ee
                               at /rustc/6e6c72174207174077905315d13cbf7ed9043475/library/alloc/src/boxed.rs:2015:9
  47:     0x70e86f8b4989 - std::sys::pal::unix::thread::Thread::new::thread_start::h0c57ccbc925fbfb1
                               at /rustc/6e6c72174207174077905315d13cbf7ed9043475/library/std/src/sys/pal/unix/thread.rs:108:17
  48:     0x70e8690a955a - <unknown>
  49:     0x70e869126a3c - <unknown>
  50:                0x0 - <unknown>

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: rustc 1.79.0-nightly (6e6c72174 2024-03-24) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [typeck] type-checking `inside_const_generic_arguments`
#1 [analysis] running analysis passes on this crate
end of query stack
error[E0277]: the `?` operator can only be applied to values that implement `Try`
 --> /tmp/icemaker_global_tempdir.Inyf7W2KFFFf/rustc_testrunner_tmpdir_reporting.q9s3C0siDnzp/mvce.rs:5:31
  |
5 |                 while let 0 = 0? {}
  |                               ^^ the `?` operator cannot be applied to type `{integer}`
  |
  = help: the trait `Try` is not implemented for `{integer}`

error[E0433]: failed to resolve: use of undeclared type `A`
 --> /tmp/icemaker_global_tempdir.Inyf7W2KFFFf/rustc_testrunner_tmpdir_reporting.q9s3C0siDnzp/mvce.rs:2:15
  |
2 |     while let A::<
  |               ^ use of undeclared type `A`

error: aborting due to 4 previous errors

Some errors have detailed explanations: E0277, E0433, E0601.
For more information about an error, try `rustc --explain E0277`.

Metadata

Metadata

Assignees

Labels

C-bugCategory: This is a bug.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