Closed
Description
Code
#![feature(const_closures, const_trait_imp, effectsl)]
#![allow(incomplete_features)]
trait Foo {
fn foo(&self);
}
impl Foo for () {
fn foo(&self) {}
}
fn main() {
(const || { (()).foo() })();
//~^ ERROR: cannot call non-const fn
}
Meta
rustc --version --verbose
:
rustc 1.72.0-nightly (e4cd16100 2023-07-05)
binary: rustc
commit-hash: e4cd1610067501fa4d347eba7b18f77137dbbf48
commit-date: 2023-07-05
host: x86_64-unknown-linux-gnu
release: 1.72.0-nightly
LLVM version: 16.0.5
Error output
Backtrace
thread 'rustc' panicked at 'ConstContext::Maybe must have host effect param', compiler/rustc_hir_typeck/src/callee.rs:775:44
stack backtrace:
0: 0x7f861c3efa81 - std::backtrace_rs::backtrace::libunwind::trace::hd0180fafc3f67189
at /rustc/e4cd1610067501fa4d347eba7b18f77137dbbf48/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
1: 0x7f861c3efa81 - std::backtrace_rs::backtrace::trace_unsynchronized::h5f5f542cfcd3ea93
at /rustc/e4cd1610067501fa4d347eba7b18f77137dbbf48/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
2: 0x7f861c3efa81 - std::sys_common::backtrace::_print_fmt::h58fe9485d729332b
at /rustc/e4cd1610067501fa4d347eba7b18f77137dbbf48/library/std/src/sys_common/backtrace.rs:65:5
3: 0x7f861c3efa81 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h892fa574703406ce
at /rustc/e4cd1610067501fa4d347eba7b18f77137dbbf48/library/std/src/sys_common/backtrace.rs:44:22
4: 0x7f861c455d8f - core::fmt::rt::Argument::fmt::h9323d9ac1296ca86
at /rustc/e4cd1610067501fa4d347eba7b18f77137dbbf48/library/core/src/fmt/rt.rs:138:9
5: 0x7f861c455d8f - core::fmt::write::h7b3311fc7bec7011
at /rustc/e4cd1610067501fa4d347eba7b18f77137dbbf48/library/core/src/fmt/mod.rs:1094:21
6: 0x7f861c3e24c7 - std::io::Write::write_fmt::hf0bd33b3cf0f8fc8
at /rustc/e4cd1610067501fa4d347eba7b18f77137dbbf48/library/std/src/io/mod.rs:1714:15
7: 0x7f861c3ef895 - std::sys_common::backtrace::_print::h05e7ce29169ad453
at /rustc/e4cd1610067501fa4d347eba7b18f77137dbbf48/library/std/src/sys_common/backtrace.rs:47:5
8: 0x7f861c3ef895 - std::sys_common::backtrace::print::h259bd490e3a5f495
at /rustc/e4cd1610067501fa4d347eba7b18f77137dbbf48/library/std/src/sys_common/backtrace.rs:34:9
9: 0x7f861c3f2673 - std::panicking::default_hook::{{closure}}::h60419100c25d1f9e
at /rustc/e4cd1610067501fa4d347eba7b18f77137dbbf48/library/std/src/panicking.rs:269:22
10: 0x7f861c3f2404 - std::panicking::default_hook::h5458ac0b23f9b258
at /rustc/e4cd1610067501fa4d347eba7b18f77137dbbf48/library/std/src/panicking.rs:288:9
11: 0x7f861b23634b - rustc_driver_impl[e2bfb106dcd1f64f]::install_ice_hook::{closure#0}
12: 0x7f861c3f2e9e - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h4fc06bcacf328e1a
at /rustc/e4cd1610067501fa4d347eba7b18f77137dbbf48/library/alloc/src/boxed.rs:2024:9
13: 0x7f861c3f2e9e - std::panicking::rust_panic_with_hook::hc4b8011c5070ed88
at /rustc/e4cd1610067501fa4d347eba7b18f77137dbbf48/library/std/src/panicking.rs:709:13
14: 0x7f861c3f2c27 - std::panicking::begin_panic_handler::{{closure}}::h49c3f3c1bfbdf6f5
at /rustc/e4cd1610067501fa4d347eba7b18f77137dbbf48/library/std/src/panicking.rs:597:13
15: 0x7f861c3efee6 - std::sys_common::backtrace::__rust_end_short_backtrace::hd9eda361758b8cc0
at /rustc/e4cd1610067501fa4d347eba7b18f77137dbbf48/library/std/src/sys_common/backtrace.rs:151:18
16: 0x7f861c3f2972 - rust_begin_unwind
at /rustc/e4cd1610067501fa4d347eba7b18f77137dbbf48/library/std/src/panicking.rs:593:5
17: 0x7f861c451fe3 - core::panicking::panic_fmt::h35522819180bdf02
at /rustc/e4cd1610067501fa4d347eba7b18f77137dbbf48/library/core/src/panicking.rs:67:14
18: 0x7f861c451d43 - core::panicking::panic_display::h4bea1be2f25ddc5b
at /rustc/e4cd1610067501fa4d347eba7b18f77137dbbf48/library/core/src/panicking.rs:150:5
19: 0x7f861c451d43 - core::panicking::panic_str::hdec2e3f2e5f11b66
at /rustc/e4cd1610067501fa4d347eba7b18f77137dbbf48/library/core/src/panicking.rs:134:5
20: 0x7f861c451d43 - core::option::expect_failed::hac3f5abcdb20b93f
at /rustc/e4cd1610067501fa4d347eba7b18f77137dbbf48/library/core/src/option.rs:1952:5
21: 0x7f8619752243 - <rustc_hir_typeck[f6dc91c3434d623d]::fn_ctxt::FnCtxt>::check_expr_kind
22: 0x7f8619758f2f - <rustc_hir_typeck[f6dc91c3434d623d]::fn_ctxt::FnCtxt>::check_expr_with_expectation
23: 0x7f861979324e - <rustc_hir_typeck[f6dc91c3434d623d]::fn_ctxt::FnCtxt>::check_block_with_expected
24: 0x7f86197494bf - <rustc_hir_typeck[f6dc91c3434d623d]::fn_ctxt::FnCtxt>::check_expr_kind
25: 0x7f8619758f2f - <rustc_hir_typeck[f6dc91c3434d623d]::fn_ctxt::FnCtxt>::check_expr_with_expectation
26: 0x7f8619bb926d - <rustc_hir_typeck[f6dc91c3434d623d]::fn_ctxt::FnCtxt>::check_return_expr
27: 0x7f8619bb0651 - rustc_hir_typeck[f6dc91c3434d623d]::check::check_fn
28: 0x7f86197cef97 - <rustc_hir_typeck[f6dc91c3434d623d]::fn_ctxt::FnCtxt>::check_expr_closure
29: 0x7f861974c841 - <rustc_hir_typeck[f6dc91c3434d623d]::fn_ctxt::FnCtxt>::check_expr_kind
30: 0x7f861991a344 - <rustc_hir_typeck[f6dc91c3434d623d]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
31: 0x7f861990463f - <rustc_hir_typeck[f6dc91c3434d623d]::fn_ctxt::FnCtxt>::check_call
32: 0x7f861974895a - <rustc_hir_typeck[f6dc91c3434d623d]::fn_ctxt::FnCtxt>::check_expr_kind
33: 0x7f8619758f2f - <rustc_hir_typeck[f6dc91c3434d623d]::fn_ctxt::FnCtxt>::check_expr_with_expectation
34: 0x7f8619793031 - <rustc_hir_typeck[f6dc91c3434d623d]::fn_ctxt::FnCtxt>::check_block_with_expected
35: 0x7f86197494bf - <rustc_hir_typeck[f6dc91c3434d623d]::fn_ctxt::FnCtxt>::check_expr_kind
36: 0x7f8619758f2f - <rustc_hir_typeck[f6dc91c3434d623d]::fn_ctxt::FnCtxt>::check_expr_with_expectation
37: 0x7f8619bb926d - <rustc_hir_typeck[f6dc91c3434d623d]::fn_ctxt::FnCtxt>::check_return_expr
38: 0x7f8619bb0651 - rustc_hir_typeck[f6dc91c3434d623d]::check::check_fn
39: 0x7f8619b973f3 - rustc_hir_typeck[f6dc91c3434d623d]::typeck
40: 0x7f861925d86c - rustc_query_impl[b274d6131f7b1f90]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[b274d6131f7b1f90]::query_impl::typeck::dynamic_query::{closure#2}::{closure#0}, rustc_middle[36f410a133de2eee]::query::erase::Erased<[u8; 8usize]>>
41: 0x7f861925d84e - <rustc_query_impl[b274d6131f7b1f90]::query_impl::typeck::dynamic_query::{closure#2} as core[1877eeee917502d9]::ops::function::FnOnce<(rustc_middle[36f410a133de2eee]::ty::context::TyCtxt, rustc_span[ffa356b4eef30eb1]::def_id::LocalDefId)>>::call_once
42: 0x7f8619384e2d - rustc_query_system[d3399df1ed0f61e2]::query::plumbing::try_execute_query::<rustc_query_impl[b274d6131f7b1f90]::DynamicConfig<rustc_query_system[d3399df1ed0f61e2]::query::caches::VecCache<rustc_span[ffa356b4eef30eb1]::def_id::LocalDefId, rustc_middle[36f410a133de2eee]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[b274d6131f7b1f90]::plumbing::QueryCtxt, false>
43: 0x7f861abad6e1 - rustc_query_impl[b274d6131f7b1f90]::query_impl::typeck::get_query_non_incr::__rust_end_short_backtrace
44: 0x7f86193cc54d - rustc_query_impl[b274d6131f7b1f90]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[b274d6131f7b1f90]::query_impl::used_trait_imports::dynamic_query::{closure#2}::{closure#0}, rustc_middle[36f410a133de2eee]::query::erase::Erased<[u8; 8usize]>>
45: 0x7f86193cc4ae - <rustc_query_impl[b274d6131f7b1f90]::query_impl::used_trait_imports::dynamic_query::{closure#2} as core[1877eeee917502d9]::ops::function::FnOnce<(rustc_middle[36f410a133de2eee]::ty::context::TyCtxt, rustc_span[ffa356b4eef30eb1]::def_id::LocalDefId)>>::call_once
46: 0x7f8619384e2d - rustc_query_system[d3399df1ed0f61e2]::query::plumbing::try_execute_query::<rustc_query_impl[b274d6131f7b1f90]::DynamicConfig<rustc_query_system[d3399df1ed0f61e2]::query::caches::VecCache<rustc_span[ffa356b4eef30eb1]::def_id::LocalDefId, rustc_middle[36f410a133de2eee]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[b274d6131f7b1f90]::plumbing::QueryCtxt, false>
47: 0x7f861abb2201 - rustc_query_impl[b274d6131f7b1f90]::query_impl::used_trait_imports::get_query_non_incr::__rust_end_short_backtrace
48: 0x7f861a67a065 - rustc_hir_analysis[efec7ea34622ed25]::check_unused::check_crate
49: 0x7f861a677611 - rustc_hir_analysis[efec7ea34622ed25]::check_crate
50: 0x7f861a66e64a - rustc_interface[b03e5b36acd0a493]::passes::analysis
51: 0x7f861a6f958a - rustc_query_impl[b274d6131f7b1f90]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[b274d6131f7b1f90]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[36f410a133de2eee]::query::erase::Erased<[u8; 1usize]>>
52: 0x7f861a6f9579 - <rustc_query_impl[b274d6131f7b1f90]::query_impl::analysis::dynamic_query::{closure#2} as core[1877eeee917502d9]::ops::function::FnOnce<(rustc_middle[36f410a133de2eee]::ty::context::TyCtxt, ())>>::call_once
53: 0x7f861a892e88 - rustc_query_system[d3399df1ed0f61e2]::query::plumbing::try_execute_query::<rustc_query_impl[b274d6131f7b1f90]::DynamicConfig<rustc_query_system[d3399df1ed0f61e2]::query::caches::SingleCache<rustc_middle[36f410a133de2eee]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[b274d6131f7b1f90]::plumbing::QueryCtxt, false>
54: 0x7f861a892c59 - rustc_query_impl[b274d6131f7b1f90]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
55: 0x7f861a462545 - <rustc_middle[36f410a133de2eee]::ty::context::GlobalCtxt>::enter::<rustc_driver_impl[e2bfb106dcd1f64f]::run_compiler::{closure#1}::{closure#2}::{closure#4}, core[1877eeee917502d9]::result::Result<(), rustc_span[ffa356b4eef30eb1]::ErrorGuaranteed>>
56: 0x7f861a461b72 - <rustc_interface[b03e5b36acd0a493]::interface::Compiler>::enter::<rustc_driver_impl[e2bfb106dcd1f64f]::run_compiler::{closure#1}::{closure#2}, core[1877eeee917502d9]::result::Result<core[1877eeee917502d9]::option::Option<rustc_interface[b03e5b36acd0a493]::queries::Linker>, rustc_span[ffa356b4eef30eb1]::ErrorGuaranteed>>
57: 0x7f861a458885 - rustc_span[ffa356b4eef30eb1]::set_source_map::<core[1877eeee917502d9]::result::Result<(), rustc_span[ffa356b4eef30eb1]::ErrorGuaranteed>, rustc_interface[b03e5b36acd0a493]::interface::run_compiler<core[1877eeee917502d9]::result::Result<(), rustc_span[ffa356b4eef30eb1]::ErrorGuaranteed>, rustc_driver_impl[e2bfb106dcd1f64f]::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
58: 0x7f861a4582f6 - <scoped_tls[d5e856d8f723ce14]::ScopedKey<rustc_span[ffa356b4eef30eb1]::SessionGlobals>>::set::<rustc_interface[b03e5b36acd0a493]::interface::run_compiler<core[1877eeee917502d9]::result::Result<(), rustc_span[ffa356b4eef30eb1]::ErrorGuaranteed>, rustc_driver_impl[e2bfb106dcd1f64f]::run_compiler::{closure#1}>::{closure#0}, core[1877eeee917502d9]::result::Result<(), rustc_span[ffa356b4eef30eb1]::ErrorGuaranteed>>
59: 0x7f861a4578bc - std[c4949d010b2b12f5]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[b03e5b36acd0a493]::util::run_in_thread_pool_with_globals<rustc_interface[b03e5b36acd0a493]::interface::run_compiler<core[1877eeee917502d9]::result::Result<(), rustc_span[ffa356b4eef30eb1]::ErrorGuaranteed>, rustc_driver_impl[e2bfb106dcd1f64f]::run_compiler::{closure#1}>::{closure#0}, core[1877eeee917502d9]::result::Result<(), rustc_span[ffa356b4eef30eb1]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[1877eeee917502d9]::result::Result<(), rustc_span[ffa356b4eef30eb1]::ErrorGuaranteed>>
60: 0x7f861a457685 - <<std[c4949d010b2b12f5]::thread::Builder>::spawn_unchecked_<rustc_interface[b03e5b36acd0a493]::util::run_in_thread_pool_with_globals<rustc_interface[b03e5b36acd0a493]::interface::run_compiler<core[1877eeee917502d9]::result::Result<(), rustc_span[ffa356b4eef30eb1]::ErrorGuaranteed>, rustc_driver_impl[e2bfb106dcd1f64f]::run_compiler::{closure#1}>::{closure#0}, core[1877eeee917502d9]::result::Result<(), rustc_span[ffa356b4eef30eb1]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[1877eeee917502d9]::result::Result<(), rustc_span[ffa356b4eef30eb1]::ErrorGuaranteed>>::{closure#1} as core[1877eeee917502d9]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
61: 0x7f861c3fd315 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::ha34cb32f4acd27b7
at /rustc/e4cd1610067501fa4d347eba7b18f77137dbbf48/library/alloc/src/boxed.rs:2010:9
62: 0x7f861c3fd315 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h309fb4796a356ecf
at /rustc/e4cd1610067501fa4d347eba7b18f77137dbbf48/library/alloc/src/boxed.rs:2010:9
63: 0x7f861c3fd315 - std::sys::unix::thread::Thread::new::thread_start::h947cced02a86e329
at /rustc/e4cd1610067501fa4d347eba7b18f77137dbbf48/library/std/src/sys/unix/thread.rs:108:17
64: 0x7f8617e9d44b - <unknown>
65: 0x7f8617f20e40 - <unknown>
66: 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: rustc 1.72.0-nightly (e4cd16100 2023-07-05) running on x86_64-unknown-linux-gnu
note: compiler flags: -Z crate-attr=feature(effects)
query stack during panic:
#0 [typeck] type-checking `main`
#1 [used_trait_imports] finding used_trait_imports `main`
#2 [analysis] running analysis passes on this crate
end of query stack
Metadata
Metadata
Assignees
Labels
Category: This is a bug.Call for participation: An issue has been fixed and does not reproduce, but no test has been added.`#![feature(effects)]`Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Relevant to the compiler team, which will review and decide on the PR/issue.ICE tracked in rust-lang/glacier.This issue requires a nightly compiler in some way.