rust-lang / rust-lang/rust

ice: `calling const FnDef errored when it shouldn't`

Open
#117,795 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-const-eval C-bug I-ICE S-bug-has-test T-compiler
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

auto-reduced (treereduce-rust):

const fn f() -> usize {
    5
}

fn main() {
    let _ = [0; FnMut::call_mut(&mut f, ())];
}


original:

// run-pass
#![allow(dead_code)]
const fn f() -> usize {
    5
}
struct A {
    field: usize,
}
fn main() {
    let _ = [0; FnMut::call_mut(&mut f, ())];
}

Version information

rustc 1.75.0-nightly (17d0a45f5 2023-11-10)
binary: rustc
commit-hash: 17d0a45f5df31f218b84c3275bb05c3227348b5b
commit-date: 2023-11-10
host: x86_64-unknown-linux-gnu
release: 1.75.0-nightly
LLVM version: 17.0.4

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

Program output

error[E0658]: use of unstable library feature 'fn_traits'
 --> /tmp/icemaker_global_tempdir.5VaVqo1AvwQO/rustc_testrunner_tmpdir_reporting.KbLiqxBwHKYO/mvce.rs:6:17
  |
6 |     let _ = [0; FnMut::call_mut(&mut f, ())];
  |                 ^^^^^^^^^^^^^^^
  |
  = note: see issue #29625 <https://github.com/rust-lang/rust/issues/29625> for more information
  = help: add `#![feature(fn_traits)]` to the crate attributes to enable

error[E0658]: mutable references are not allowed in constants
 --> /tmp/icemaker_global_tempdir.5VaVqo1AvwQO/rustc_testrunner_tmpdir_reporting.KbLiqxBwHKYO/mvce.rs:6:33
  |
6 |     let _ = [0; FnMut::call_mut(&mut f, ())];
  |                                 ^^^^^^
  |
  = note: see issue #57349 <https://github.com/rust-lang/rust/issues/57349> for more information
  = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable

error: internal compiler error: compiler/rustc_const_eval/src/transform/check_consts/ops.rs:202:29: calling const FnDef errored when it shouldn't
 --> /tmp/icemaker_global_tempdir.5VaVqo1AvwQO/rustc_testrunner_tmpdir_reporting.KbLiqxBwHKYO/mvce.rs:1:1
  |
