Open
Description
Code
#![feature(generic_const_exprs)]
trait Size<const N: usize> {}
impl<T: Sized> Size<{ std::mem::size_of::<T>() }> for T {}
struct A<T: Size<8> + ?Sized> {
x: std::marker::PhantomData<T>,
}
fn foo(x: A<dyn Send>) {}
Meta
rustc --version --verbose
:
rustc 1.77.0-nightly (e51e98dde 2023-12-31)
binary: rustc
commit-hash: e51e98dde6a60637b6a71b8105245b629ac3fe77
commit-date: 2023-12-31
host: x86_64-pc-windows-msvc
release: 1.77.0-nightly
LLVM version: 17.0.6
Error output
error: internal compiler error: compiler/rustc_const_eval/src/interpret/step.rs:243:21: SizeOf MIR operator called for unsized type dyn Send
--> /playground/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/mem/mod.rs:313:5
|
313 | intrinsics::size_of::<T>()
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
Backtrace
0: 0x7ffdf9ea2562 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hd9f0495ce3577601
1: 0x7ffdf9ed4f0d - core::fmt::write::h1651f903af9243c1
2: 0x7ffdf9e98c01 - <std::io::IoSlice as core::fmt::Debug>::fmt::hfa92d0bc09dd4184
3: 0x7ffdf9ea238a - std::sys_common::backtrace::lock::h9be8efca853d165b
4: 0x7ffdf9ea57c9 - std::panicking::default_hook::h96f2a92a023daa27
5: 0x7ffdf9ea5485 - std::panicking::default_hook::h96f2a92a023daa27
6: 0x7ffde64dafb3 - <tracing_subscriber[14c1e7092756c484]::fmt::format::Writer>::write_fmt
7: 0x7ffdf9ea5de3 - std::panicking::rust_panic_with_hook::h009ed3283678456b
8: 0x7ffde7a0e518 - <core[d2212746b813a43e]::num::error::ParseIntError as rustc_errors[5c14662b8b7fbf03]::diagnostic::IntoDiagnosticArg>::into_diagnostic_arg
9: 0x7ffde7a0bff9 - <core[d2212746b813a43e]::num::error::ParseIntError as rustc_errors[5c14662b8b7fbf03]::diagnostic::IntoDiagnosticArg>::into_diagnostic_arg
10: 0x7ffde7a2a089 - <std[730852cf645dce22]::io::error::Error as rustc_errors[5c14662b8b7fbf03]::diagnostic::IntoDiagnosticArg>::into_diagnostic_arg
11: 0x7ffde7a1c665 - <rustc_errors[5c14662b8b7fbf03]::diagnostic_builder::BugAbort as rustc_errors[5c14662b8b7fbf03]::diagnostic_builder::EmissionGuarantee>::emit_producing_guarantee
12: 0x7ffde6b4757a - rustc_const_eval[297f7e9abb32c936]::const_eval::try_destructure_mir_constant_for_user_output
13: 0x7ffde6b5f8fb - rustc_const_eval[297f7e9abb32c936]::interpret::validity::write_path
14: 0x7ffde6b5f92d - rustc_const_eval[297f7e9abb32c936]::interpret::validity::write_path
15: 0x7ffde6b5e83d - rustc_const_eval[297f7e9abb32c936]::interpret::validity::write_path
16: 0x7ffde6b5e7e6 - rustc_const_eval[297f7e9abb32c936]::interpret::validity::write_path
17: 0x7ffde58fdd31 - <rustc_const_eval[297f7e9abb32c936]::interpret::eval_context::InterpCx<_>>::storage_live_dyn::is_very_trivially_sized
18: 0x7ffde5979a68 - rustc_const_eval[297f7e9abb32c936]::const_eval::eval_queries::eval_in_interpreter
19: 0x7ffde598e124 - rustc_const_eval[297f7e9abb32c936]::const_eval::eval_queries::eval_to_allocation_raw_provider
20: 0x7ffde5db9f1e - rustc_query_impl[e3c2001bad08cba5]::query_callbacks
21: 0x7ffde5da059d - rustc_query_impl[e3c2001bad08cba5]::query_callbacks
22: 0x7ffde50c6607 - <dyn std[730852cf645dce22]::io::Write as nu_ansi_term[e0f75ef71d928792]::write::AnyWrite>::write_str
23: 0x7ffde502a143 - rustc_query_impl[e3c2001bad08cba5]::profiling_support::alloc_self_profile_query_strings
24: 0x7ffde5063a04 - rustc_query_impl[e3c2001bad08cba5]::profiling_support::alloc_self_profile_query_strings
25: 0x7ffde5033668 - rustc_query_impl[e3c2001bad08cba5]::profiling_support::alloc_self_profile_query_strings
26: 0x7ffde4dfb520 - rustc_const_eval[297f7e9abb32c936]::const_eval::eval_to_valtree
27: 0x7ffde2549287 - rustc_interface[6abecff7d50d037e]::util::build_output_filenames
28: 0x7ffde4fdfbfe - rustc_query_impl[e3c2001bad08cba5]::profiling_support::alloc_self_profile_query_strings
29: 0x7ffde4fbbe5d - rustc_query_impl[e3c2001bad08cba5]::dynamic_queries
30: 0x7ffde50c6607 - <dyn std[730852cf645dce22]::io::Write as nu_ansi_term[e0f75ef71d928792]::write::AnyWrite>::write_str
31: 0x7ffde502a143 - rustc_query_impl[e3c2001bad08cba5]::profiling_support::alloc_self_profile_query_strings
32: 0x7ffde5063a04 - rustc_query_impl[e3c2001bad08cba5]::profiling_support::alloc_self_profile_query_strings
33: 0x7ffde5033a28 - rustc_query_impl[e3c2001bad08cba5]::profiling_support::alloc_self_profile_query_strings
34: 0x7ffde536edbe - <rustc_middle[eb04d1653cc0e4c3]::ty::context::TyCtxt>::try_mark_green
35: 0x7ffde536ff4c - <rustc_middle[eb04d1653cc0e4c3]::ty::context::TyCtxt>::const_eval_global_id_for_typeck
36: 0x7ffde536f9e8 - <rustc_middle[eb04d1653cc0e4c3]::ty::context::TyCtxt>::const_eval_resolve_for_typeck
37: 0x7ffde738d93b - <rustc_infer[c375f6ba279e56a9]::infer::InferCtxt>::const_eval_resolve
38: 0x7ffde5106a2b - rustc_trait_selection[ee2937ac8adee46b]::traits::const_evaluatable::is_const_evaluatable
39: 0x7ffde5f2f24a - <rustc_trait_selection[ee2937ac8adee46b]::traits::fulfill::FulfillProcessor as rustc_data_structures[67a10d841874163e]::obligation_forest::ObligationProcessor>::process_obligation
40: 0x7ffde5fc200c - <rustc_trait_selection[ee2937ac8adee46b]::traits::select::SelectionContext>::poly_select
41: 0x7ffde5f3a813 - <rustc_trait_selection[ee2937ac8adee46b]::traits::engine::ObligationCtxt>::assumed_wf_types_and_report_errors
42: 0x7ffde4d4a0be - rustc_hir_analysis[1246969b18f73b83]::collect::is_type_alias_impl_trait
43: 0x7ffde57088ab - rustc_hir_analysis[1246969b18f73b83]::check::wfcheck::check_well_formed
44: 0x7ffde5db99cf - rustc_query_impl[e3c2001bad08cba5]::query_callbacks
45: 0x7ffde5e29eac - rustc_query_impl[e3c2001bad08cba5]::query_callbacks
46: 0x7ffde502ad71 - rustc_query_impl[e3c2001bad08cba5]::profiling_support::alloc_self_profile_query_strings
47: 0x7ffde5ec8730 - rustc_query_impl[e3c2001bad08cba5]::query_callbacks
48: 0x7ffde502ec15 - rustc_query_impl[e3c2001bad08cba5]::profiling_support::alloc_self_profile_query_strings
49: 0x7ffde568f08a - rustc_privacy[c065fe17ce2a6eaa]::check_private_in_public
50: 0x7ffde4d4a888 - rustc_hir_analysis[1246969b18f73b83]::check::wfcheck::check_mod_type_wf
51: 0x7ffde4fe088f - rustc_query_impl[e3c2001bad08cba5]::profiling_support::alloc_self_profile_query_strings
52: 0x7ffde501263f - rustc_query_impl[e3c2001bad08cba5]::profiling_support::alloc_self_profile_query_strings
53: 0x7ffde502ad71 - rustc_query_impl[e3c2001bad08cba5]::profiling_support::alloc_self_profile_query_strings
54: 0x7ffde506df03 - rustc_query_impl[e3c2001bad08cba5]::profiling_support::alloc_self_profile_query_strings
55: 0x7ffde5026d96 - rustc_query_impl[e3c2001bad08cba5]::profiling_support::alloc_self_profile_query_strings
56: 0x7ffde4d1b322 - rustc_privacy[c065fe17ce2a6eaa]::effective_visibilities
57: 0x7ffde4d2198b - <rustc_hir_analysis[1246969b18f73b83]::collect::resolve_bound_vars::BoundVarContext as rustc_hir[f46f4267cc7d748c]::intravisit::Visitor>::visit_trait_item
58: 0x7ffde569e28c - rustc_hir_analysis[1246969b18f73b83]::check_crate
59: 0x7ffde543f54a - rustc_interface[6abecff7d50d037e]::passes::analysis
60: 0x7ffde4fe2d9d - rustc_query_impl[e3c2001bad08cba5]::profiling_support::alloc_self_profile_query_strings
61: 0x7ffde500b6a9 - rustc_query_impl[e3c2001bad08cba5]::profiling_support::alloc_self_profile_query_strings
62: 0x7ffde5029da8 - rustc_query_impl[e3c2001bad08cba5]::profiling_support::alloc_self_profile_query_strings
63: 0x7ffde5048c87 - rustc_query_impl[e3c2001bad08cba5]::profiling_support::alloc_self_profile_query_strings
64: 0x7ffde502cfb3 - rustc_query_impl[e3c2001bad08cba5]::profiling_support::alloc_self_profile_query_strings
65: 0x7ffde2522aad - rustc_driver_impl[7ec6dca3f9a48c3f]::args::arg_expand_all
66: 0x7ffde24e9369 - rustc_driver_impl[7ec6dca3f9a48c3f]::args::arg_expand_all
67: 0x7ffde24e2f65 - rustc_driver_impl[7ec6dca3f9a48c3f]::args::arg_expand_all
68: 0x7ffde25238bf - rustc_driver_impl[7ec6dca3f9a48c3f]::args::arg_expand_all
69: 0x7ffde24e3aa1 - rustc_driver_impl[7ec6dca3f9a48c3f]::args::arg_expand_all
70: 0x7ffde24d96af - rustc_driver_impl[7ec6dca3f9a48c3f]::main
71: 0x7ffde2526178 - rustc_driver_impl[7ec6dca3f9a48c3f]::args::arg_expand_all
72: 0x7ffdf9eb814c - std::sys::windows::thread::Thread::new::h28605654e9d1749a
73: 0x7ffe7cc3257d - BaseThreadInitThunk
74: 0x7ffe7e6aaa58 - RtlUserThreadStart
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 attach the file at `E:\code\rust_demo\rustc-ice-2024-01-08T05_29_24-20344.txt` to your bug report
note: compiler flags: --crate-type bin -C embed-bitcode=no -C debuginfo=2 -C incremental=[REDACTED]
note: some of the compiler flags provided by cargo are hidden
query stack during panic:
#0 [eval_to_allocation_raw] const-evaluating + checking `<impl at src\main.rs:5:1: 5:56>::{constant#0}`
#1 [eval_to_valtree] evaluating type-level constant
#2 [check_well_formed] checking that `foo` is well-formed
#3 [check_mod_type_wf] checking that types are well-formed in top-level module
#4 [analysis] running analysis passes on this crate
end of query stack