Closed
Description
auto-reduced (treereduce-rust):
struct Checked<const F: fn(usize) -> bool>;
fn not_one(val: usize) -> bool {
val != 1
}
const _: Checked<not_one> = Checked::<not_one>;
#![feature(generic_const_exprs)]
original:
struct Checked<const F: fn(usize) -> bool>;
//~^ ERROR function pointers as const generic parameters is forbidden
fn not_one(val: usize) -> bool { val != 1 }
const _: Checked<not_one> = Checked::<not_one>;
fn main() {}
Version information
rustc 1.76.0-nightly (4e3dc976e 2023-12-02)
binary: rustc
commit-hash: 4e3dc976e7876f59373ddc8ac176fe130636bcd1
commit-date: 2023-12-02
host: x86_64-unknown-linux-gnu
release: 1.76.0-nightly
LLVM version: 17.0.5
Command:
/home/matthias/.rustup/toolchains/master/bin/rustc -Zcrate-attr=feature(generic_const_exprs)
Program output
warning: the feature `generic_const_exprs` is incomplete and may not be safe to use and/or cause compiler crashes
--> <crate attribute>:1:9
|
1 | feature(generic_const_exprs)
| ^^^^^^^^^^^^^^^^^^^
|
= note: see issue #76560 <https://github.com/rust-lang/rust/issues/76560> for more information
= note: `#[warn(incomplete_features)]` on by default
error[E0601]: `main` function not found in crate `mvce`
--> /tmp/icemaker_global_tempdir.gHur7OqFWv0M/rustc_testrunner_tmpdir_reporting.xiUdgEkFncd9/mvce.rs:6:48
|
6 | const _: Checked<not_one> = Checked::<not_one>;
| ^ consider adding a `main` function to `/tmp/icemaker_global_tempdir.gHur7OqFWv0M/rustc_testrunner_tmpdir_reporting.xiUdgEkFncd9/mvce.rs`
error: using function pointers as const generic parameters is forbidden
--> /tmp/icemaker_global_tempdir.gHur7OqFWv0M/rustc_testrunner_tmpdir_reporting.xiUdgEkFncd9/mvce.rs:1:25
|
1 | struct Checked<const F: fn(usize) -> bool>;
| ^^^^^^^^^^^^^^^^^
|
= note: the only supported types are integers, `bool` and `char`
error: internal compiler error: compiler/rustc_infer/src/infer/mod.rs:1579:17: unable to construct a constant value for the unevaluated constant UnevaluatedConst { def: DefId(0:8 ~ mvce[7b0d]::_::{constant#0}), args: [] }
--> /tmp/icemaker_global_tempdir.gHur7OqFWv0M/rustc_testrunner_tmpdir_reporting.xiUdgEkFncd9/mvce.rs:6:18
|
6 | const _: Checked<not_one> = Checked::<not_one>;
| ^^^^^^^
thread 'rustc' panicked at /rustc/4e3dc976e7876f59373ddc8ac176fe130636bcd1/compiler/rustc_errors/src/lib.rs:995:33:
Box<dyn Any>
stack backtrace:
0: 0x7fda6dbd528c - std::backtrace_rs::backtrace::libunwind::trace::h6817338c94b27a3e
at /rustc/4e3dc976e7876f59373ddc8ac176fe130636bcd1/library/std/src/../../backtrace/src/backtrace/libunwind.rs:104:5
1: 0x7fda6dbd528c - std::backtrace_rs::backtrace::trace_unsynchronized::h0c6d9d3798c92386
at /rustc/4e3dc976e7876f59373ddc8ac176fe130636bcd1/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
2: 0x7fda6dbd528c - std::sys_common::backtrace::_print_fmt::h834bcd6a65d45603
at /rustc/4e3dc976e7876f59373ddc8ac176fe130636bcd1/library/std/src/sys_common/backtrace.rs:68:5
3: 0x7fda6dbd528c - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h632d407336012a57
at /rustc/4e3dc976e7876f59373ddc8ac176fe130636bcd1/library/std/src/sys_common/backtrace.rs:44:22
4: 0x7fda6dc282c0 - core::fmt::rt::Argument::fmt::h01e7093f49b63767
at /rustc/4e3dc976e7876f59373ddc8ac176fe130636bcd1/library/core/src/fmt/rt.rs:142:9
5: 0x7fda6dc282c0 - core::fmt::write::h38701b4f0b2dfcb8
at /rustc/4e3dc976e7876f59373ddc8ac176fe130636bcd1/library/core/src/fmt/mod.rs:1120:17
6: 0x7fda6dbc917f - std::io::Write::write_fmt::hb5f3f03cb3ca04d4
at /rustc/4e3dc976e7876f59373ddc8ac176fe130636bcd1/library/std/src/io/mod.rs:1810:15
7: 0x7fda6dbd5074 - std::sys_common::backtrace::_print::hd3e5ed5a0b531af5
at /rustc/4e3dc976e7876f59373ddc8ac176fe130636bcd1/library/std/src/sys_common/backtrace.rs:47:5
8: 0x7fda6dbd5074 - std::sys_common::backtrace::print::hb9af834fe41953f4
at /rustc/4e3dc976e7876f59373ddc8ac176fe130636bcd1/library/std/src/sys_common/backtrace.rs:34:9
9: 0x7fda6dbd7d07 - std::panicking::default_hook::{{closure}}::h72d658988ab66f01
10: 0x7fda6dbd7a6f - std::panicking::default_hook::h58213f9fd1d3009c
at /rustc/4e3dc976e7876f59373ddc8ac176fe130636bcd1/library/std/src/panicking.rs:292:9
11: 0x7fda6a8f5cd0 - std[df2d6593d7194e63]::panicking::update_hook::<alloc[8a854d67183381ee]::boxed::Box<rustc_driver_impl[6cfe35843c87edd3]::install_ice_hook::{closure#0}>>::{closure#0}
12: 0x7fda6dbd8448 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h7fd395d777c5491c
at /rustc/4e3dc976e7876f59373ddc8ac176fe130636bcd1/library/alloc/src/boxed.rs:2021:9
13: 0x7fda6dbd8448 - std::panicking::rust_panic_with_hook::h98c8112ef43197a0
at /rustc/4e3dc976e7876f59373ddc8ac176fe130636bcd1/library/std/src/panicking.rs:783:13
14: 0x7fda6ab7e564 - std[df2d6593d7194e63]::panicking::begin_panic::<rustc_errors[1ca61f24e5e0d229]::ExplicitBug>::{closure#0}
15: 0x7fda6ab68386 - std[df2d6593d7194e63]::sys_common::backtrace::__rust_end_short_backtrace::<std[df2d6593d7194e63]::panicking::begin_panic<rustc_errors[1ca61f24e5e0d229]::ExplicitBug>::{closure#0}, !>
16: 0x7fda6ab61426 - std[df2d6593d7194e63]::panicking::begin_panic::<rustc_errors[1ca61f24e5e0d229]::ExplicitBug>
17: 0x7fda6ab51dae - <rustc_errors[1ca61f24e5e0d229]::HandlerInner>::span_bug::<rustc_span[9dcec85a30c01535]::span_encoding::Span, alloc[8a854d67183381ee]::string::String>
18: 0x7fda6ab51708 - <rustc_errors[1ca61f24e5e0d229]::Handler>::span_bug::<rustc_span[9dcec85a30c01535]::span_encoding::Span, alloc[8a854d67183381ee]::string::String>
19: 0x7fda6ab7ea9b - rustc_middle[decbaea72911547]::util::bug::opt_span_bug_fmt::<rustc_span[9dcec85a30c01535]::span_encoding::Span>::{closure#0}
20: 0x7fda6ab7eaca - rustc_middle[decbaea72911547]::ty::context::tls::with_opt::<rustc_middle[decbaea72911547]::util::bug::opt_span_bug_fmt<rustc_span[9dcec85a30c01535]::span_encoding::Span>::{closure#0}, !>::{closure#0}
21: 0x7fda6ab683c8 - rustc_middle[decbaea72911547]::ty::context::tls::with_context_opt::<rustc_middle[decbaea72911547]::ty::context::tls::with_opt<rustc_middle[decbaea72911547]::util::bug::opt_span_bug_fmt<rustc_span[9dcec85a30c01535]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
22: 0x7fda6ab65284 - rustc_middle[decbaea72911547]::util::bug::span_bug_fmt::<rustc_span[9dcec85a30c01535]::span_encoding::Span>
23: 0x7fda6abdb209 - <rustc_infer[d655d61eba052e30]::infer::InferCtxt>::try_const_eval_resolve
24: 0x7fda6b455819 - <rustc_trait_selection[34dffbdf25348a0a]::traits::fulfill::FulfillProcessor as rustc_data_structures[47340807f7653890]::obligation_forest::ObligationProcessor>::process_obligation::{closure#1}
25: 0x7fda68d08123 - <rustc_trait_selection[34dffbdf25348a0a]::traits::fulfill::FulfillProcessor as rustc_data_structures[47340807f7653890]::obligation_forest::ObligationProcessor>::process_obligation
26: 0x7fda6bc11b84 - <rustc_data_structures[47340807f7653890]::obligation_forest::ObligationForest<rustc_trait_selection[34dffbdf25348a0a]::traits::fulfill::PendingPredicateObligation>>::process_obligations::<rustc_trait_selection[34dffbdf25348a0a]::traits::fulfill::FulfillProcessor>
27: 0x7fda6c5a9184 - <rustc_hir_typeck[9593c8bda2de2b24]::fn_ctxt::FnCtxt>::type_inference_fallback
28: 0x7fda6bf138ad - rustc_hir_typeck[9593c8bda2de2b24]::typeck
29: 0x7fda6bf12c7d - rustc_query_impl[ff29417da00622fc]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[ff29417da00622fc]::query_impl::typeck::dynamic_query::{closure#2}::{closure#0}, rustc_middle[decbaea72911547]::query::erase::Erased<[u8; 8usize]>>
30: 0x7fda6be50143 - rustc_query_system[9cd2f7f31604691c]::query::plumbing::try_execute_query::<rustc_query_impl[ff29417da00622fc]::DynamicConfig<rustc_query_system[9cd2f7f31604691c]::query::caches::VecCache<rustc_span[9dcec85a30c01535]::def_id::LocalDefId, rustc_middle[decbaea72911547]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[ff29417da00622fc]::plumbing::QueryCtxt, false>
31: 0x7fda6be4fdd0 - rustc_query_impl[ff29417da00622fc]::query_impl::typeck::get_query_non_incr::__rust_end_short_backtrace
32: 0x7fda6c8d5570 - rustc_hir_analysis[da2a6e1063fa42ac]::check::check::check_mod_item_types
33: 0x7fda6c8d4fb9 - rustc_query_impl[ff29417da00622fc]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[ff29417da00622fc]::query_impl::check_mod_item_types::dynamic_query::{closure#2}::{closure#0}, rustc_middle[decbaea72911547]::query::erase::Erased<[u8; 0usize]>>
34: 0x7fda6c5f65bb - rustc_query_system[9cd2f7f31604691c]::query::plumbing::try_execute_query::<rustc_query_impl[ff29417da00622fc]::DynamicConfig<rustc_query_system[9cd2f7f31604691c]::query::caches::DefaultCache<rustc_span[9dcec85a30c01535]::def_id::LocalModDefId, rustc_middle[decbaea72911547]::query::erase::Erased<[u8; 0usize]>>, false, false, false>, rustc_query_impl[ff29417da00622fc]::plumbing::QueryCtxt, false>
35: 0x7fda6c5f5f97 - rustc_query_impl[ff29417da00622fc]::query_impl::check_mod_item_types::get_query_non_incr::__rust_end_short_backtrace
36: 0x7fda6c624b23 - rustc_hir_analysis[da2a6e1063fa42ac]::check_crate
37: 0x7fda6c782722 - rustc_interface[6c8aab51a4e81018]::passes::analysis
38: 0x7fda6c78235d - rustc_query_impl[ff29417da00622fc]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[ff29417da00622fc]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[decbaea72911547]::query::erase::Erased<[u8; 1usize]>>
39: 0x7fda6cb65e80 - rustc_query_system[9cd2f7f31604691c]::query::plumbing::try_execute_query::<rustc_query_impl[ff29417da00622fc]::DynamicConfig<rustc_query_system[9cd2f7f31604691c]::query::caches::SingleCache<rustc_middle[decbaea72911547]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[ff29417da00622fc]::plumbing::QueryCtxt, false>
40: 0x7fda6cb65c87 - rustc_query_impl[ff29417da00622fc]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
41: 0x7fda6cb74552 - rustc_interface[6c8aab51a4e81018]::interface::run_compiler::<core[50500588ec9d0052]::result::Result<(), rustc_span[9dcec85a30c01535]::ErrorGuaranteed>, rustc_driver_impl[6cfe35843c87edd3]::run_compiler::{closure#0}>::{closure#0}
42: 0x7fda6cb67949 - std[df2d6593d7194e63]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[6c8aab51a4e81018]::util::run_in_thread_with_globals<rustc_interface[6c8aab51a4e81018]::util::run_in_thread_pool_with_globals<rustc_interface[6c8aab51a4e81018]::interface::run_compiler<core[50500588ec9d0052]::result::Result<(), rustc_span[9dcec85a30c01535]::ErrorGuaranteed>, rustc_driver_impl[6cfe35843c87edd3]::run_compiler::{closure#0}>::{closure#0}, core[50500588ec9d0052]::result::Result<(), rustc_span[9dcec85a30c01535]::ErrorGuaranteed>>::{closure#0}, core[50500588ec9d0052]::result::Result<(), rustc_span[9dcec85a30c01535]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[50500588ec9d0052]::result::Result<(), rustc_span[9dcec85a30c01535]::ErrorGuaranteed>>
43: 0x7fda6cb67773 - <<std[df2d6593d7194e63]::thread::Builder>::spawn_unchecked_<rustc_interface[6c8aab51a4e81018]::util::run_in_thread_with_globals<rustc_interface[6c8aab51a4e81018]::util::run_in_thread_pool_with_globals<rustc_interface[6c8aab51a4e81018]::interface::run_compiler<core[50500588ec9d0052]::result::Result<(), rustc_span[9dcec85a30c01535]::ErrorGuaranteed>, rustc_driver_impl[6cfe35843c87edd3]::run_compiler::{closure#0}>::{closure#0}, core[50500588ec9d0052]::result::Result<(), rustc_span[9dcec85a30c01535]::ErrorGuaranteed>>::{closure#0}, core[50500588ec9d0052]::result::Result<(), rustc_span[9dcec85a30c01535]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[50500588ec9d0052]::result::Result<(), rustc_span[9dcec85a30c01535]::ErrorGuaranteed>>::{closure#1} as core[50500588ec9d0052]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
44: 0x7fda6dbe22d5 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h6bfd5ba6e023a698
at /rustc/4e3dc976e7876f59373ddc8ac176fe130636bcd1/library/alloc/src/boxed.rs:2007:9
45: 0x7fda6dbe22d5 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h7da8003a07f4cffa
at /rustc/4e3dc976e7876f59373ddc8ac176fe130636bcd1/library/alloc/src/boxed.rs:2007:9
46: 0x7fda6dbe22d5 - std::sys::unix::thread::Thread::new::thread_start::h64cf2021e889e721
at /rustc/4e3dc976e7876f59373ddc8ac176fe130636bcd1/library/std/src/sys/unix/thread.rs:108:17
47: 0x7fda67aaa9eb - <unknown>
48: 0x7fda67b2e7cc - <unknown>
49: 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.76.0-nightly (4e3dc976e 2023-12-02) running on x86_64-unknown-linux-gnu
note: compiler flags: -Z crate-attr=feature(generic_const_exprs) -Z dump-mir-dir=dir
query stack during panic:
#0 [typeck] type-checking `_`
#1 [check_mod_item_types] checking item types in top-level module
#2 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 3 previous errors; 1 warning emitted
For more information about this error, try `rustc --explain E0601`.
Metadata
Metadata
Assignees
Labels
Category: This is a bug.`#![feature(generic_const_exprs)]`Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Status: This bug is tracked inside the repo by a `known-bug` test.Relevant to the compiler team, which will review and decide on the PR/issue.This issue requires the use of incomplete features.