1 | const fn f() -> usize {
  | ^^^^^^^^^^^^^^^^^^^^^

thread 'rustc' panicked at /rustc/17d0a45f5df31f218b84c3275bb05c3227348b5b/compiler/rustc_errors/src/lib.rs:1000:33:
Box<dyn Any>
stack backtrace:
   0:     0x7fae69f8b62c - std::backtrace_rs::backtrace::libunwind::trace::h46374b84341786bc
                               at /rustc/17d0a45f5df31f218b84c3275bb05c3227348b5b/library/std/src/../../backtrace/src/backtrace/libunwind.rs:104:5
   1:     0x7fae69f8b62c - std::backtrace_rs::backtrace::trace_unsynchronized::he7815f30c698ee16
                               at /rustc/17d0a45f5df31f218b84c3275bb05c3227348b5b/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7fae69f8b62c - std::sys_common::backtrace::_print_fmt::hf3ac027a6e20df81
                               at /rustc/17d0a45f5df31f218b84c3275bb05c3227348b5b/library/std/src/sys_common/backtrace.rs:67:5
   3:     0x7fae69f8b62c - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h6350b6493143b1fc
                               at /rustc/17d0a45f5df31f218b84c3275bb05c3227348b5b/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7fae69fde630 - core::fmt::rt::Argument::fmt::haac38874886df8e7
                               at /rustc/17d0a45f5df31f218b84c3275bb05c3227348b5b/library/core/src/fmt/rt.rs:142:9
   5:     0x7fae69fde630 - core::fmt::write::hf0e822b6d8ad56b2
                               at /rustc/17d0a45f5df31f218b84c3275bb05c3227348b5b/library/core/src/fmt/mod.rs:1120:17
   6:     0x7fae69f7f54f - std::io::Write::write_fmt::h1a44df357aa13b6e
                               at /rustc/17d0a45f5df31f218b84c3275bb05c3227348b5b/library/std/src/io/mod.rs:1762:15
   7:     0x7fae69f8b414 - std::sys_common::backtrace::_print::h95329df2b370286a
                               at /rustc/17d0a45f5df31f218b84c3275bb05c3227348b5b/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x7fae69f8b414 - std::sys_common::backtrace::print::hd1549e5974c3fa44
                               at /rustc/17d0a45f5df31f218b84c3275bb05c3227348b5b/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x7fae69f8e0a7 - std::panicking::default_hook::{{closure}}::hfc23d70499246b08
  10:     0x7fae69f8de0f - std::panicking::default_hook::h0d66df0a095a3bd0
                               at /rustc/17d0a45f5df31f218b84c3275bb05c3227348b5b/library/std/src/panicking.rs:292:9
  11:     0x7fae6ccee150 - std[4df474cf7c0204ae]::panicking::update_hook::<alloc[ca626be192fcf572]::boxed::Box<rustc_driver_impl[ec4025a53c2103e9]::install_ice_hook::{closure#0}>>::{closure#0}
  12:     0x7fae69f8e7e8 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h44f7f870300bcc1d
                               at /rustc/17d0a45f5df31f218b84c3275bb05c3227348b5b/library/alloc/src/boxed.rs:2021:9
  13:     0x7fae69f8e7e8 - std::panicking::rust_panic_with_hook::h652875067b2fe609
                               at /rustc/17d0a45f5df31f218b84c3275bb05c3227348b5b/library/std/src/panicking.rs:783:13
  14:     0x7fae6cc7c644 - std[4df474cf7c0204ae]::panicking::begin_panic::<rustc_errors[1bc87cf102603fe6]::ExplicitBug>::{closure#0}
  15:     0x7fae6cc6d896 - std[4df474cf7c0204ae]::sys_common::backtrace::__rust_end_short_backtrace::<std[4df474cf7c0204ae]::panicking::begin_panic<rustc_errors[1bc87cf102603fe6]::ExplicitBug>::{closure#0}, !>
  16:     0x7fae6cc680c6 - std[4df474cf7c0204ae]::panicking::begin_panic::<rustc_errors[1bc87cf102603fe6]::ExplicitBug>
  17:     0x7fae6cc6396e - <rustc_errors[1bc87cf102603fe6]::HandlerInner>::span_bug::<rustc_span[9afbaaf51cc05e3]::span_encoding::Span, alloc[ca626be192fcf572]::string::String>
  18:     0x7fae6cc5e428 - <rustc_errors[1bc87cf102603fe6]::Handler>::span_bug::<rustc_span[9afbaaf51cc05e3]::span_encoding::Span, alloc[ca626be192fcf572]::string::String>
  19:     0x7fae6cc7c78b - rustc_middle[dadee63cb0feb6d5]::util::bug::opt_span_bug_fmt::<rustc_span[9afbaaf51cc05e3]::span_encoding::Span>::{closure#0}
  20:     0x7fae6cc7c9aa - rustc_middle[dadee63cb0feb6d5]::ty::context::tls::with_opt::<rustc_middle[dadee63cb0feb6d5]::util::bug::opt_span_bug_fmt<rustc_span[9afbaaf51cc05e3]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  21:     0x7fae6cc748e8 - rustc_middle[dadee63cb0feb6d5]::ty::context::tls::with_context_opt::<rustc_middle[dadee63cb0feb6d5]::ty::context::tls::with_opt<rustc_middle[dadee63cb0feb6d5]::util::bug::opt_span_bug_fmt<rustc_span[9afbaaf51cc05e3]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  22:     0x7fae6c0707e4 - rustc_middle[dadee63cb0feb6d5]::util::bug::span_bug_fmt::<rustc_span[9afbaaf51cc05e3]::span_encoding::Span>
  23:     0x7fae6ccb406e - <rustc_const_eval[9c84324ae0dfb81]::transform::check_consts::ops::FnCallNonConst as rustc_const_eval[9c84324ae0dfb81]::transform::check_consts::ops::NonConstOp>::build_error
  24:     0x7fae6ccaed32 - <rustc_const_eval[9c84324ae0dfb81]::transform::check_consts::check::Checker>::check_op_spanned::<rustc_const_eval[9c84324ae0dfb81]::transform::check_consts::ops::FnCallNonConst>
  25:     0x7fae6eea937e - <rustc_const_eval[9c84324ae0dfb81]::transform::check_consts::check::Checker as rustc_middle[dadee63cb0feb6d5]::mir::visit::Visitor>::visit_terminator
  26:     0x7fae6c23e78f - <rustc_const_eval[9c84324ae0dfb81]::transform::check_consts::check::Checker as rustc_middle[dadee63cb0feb6d5]::mir::visit::Visitor>::visit_basic_block_data
  27:     0x7fae6ea269b7 - <rustc_const_eval[9c84324ae0dfb81]::transform::check_consts::check::Checker>::check_body
  28:     0x7fae6ea2767c - rustc_mir_transform[68e77d7196a8ecec]::mir_const_qualif
  29:     0x7fae6ea2754b - rustc_query_impl[d9d242dab8718f47]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[d9d242dab8718f47]::query_impl::mir_const_qualif::dynamic_query::{closure#2}::{closure#0}, rustc_middle[dadee63cb0feb6d5]::query::erase::Erased<[u8; 5usize]>>
  30:     0x7fae6ea25c30 - rustc_query_system[6b6f1c30493de844]::query::plumbing::try_execute_query::<rustc_query_impl[d9d242dab8718f47]::DynamicConfig<rustc_query_system[6b6f1c30493de844]::query::caches::DefaultCache<rustc_span[9afbaaf51cc05e3]::def_id::DefId, rustc_middle[dadee63cb0feb6d5]::query::erase::Erased<[u8; 5usize]>>, false, false, false>, rustc_query_impl[d9d242dab8718f47]::plumbing::QueryCtxt, false>
  31:     0x7fae6ea25996 - rustc_query_impl[d9d242dab8718f47]::query_impl::mir_const_qualif::get_query_non_incr::__rust_end_short_backtrace
  32:     0x7fae6c26c39d - rustc_mir_transform[68e77d7196a8ecec]::mir_promoted
  33:     0x7fae6e4e3092 - rustc_query_impl[d9d242dab8718f47]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[d9d242dab8718f47]::query_impl::mir_promoted::dynamic_query::{closure#2}::{closure#0}, rustc_middle[dadee63cb0feb6d5]::query::erase::Erased<[u8; 16usize]>>
  34:     0x7fae6e4e3345 - rustc_query_system[6b6f1c30493de844]::query::plumbing::try_execute_query::<rustc_query_impl[d9d242dab8718f47]::DynamicConfig<rustc_query_system[6b6f1c30493de844]::query::caches::VecCache<rustc_span[9afbaaf51cc05e3]::def_id::LocalDefId, rustc_middle[dadee63cb0feb6d5]::query::erase::Erased<[u8; 16usize]>>, false, false, false>, rustc_query_impl[d9d242dab8718f47]::plumbing::QueryCtxt, false>
  35:     0x7fae6e4e2f93 - rustc_query_impl[d9d242dab8718f47]::query_impl::mir_promoted::get_query_non_incr::__rust_end_short_backtrace
  36:     0x7fae6ee1ffcb - rustc_borrowck[44740cb65e3b9e2a]::mir_borrowck
  37:     0x7fae6ee1ff17 - rustc_query_impl[d9d242dab8718f47]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[d9d242dab8718f47]::query_impl::mir_borrowck::dynamic_query::{closure#2}::{closure#0}, rustc_middle[dadee63cb0feb6d5]::query::erase::Erased<[u8; 8usize]>>
  38:     0x7fae6e0e2083 - rustc_query_system[6b6f1c30493de844]::query::plumbing::try_execute_query::<rustc_query_impl[d9d242dab8718f47]::DynamicConfig<rustc_query_system[6b6f1c30493de844]::query::caches::VecCache<rustc_span[9afbaaf51cc05e3]::def_id::LocalDefId, rustc_middle[dadee63cb0feb6d5]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[d9d242dab8718f47]::plumbing::QueryCtxt, false>
  39:     0x7fae6e0e1c50 - rustc_query_impl[d9d242dab8718f47]::query_impl::mir_borrowck::get_query_non_incr::__rust_end_short_backtrace
  40:     0x7fae6b8f375b - rustc_mir_transform[68e77d7196a8ecec]::mir_drops_elaborated_and_const_checked
  41:     0x7fae6e0e1df5 - rustc_query_impl[d9d242dab8718f47]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[d9d242dab8718f47]::query_impl::mir_drops_elaborated_and_const_checked::dynamic_query::{closure#2}::{closure#0}, rustc_middle[dadee63cb0feb6d5]::query::erase::Erased<[u8; 8usize]>>
  42:     0x7fae6e0e2083 - rustc_query_system[6b6f1c30493de844]::query::plumbing::try_execute_query::<rustc_query_impl[d9d242dab8718f47]::DynamicConfig<rustc_query_system[6b6f1c30493de844]::query::caches::VecCache<rustc_span[9afbaaf51cc05e3]::def_id::LocalDefId, rustc_middle[dadee63cb0feb6d5]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[d9d242dab8718f47]::plumbing::QueryCtxt, false>
  43:     0x7fae6e0e1950 - rustc_query_impl[d9d242dab8718f47]::query_impl::mir_drops_elaborated_and_const_checked::get_query_non_incr::__rust_end_short_backtrace
  44:     0x7fae6e0e18a3 - rustc_middle[dadee63cb0feb6d5]::query::plumbing::query_get_at::<rustc_query_system[6b6f1c30493de844]::query::caches::VecCache<rustc_span[9afbaaf51cc05e3]::def_id::LocalDefId, rustc_middle[dadee63cb0feb6d5]::query::erase::Erased<[u8; 8usize]>>>
  45:     0x7fae6e8fc54d - rustc_mir_transform[68e77d7196a8ecec]::mir_for_ctfe
  46:     0x7fae6e0541b7 - rustc_query_impl[d9d242dab8718f47]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[d9d242dab8718f47]::query_impl::mir_for_ctfe::dynamic_query::{closure#2}::{closure#0}, rustc_middle[dadee63cb0feb6d5]::query::erase::Erased<[u8; 8usize]>>
  47:     0x7fae6e0531d4 - rustc_query_system[6b6f1c30493de844]::query::plumbing::try_execute_query::<rustc_query_impl[d9d242dab8718f47]::DynamicConfig<rustc_query_system[6b6f1c30493de844]::query::caches::DefaultCache<rustc_span[9afbaaf51cc05e3]::def_id::DefId, rustc_middle[dadee63cb0feb6d5]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[d9d242dab8718f47]::plumbing::QueryCtxt, false>
  48:     0x7fae6eeaaa1e - rustc_query_impl[d9d242dab8718f47]::query_impl::mir_for_ctfe::get_query_non_incr::__rust_end_short_backtrace
  49:     0x7fae6eeaad27 - rustc_const_eval[9c84324ae0dfb81]::const_eval::eval_queries::eval_in_interpreter
  50:     0x7fae6eeaa89b - rustc_const_eval[9c84324ae0dfb81]::const_eval::eval_queries::eval_to_allocation_raw_provider
  51:     0x7fae6eeaa73a - rustc_query_impl[d9d242dab8718f47]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[d9d242dab8718f47]::query_impl::eval_to_allocation_raw::dynamic_query::{closure#2}::{closure#0}, rustc_middle[dadee63cb0feb6d5]::query::erase::Erased<[u8; 24usize]>>
  52:     0x7fae6e7eb10b - rustc_query_system[6b6f1c30493de844]::query::plumbing::try_execute_query::<rustc_query_impl[d9d242dab8718f47]::DynamicConfig<rustc_query_system[6b6f1c30493de844]::query::caches::DefaultCache<rustc_middle[dadee63cb0feb6d5]::ty::ParamEnvAnd<rustc_middle[dadee63cb0feb6d5]::mir::interpret::GlobalId>, rustc_middle[dadee63cb0feb6d5]::query::erase::Erased<[u8; 24usize]>>, false, false, false>, rustc_query_impl[d9d242dab8718f47]::plumbing::QueryCtxt, false>
  53:     0x7fae6e7eaaf0 - rustc_query_impl[d9d242dab8718f47]::query_impl::eval_to_allocation_raw::get_query_non_incr::__rust_end_short_backtrace
  54:     0x7fae6e7ea7a6 - rustc_middle[dadee63cb0feb6d5]::query::plumbing::query_get_at::<rustc_query_system[6b6f1c30493de844]::query::caches::DefaultCache<rustc_middle[dadee63cb0feb6d5]::ty::ParamEnvAnd<rustc_middle[dadee63cb0feb6d5]::mir::interpret::GlobalId>, rustc_middle[dadee63cb0feb6d5]::query::erase::Erased<[u8; 24usize]>>>
  55:     0x7fae6eeaa8fc - rustc_const_eval[9c84324ae0dfb81]::const_eval::eval_queries::eval_to_allocation_raw_provider
  56:     0x7fae6eeaa73a - rustc_query_impl[d9d242dab8718f47]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[d9d242dab8718f47]::query_impl::eval_to_allocation_raw::dynamic_query::{closure#2}::{closure#0}, rustc_middle[dadee63cb0feb6d5]::query::erase::Erased<[u8; 24usize]>>
  57:     0x7fae6e7eb10b - rustc_query_system[6b6f1c30493de844]::query::plumbing::try_execute_query::<rustc_query_impl[d9d242dab8718f47]::DynamicConfig<rustc_query_system[6b6f1c30493de844]::query::caches::DefaultCache<rustc_middle[dadee63cb0feb6d5]::ty::ParamEnvAnd<rustc_middle[dadee63cb0feb6d5]::mir::interpret::GlobalId>, rustc_middle[dadee63cb0feb6d5]::query::erase::Erased<[u8; 24usize]>>, false, false, false>, rustc_query_impl[d9d242dab8718f47]::plumbing::QueryCtxt, false>
  58:     0x7fae6e7eaaf0 - rustc_query_impl[d9d242dab8718f47]::query_impl::eval_to_allocation_raw::get_query_non_incr::__rust_end_short_backtrace
  59:     0x7fae6e7ea7a6 - rustc_middle[dadee63cb0feb6d5]::query::plumbing::query_get_at::<rustc_query_system[6b6f1c30493de844]::query::caches::DefaultCache<rustc_middle[dadee63cb0feb6d5]::ty::ParamEnvAnd<rustc_middle[dadee63cb0feb6d5]::mir::interpret::GlobalId>, rustc_middle[dadee63cb0feb6d5]::query::erase::Erased<[u8; 24usize]>>>
  60:     0x7fae6e7e9ee7 - rustc_const_eval[9c84324ae0dfb81]::const_eval::eval_to_valtree
  61:     0x7fae6e7e9e62 - <rustc_const_eval[9c84324ae0dfb81]::provide::{closure#0} as core[f248d18e5721e18e]::ops::function::FnOnce<(rustc_middle[dadee63cb0feb6d5]::ty::context::TyCtxt, rustc_middle[dadee63cb0feb6d5]::ty::ParamEnvAnd<rustc_middle[dadee63cb0feb6d5]::mir::interpret::GlobalId>)>>::call_once
  62:     0x7fae6e7e9e36 - rustc_query_impl[d9d242dab8718f47]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[d9d242dab8718f47]::query_impl::eval_to_valtree::dynamic_query::{closure#2}::{closure#0}, rustc_middle[dadee63cb0feb6d5]::query::erase::Erased<[u8; 24usize]>>
  63:     0x7fae6e7e9def - <rustc_query_impl[d9d242dab8718f47]::query_impl::eval_to_valtree::dynamic_query::{closure#2} as core[f248d18e5721e18e]::ops::function::FnOnce<(rustc_middle[dadee63cb0feb6d5]::ty::context::TyCtxt, rustc_middle[dadee63cb0feb6d5]::ty::ParamEnvAnd<rustc_middle[dadee63cb0feb6d5]::mir::interpret::GlobalId>)>>::call_once
  64:     0x7fae6e7eb127 - rustc_query_system[6b6f1c30493de844]::query::plumbing::try_execute_query::<rustc_query_impl[d9d242dab8718f47]::DynamicConfig<rustc_query_system[6b6f1c30493de844]::query::caches::DefaultCache<rustc_middle[dadee63cb0feb6d5]::ty::ParamEnvAnd<rustc_middle[dadee63cb0feb6d5]::mir::interpret::GlobalId>, rustc_middle[dadee63cb0feb6d5]::query::erase::Erased<[u8; 24usize]>>, false, false, false>, rustc_query_impl[d9d242dab8718f47]::plumbing::QueryCtxt, false>
  65:     0x7fae6e7ea9f0 - rustc_query_impl[d9d242dab8718f47]::query_impl::eval_to_valtree::get_query_non_incr::__rust_end_short_backtrace
  66:     0x7fae6e623502 - rustc_middle[dadee63cb0feb6d5]::query::plumbing::query_get_at::<rustc_query_system[6b6f1c30493de844]::query::caches::DefaultCache<rustc_middle[dadee63cb0feb6d5]::ty::ParamEnvAnd<rustc_middle[dadee63cb0feb6d5]::mir::interpret::GlobalId>, rustc_middle[dadee63cb0feb6d5]::query::erase::Erased<[u8; 24usize]>>>
  67:     0x7fae6e622427 - <rustc_middle[dadee63cb0feb6d5]::ty::context::TyCtxt>::const_eval_resolve_for_typeck
  68:     0x7fae6e6220d1 - <rustc_middle[dadee63cb0feb6d5]::ty::consts::Const>::eval
  69:     0x7fae6e621a41 - <rustc_trait_selection[9cfc1fff52b512e0]::traits::project::AssocTypeNormalizer as rustc_type_ir[9ef93a72d85a2d6e]::fold::TypeFolder<rustc_middle[dadee63cb0feb6d5]::ty::context::TyCtxt>>::fold_const
  70:     0x7fae6e185ea8 - rustc_trait_selection[9cfc1fff52b512e0]::traits::project::normalize_with_depth_to::<rustc_middle[dadee63cb0feb6d5]::ty::consts::Const>::{closure#0}
  71:     0x7fae6ef7467c - <rustc_hir_typeck[deb2b7c27d72619c]::fn_ctxt::FnCtxt>::array_length_to_const
  72:     0x7fae6eaf48e2 - <rustc_hir_typeck[deb2b7c27d72619c]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  73:     0x7fae6e5b61ad - <rustc_hir_typeck[deb2b7c27d72619c]::fn_ctxt::FnCtxt>::check_decl
  74:     0x7fae6e5b3905 - <rustc_hir_typeck[deb2b7c27d72619c]::fn_ctxt::FnCtxt>::check_block_with_expected
  75:     0x7fae6eaf0174 - <rustc_hir_typeck[deb2b7c27d72619c]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  76:     0x7fae6e79fcaf - rustc_hir_typeck[deb2b7c27d72619c]::check::check_fn
  77:     0x7fae6e322429 - rustc_hir_typeck[deb2b7c27d72619c]::typeck
  78:     0x7fae6e321813 - rustc_query_impl[d9d242dab8718f47]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[d9d242dab8718f47]::query_impl::typeck::dynamic_query::{closure#2}::{closure#0}, rustc_middle[dadee63cb0feb6d5]::query::erase::Erased<[u8; 8usize]>>
  79:     0x7fae6e0e2083 - rustc_query_system[6b6f1c30493de844]::query::plumbing::try_execute_query::<rustc_query_impl[d9d242dab8718f47]::DynamicConfig<rustc_query_system[6b6f1c30493de844]::query::caches::VecCache<rustc_span[9afbaaf51cc05e3]::def_id::LocalDefId, rustc_middle[dadee63cb0feb6d5]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[d9d242dab8718f47]::plumbing::QueryCtxt, false>
  80:     0x7fae6e0e1d10 - rustc_query_impl[d9d242dab8718f47]::query_impl::typeck::get_query_non_incr::__rust_end_short_backtrace
  81:     0x7fae6e5ce980 - rustc_hir_analysis[3fdc3bc95e806e7]::check_crate
  82:     0x7fae6e3aa8d7 - rustc_interface[b3bf249fff60da9a]::passes::analysis
  83:     0x7fae6e3aa537 - rustc_query_impl[d9d242dab8718f47]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[d9d242dab8718f47]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[dadee63cb0feb6d5]::query::erase::Erased<[u8; 1usize]>>
  84:     0x7fae6ef98824 - rustc_query_system[6b6f1c30493de844]::query::plumbing::try_execute_query::<rustc_query_impl[d9d242dab8718f47]::DynamicConfig<rustc_query_system[6b6f1c30493de844]::query::caches::SingleCache<rustc_middle[dadee63cb0feb6d5]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[d9d242dab8718f47]::plumbing::QueryCtxt, false>
  85:     0x7fae6ef98615 - rustc_query_impl[d9d242dab8718f47]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  86:     0x7fae6efa123f - rustc_interface[b3bf249fff60da9a]::interface::run_compiler::<core[f248d18e5721e18e]::result::Result<(), rustc_span[9afbaaf51cc05e3]::ErrorGuaranteed>, rustc_driver_impl[ec4025a53c2103e9]::run_compiler::{closure#1}>::{closure#0}
  87:     0x7fae6efa855a - std[4df474cf7c0204ae]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[b3bf249fff60da9a]::util::run_in_thread_with_globals<rustc_interface[b3bf249fff60da9a]::util::run_in_thread_pool_with_globals<rustc_interface[b3bf249fff60da9a]::interface::run_compiler<core[f248d18e5721e18e]::result::Result<(), rustc_span[9afbaaf51cc05e3]::ErrorGuaranteed>, rustc_driver_impl[ec4025a53c2103e9]::run_compiler::{closure#1}>::{closure#0}, core[f248d18e5721e18e]::result::Result<(), rustc_span[9afbaaf51cc05e3]::ErrorGuaranteed>>::{closure#0}, core[f248d18e5721e18e]::result::Result<(), rustc_span[9afbaaf51cc05e3]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[f248d18e5721e18e]::result::Result<(), rustc_span[9afbaaf51cc05e3]::ErrorGuaranteed>>
  88:     0x7fae6efa8383 - <<std[4df474cf7c0204ae]::thread::Builder>::spawn_unchecked_<rustc_interface[b3bf249fff60da9a]::util::run_in_thread_with_globals<rustc_interface[b3bf249fff60da9a]::util::run_in_thread_pool_with_globals<rustc_interface[b3bf249fff60da9a]::interface::run_compiler<core[f248d18e5721e18e]::result::Result<(), rustc_span[9afbaaf51cc05e3]::ErrorGuaranteed>, rustc_driver_impl[ec4025a53c2103e9]::run_compiler::{closure#1}>::{closure#0}, core[f248d18e5721e18e]::result::Result<(), rustc_span[9afbaaf51cc05e3]::ErrorGuaranteed>>::{closure#0}, core[f248d18e5721e18e]::result::Result<(), rustc_span[9afbaaf51cc05e3]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[f248d18e5721e18e]::result::Result<(), rustc_span[9afbaaf51cc05e3]::ErrorGuaranteed>>::{closure#1} as core[f248d18e5721e18e]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  89:     0x7fae69f986a5 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h473dfddbf197f5bf
                               at /rustc/17d0a45f5df31f218b84c3275bb05c3227348b5b/library/alloc/src/boxed.rs:2007:9
  90:     0x7fae69f986a5 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h8959fbdf8cbf8098
                               at /rustc/17d0a45f5df31f218b84c3275bb05c3227348b5b/library/alloc/src/boxed.rs:2007:9
  91:     0x7fae69f986a5 - std::sys::unix::thread::Thread::new::thread_start::hab410919d7ef6e45
                               at /rustc/17d0a45f5df31f218b84c3275bb05c3227348b5b/library/std/src/sys/unix/thread.rs:108:17
  92:     0x7fae69d4f9eb - <unknown>
  93:     0x7fae69dd37cc - <unknown>
  94:                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.75.0-nightly (17d0a45f5 2023-11-10) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [mir_const_qualif] const checking `main::{constant#0}`
#1 [mir_promoted] promoting constants in MIR for `main::{constant#0}`
#2 [mir_borrowck] borrow-checking `main::{constant#0}`
#3 [mir_drops_elaborated_and_const_checked] elaborating drops for `main::{constant#0}`
#4 [mir_for_ctfe] caching mir of `main::{constant#0}` for CTFE
#5 [eval_to_allocation_raw] const-evaluating + checking `main::{constant#0}`
#6 [eval_to_allocation_raw] const-evaluating + checking `main::{constant#0}`
#7 [eval_to_valtree] evaluating type-level constant
#8 [typeck] type-checking `main`
#9 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 3 previous errors

For more information about this error, try `rustc --explain E0658`.

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 reproducing the reduced example with rustc, then inspect compiler/rustc_const_eval/src/transform/check_consts/ops.rs around line 202 and the FnCallNonConst path shown in the backtrace. The issue is resolved when this program reports its applicable errors without triggering an internal compiler error.

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
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.