-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
ice: calling const FnDef errored when it shouldn't
#117795
Comments
Regression in nightly-2022-02-14 |
Is the following code due to the same reason? const fn a() -> usize {
b()
}
const fn b() -> usize {
a()
}
const ARR: [i32; a.call(())] = [5; 6];
fn main() {} rustc 1.84.0-nightly (b91a3a056 2024-11-07)
binary: rustc
commit-hash: b91a3a05609a46f73d23e0995ae7ebb4a4f429a5
commit-date: 2024-11-07
host: x86_64-unknown-linux-gnu
release: 1.84.0-nightly
LLVM version: 19.1.3 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: compiler flags: --crate-type staticlib -C link-dead-code -C debuginfo=2 -C opt-level=3 -Z mir-opt-level=3
query stack during panic:
#0 [mir_drops_elaborated_and_const_checked] elaborating drops for `main`
#1 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 3 previous errors
Some errors have detailed explanations: E0277, E0428.
For more information about an error, try `rustc --explain E0277`.
(base) ➜ crash_20241107_132156_0034 git:(master) ✗ cd ../crash_20241107_140102_0039
(base) ➜ crash_20241107_140102_0039 git:(master) ✗ ls
bug_descriptor.properties crash_signature.txt delta mutant.rs reproduce.sh rustc-ice-2024-11-08T08_46_24-2164265.txt seed.rs stderr.txt stdout.txt
(base) ➜ crash_20241107_140102_0039 git:(master) ✗ rustc --crate-type staticlib -C link-dead-code -C debuginfo=2 -C opt-level=3 -Z mir-opt-level=3 mutant.rs
error[E0658]: use of unstable library feature `fn_traits`
--> mutant.rs:7:20
|
7 | const ARR: [i32; a.call(())] = [5; 6];
| ^^^^
|
= 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
= note: this compiler was built on 2024-11-07; consider upgrading it if it is out of date
error: internal compiler error: compiler/rustc_const_eval/src/check_consts/ops.rs:177:29: calling const FnDef errored when it shouldn't
--> mutant.rs:1:1
|
1 | const fn a() -> usize {
| ^^^^^^^^^^^^^^^^^^^^^
thread 'rustc' panicked at compiler/rustc_const_eval/src/check_consts/ops.rs:177:29:
Box<dyn Any>
stack backtrace:
0: 0x7fa99a25517a - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::hfadad24fb33e3d1a
1: 0x7fa99aa040a6 - core::fmt::write::h42d25fbda60cd99f
2: 0x7fa99bdc3351 - std::io::Write::write_fmt::hc2819193e80b365e
3: 0x7fa99a254fd2 - std::sys::backtrace::BacktraceLock::print::h9450230402d77664
4: 0x7fa99a2574d6 - std::panicking::default_hook::{{closure}}::h739047d4d787c596
5: 0x7fa99a257320 - std::panicking::default_hook::h203d1229480f37a5
6: 0x7fa9992d2269 - std[56fe22ad9ea837fd]::panicking::update_hook::<alloc[b5641001d343df5f]::boxed::Box<rustc_driver_impl[945e9afaf49c7d35]::install_ice_hook::{closure#0}>>::{clos
7: 0x7fa99a257be8 - std::panicking::rust_panic_with_hook::h657fdcc17f7e2546
8: 0x7fa99930c191 - std[56fe22ad9ea837fd]::panicking::begin_panic::<rustc_errors[43c84716ac990581]::ExplicitBug>::{closure#0}
9: 0x7fa9992ff166 - std[56fe22ad9ea837fd]::sys::backtrace::__rust_end_short_backtrace::<std[56fe22ad9ea837fd]::panicking::begin_panic<rustc_errors[43c84716ac990581]::ExplicitBug>:
10: 0x7fa9992feefe - std[56fe22ad9ea837fd]::panicking::begin_panic::<rustc_errors[43c84716ac990581]::ExplicitBug>
11: 0x7fa999315e71 - <rustc_errors[43c84716ac990581]::diagnostic::BugAbort as rustc_errors[43c84716ac990581]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
12: 0x7fa99921c09c - <rustc_errors[43c84716ac990581]::DiagCtxtHandle>::span_bug::<rustc_span[db86d96c2ae2e3a4]::span_encoding::Span, alloc[b5641001d343df5f]::string::String>
13: 0x7fa999243757 - rustc_middle[f0eb6ba890d0a9bb]::util::bug::opt_span_bug_fmt::<rustc_span[db86d96c2ae2e3a4]::span_encoding::Span>::{closure#0}
14: 0x7fa99924378a - rustc_middle[f0eb6ba890d0a9bb]::ty::context::tls::with_opt::<rustc_middle[f0eb6ba890d0a9bb]::util::bug::opt_span_bug_fmt<rustc_span[db86d96c2ae2e3a4]::span_enc
15: 0x7fa99922eb2b - rustc_middle[f0eb6ba890d0a9bb]::ty::context::tls::with_context_opt::<rustc_middle[f0eb6ba890d0a9bb]::ty::context::tls::with_opt<rustc_middle[f0eb6ba890d0a9bb]:
16: 0x7fa9984000e7 - rustc_middle[f0eb6ba890d0a9bb]::util::bug::span_bug_fmt::<rustc_span[db86d96c2ae2e3a4]::span_encoding::Span>
17: 0x7fa999276fa3 - <rustc_const_eval[7b31d01bb6bba4c4]::check_consts::ops::FnCallNonConst as rustc_const_eval[7b31d01bb6bba4c4]::check_consts::ops::NonConstOp>::build_error
18: 0x7fa99927187d - <rustc_const_eval[7b31d01bb6bba4c4]::check_consts::check::Checker>::check_op_spanned::<rustc_const_eval[7b31d01bb6bba4c4]::check_consts::ops::FnCallNonConst>
19: 0x7fa99b577b6d - <rustc_const_eval[7b31d01bb6bba4c4]::check_consts::check::Checker as rustc_middle[f0eb6ba890d0a9bb]::mir::visit::Visitor>::visit_terminator
20: 0x7fa99b57d517 - <rustc_const_eval[7b31d01bb6bba4c4]::check_consts::check::Checker>::check_body
21: 0x7fa99b57cc1e - rustc_mir_transform[c62e463fc59f8bd1]::mir_const_qualif
22: 0x7fa99b57ca25 - rustc_query_impl[1357963d8dd30e8b]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[1357963d8dd30e8b]::query_impl::mir_const_qualif::dynamic_query::{
23: 0x7fa99b57b792 - rustc_query_system[887bb79932b1d8c1]::query::plumbing::try_execute_query::<rustc_query_impl[1357963d8dd30e8b]::DynamicConfig<rustc_query_system[887bb79932b1d8c
24: 0x7fa99b57b522 - rustc_query_impl[1357963d8dd30e8b]::query_impl::mir_const_qualif::get_query_non_incr::__rust_end_short_backtrace
25: 0x7fa997f18083 - rustc_mir_transform[c62e463fc59f8bd1]::mir_promoted
26: 0x7fa99af32292 - rustc_query_impl[1357963d8dd30e8b]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[1357963d8dd30e8b]::query_impl::mir_promoted::dynamic_query::{clos
27: 0x7fa99af3255f - rustc_query_system[887bb79932b1d8c1]::query::plumbing::try_execute_query::<rustc_query_impl[1357963d8dd30e8b]::DynamicConfig<rustc_query_system[887bb79932b1d8c
28: 0x7fa99bab20d0 - rustc_query_impl[1357963d8dd30e8b]::query_impl::mir_promoted::get_query_non_incr::__rust_end_short_backtrace
29: 0x7fa99bab21c6 - rustc_query_impl[1357963d8dd30e8b]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[1357963d8dd30e8b]::query_impl::mir_borrowck::dynamic_query::{clos
30: 0x7fa99b123681 - rustc_query_system[887bb79932b1d8c1]::query::plumbing::try_execute_query::<rustc_query_impl[1357963d8dd30e8b]::DynamicConfig<rustc_query_system[887bb79932b1d8c
31: 0x7fa99b12318d - rustc_query_impl[1357963d8dd30e8b]::query_impl::mir_borrowck::get_query_non_incr::__rust_end_short_backtrace
32: 0x7fa99acdde73 - rustc_mir_transform[c62e463fc59f8bd1]::mir_drops_elaborated_and_const_checked
33: 0x7fa99acdd45b - rustc_query_impl[1357963d8dd30e8b]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[1357963d8dd30e8b]::query_impl::mir_drops_elaborated_and_const_che
34: 0x7fa99b123681 - rustc_query_system[887bb79932b1d8c1]::query::plumbing::try_execute_query::<rustc_query_impl[1357963d8dd30e8b]::DynamicConfig<rustc_query_system[887bb79932b1d8c
35: 0x7fa99b1230cd - rustc_query_impl[1357963d8dd30e8b]::query_impl::mir_drops_elaborated_and_const_checked::get_query_non_incr::__rust_end_short_backtrace
36: 0x7fa99adb6fb0 - rustc_mir_transform[c62e463fc59f8bd1]::mir_for_ctfe
37: 0x7fa99adb6e5d - rustc_query_impl[1357963d8dd30e8b]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[1357963d8dd30e8b]::query_impl::mir_for_ctfe::dynamic_query::{clos
38: 0x7fa99aa23bb6 - rustc_query_system[887bb79932b1d8c1]::query::plumbing::try_execute_query::<rustc_query_impl[1357963d8dd30e8b]::DynamicConfig<rustc_query_system[887bb79932b1d8c
39: 0x7fa99b34977d - rustc_query_impl[1357963d8dd30e8b]::query_impl::mir_for_ctfe::get_query_non_incr::__rust_end_short_backtrace
40: 0x7fa99b3498c2 - <rustc_const_eval[7b31d01bb6bba4c4]::interpret::eval_context::InterpCx<rustc_const_eval[7b31d01bb6bba4c4]::const_eval::machine::CompileTimeMachine>>::load_mir
41: 0x7fa99b34a6d7 - rustc_const_eval[7b31d01bb6bba4c4]::const_eval::eval_queries::eval_to_allocation_raw_provider
42: 0x7fa99b34a436 - rustc_query_impl[1357963d8dd30e8b]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[1357963d8dd30e8b]::query_impl::eval_to_allocation_raw::dynamic_qu
43: 0x7fa99b34574b - rustc_query_system[887bb79932b1d8c1]::query::plumbing::try_execute_query::<rustc_query_impl[1357963d8dd30e8b]::DynamicConfig<rustc_query_system[887bb79932b1d8c
44: 0x7fa99b345339 - rustc_query_impl[1357963d8dd30e8b]::query_impl::eval_to_allocation_raw::get_query_non_incr::__rust_end_short_backtrace
45: 0x7fa99b31a09c - rustc_const_eval[7b31d01bb6bba4c4]::const_eval::valtrees::eval_to_valtree
46: 0x7fa99b319ebf - <rustc_const_eval[7b31d01bb6bba4c4]::provide::{closure#0} as core[5ba82ee3405aa490]::ops::function::FnOnce<(rustc_middle[f0eb6ba890d0a9bb]::ty::context::TyCtxt
47: 0x7fa99b319e76 - rustc_query_impl[1357963d8dd30e8b]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[1357963d8dd30e8b]::query_impl::eval_to_valtree::dynamic_query::{c
48: 0x7fa99b319e2f - <rustc_query_impl[1357963d8dd30e8b]::query_impl::eval_to_valtree::dynamic_query::{closure#2} as core[5ba82ee3405aa490]::ops::function::FnOnce<(rustc_middle[f0e
49: 0x7fa99b34581f - rustc_query_system[887bb79932b1d8c1]::query::plumbing::try_execute_query::<rustc_query_impl[1357963d8dd30e8b]::DynamicConfig<rustc_query_system[887bb79932b1d8c
50: 0x7fa99b53f047 - rustc_query_impl[1357963d8dd30e8b]::query_impl::eval_to_valtree::get_query_non_incr::__rust_end_short_backtrace
51: 0x7fa99b53e84e - rustc_middle[f0eb6ba890d0a9bb]::query::plumbing::query_get_at::<rustc_query_system[887bb79932b1d8c1]::query::caches::DefaultCache<rustc_middle[f0eb6ba890d0a9bb
52: 0x7fa99b53e2db - <rustc_middle[f0eb6ba890d0a9bb]::ty::context::TyCtxt>::const_eval_global_id_for_typeck
53: 0x7fa99b53c9cc - <rustc_middle[f0eb6ba890d0a9bb]::ty::context::TyCtxt>::const_eval_resolve_for_typeck
54: 0x7fa99b53c682 - <rustc_middle[f0eb6ba890d0a9bb]::ty::consts::Const>::normalize_internal
55: 0x7fa99b497a4d - <rustc_middle[f0eb6ba890d0a9bb]::ty::Ty as rustc_type_ir[8408d34320f8a6fb]::fold::TypeSuperFoldable<rustc_middle[f0eb6ba890d0a9bb]::ty::context::TyCtxt>>::try_
56: 0x7fa99af009a6 - <rustc_hir_analysis[af6e6fecb0b5810e]::check::wfcheck::WfCheckingCtxt>::normalize::<rustc_middle[f0eb6ba890d0a9bb]::ty::Ty>
57: 0x7fa99aef7c67 - rustc_hir_analysis[af6e6fecb0b5810e]::check::wfcheck::check_item_type
58: 0x7fa998280721 - rustc_hir_analysis[af6e6fecb0b5810e]::check::wfcheck::check_well_formed
59: 0x7fa99adef1c7 - rustc_query_impl[1357963d8dd30e8b]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[1357963d8dd30e8b]::query_impl::check_well_formed::dynamic_query::
60: 0x7fa99adee919 - rustc_query_system[887bb79932b1d8c1]::query::plumbing::try_execute_query::<rustc_query_impl[1357963d8dd30e8b]::DynamicConfig<rustc_query_system[887bb79932b1d8c
61: 0x7fa99adee590 - rustc_query_impl[1357963d8dd30e8b]::query_impl::check_well_formed::get_query_non_incr::__rust_end_short_backtrace
62: 0x7fa99adef440 - rustc_hir_analysis[af6e6fecb0b5810e]::check::wfcheck::check_mod_type_wf
63: 0x7fa99adef26f - rustc_query_impl[1357963d8dd30e8b]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[1357963d8dd30e8b]::query_impl::check_mod_type_wf::dynamic_query::{closure#2}::{closure#0}, rustc_middle[f0eb6ba890d0a9bb]::query::erase::Erased<[u8; 1usize]>>
64: 0x7fa99b5ed0c1 - rustc_query_system[887bb79932b1d8c1]::query::plumbing::try_execute_query::<rustc_query_impl[1357963d8dd30e8b]::DynamicConfig<rustc_query_system[887bb79932b1d8c1]::query::caches::DefaultCache<rustc_span[db86d96c2ae2e3a4]::def_id::LocalModDefId, rustc_middle[f0eb6ba890d0a9bb]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[1357963d8dd30e8b]::plumbing::QueryCtxt, false>
65: 0x7fa99b5ece70 - rustc_query_impl[1357963d8dd30e8b]::query_impl::check_mod_type_wf::get_query_non_incr::__rust_end_short_backtrace
66: 0x7fa99b11f42f - rustc_hir_analysis[af6e6fecb0b5810e]::check_crate
67: 0x7fa99b268aca - rustc_interface[5fea8bf9cd0b71b5]::passes::run_required_analyses
68: 0x7fa99b80861e - rustc_interface[5fea8bf9cd0b71b5]::passes::analysis
69: 0x7fa99b8085ef - rustc_query_impl[1357963d8dd30e8b]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[1357963d8dd30e8b]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[f0eb6ba890d0a9bb]::query::erase::Erased<[u8; 1usize]>>
70: 0x7fa99b992cee - rustc_query_system[887bb79932b1d8c1]::query::plumbing::try_execute_query::<rustc_query_impl[1357963d8dd30e8b]::DynamicConfig<rustc_query_system[887bb79932b1d8c1]::query::caches::SingleCache<rustc_middle[f0eb6ba890d0a9bb]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[1357963d8dd30e8b]::plumbing::QueryCtxt, false>
71: 0x7fa99b9929ce - rustc_query_impl[1357963d8dd30e8b]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
72: 0x7fa99b88707a - rustc_interface[5fea8bf9cd0b71b5]::interface::run_compiler::<core[5ba82ee3405aa490]::result::Result<(), rustc_span[db86d96c2ae2e3a4]::ErrorGuaranteed>, rustc_driver_impl[945e9afaf49c7d35]::run_compiler::{closure#0}>::{closure#1}
73: 0x7fa99b8cd5d0 - std[56fe22ad9ea837fd]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[5fea8bf9cd0b71b5]::util::run_in_thread_with_globals<rustc_interface[5fea8bf9cd0b71b5]::util::run_in_thread_pool_with_globals<rustc_interface[5fea8bf9cd0b71b5]::interface::run_compiler<core[5ba82ee3405aa490]::result::Result<(), rustc_span[db86d96c2ae2e3a4]::ErrorGuaranteed>, rustc_driver_impl[945e9afaf49c7d35]::run_compiler::{closure#0}>::{closure#1}, core[5ba82ee3405aa490]::result::Result<(), rustc_span[db86d96c2ae2e3a4]::ErrorGuaranteed>>::{closure#0}, core[5ba82ee3405aa490]::result::Result<(), rustc_span[db86d96c2ae2e3a4]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[5ba82ee3405aa490]::result::Result<(), rustc_span[db86d96c2ae2e3a4]::ErrorGuaranteed>>
74: 0x7fa99b8cd9eb - <<std[56fe22ad9ea837fd]::thread::Builder>::spawn_unchecked_<rustc_interface[5fea8bf9cd0b71b5]::util::run_in_thread_with_globals<rustc_interface[5fea8bf9cd0b71b5]::util::run_in_thread_pool_with_globals<rustc_interface[5fea8bf9cd0b71b5]::interface::run_compiler<core[5ba82ee3405aa490]::result::Result<(), rustc_span[db86d96c2ae2e3a4]::ErrorGuaranteed>, rustc_driver_impl[945e9afaf49c7d35]::run_compiler::{closure#0}>::{closure#1}, core[5ba82ee3405aa490]::result::Result<(), rustc_span[db86d96c2ae2e3a4]::ErrorGuaranteed>>::{closure#0}, core[5ba82ee3405aa490]::result::Result<(), rustc_span[db86d96c2ae2e3a4]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[5ba82ee3405aa490]::result::Result<(), rustc_span[db86d96c2ae2e3a4]::ErrorGuaranteed>>::{closure#1} as core[5ba82ee3405aa490]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
75: 0x7fa99b8ce4b9 - std::sys::pal::unix::thread::Thread::new::thread_start::hb3d6392adeea417c
76: 0x7fa995a54ac3 - start_thread
at ./nptl/pthread_create.c:442:8
77: 0x7fa995ae6850 - __GI___clone3
at ./misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
78: 0x0 - <unknown> |
auto-reduced (treereduce-rust):
original:
Version information
Command:
/home/matthias/.rustup/toolchains/master/bin/rustc
Program output
The text was updated successfully, but these errors were encountered: