Open
Description
auto-reduced (treereduce-rust):
//@compile-flags: --edition=2024
#![feature(generic_const_exprs)]
use core::fmt::Debug;
struct Inline<T>
where
[(); std::mem::offset_of!((T,), 0)]:,
{
let foo: (),
}
fn main() {
let dst = Inline::<dyn Debug>::new(0); // BANG!
}
original:
#![feature(generic_const_exprs)]
use core::fmt::Debug;
struct Inline<T>
where
[(); std::mem::offset_of!((T,), 0)]:,
{
let foo: (),
//~^ ERROR expected identifier, found keyword `let`
}
fn main() {
let dst = Inline::<dyn Debug>::new(0); // BANG!
}
Version information
rustc 1.86.0-nightly (2f348cb7c 2025-01-27)
binary: rustc
commit-hash: 2f348cb7ce4063fa4eb40038e6ada3c5214717bd
commit-date: 2025-01-27
host: x86_64-unknown-linux-gnu
release: 1.86.0-nightly
LLVM version: 19.1.7
Command:
/home/matthias/.rustup/toolchains/master/bin/rustc --edition=2024
Program output
error: expected identifier, found keyword `let`
--> /tmp/icemaker_global_tempdir.ss1hYVHGdMgO/rustc_testrunner_tmpdir_reporting.pEd6k8w10N6f/mvce.rs:9:5
|
9 | let foo: (),
| ^^^-
| |
| expected identifier, found keyword
| help: remove this `let` keyword
|
= note: the `let` keyword is not allowed in `struct` fields
= note: see <https://doc.rust-lang.org/book/ch05-01-defining-structs.html> for more information
warning: the feature `generic_const_exprs` is incomplete and may not be safe to use and/or cause compiler crashes
--> /tmp/icemaker_global_tempdir.ss1hYVHGdMgO/rustc_testrunner_tmpdir_reporting.pEd6k8w10N6f/mvce.rs:1:12
|
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[E0392]: type parameter `T` is never used
--> /tmp/icemaker_global_tempdir.ss1hYVHGdMgO/rustc_testrunner_tmpdir_reporting.pEd6k8w10N6f/mvce.rs:5:15
|
5 | struct Inline<T>
| ^ unused type parameter
|
= help: consider removing `T`, referring to it in a field, or using a marker such as `PhantomData`
= help: if you intended `T` to be a const parameter, use `const T: /* Type */` instead
error[E0599]: no function or associated item named `new` found for struct `Inline` in the current scope
--> /tmp/icemaker_global_tempdir.ss1hYVHGdMgO/rustc_testrunner_tmpdir_reporting.pEd6k8w10N6f/mvce.rs:14:36
|
5 | struct Inline<T>
| ---------------- function or associated item `new` not found for this struct
...
14 | let dst = Inline::<dyn Debug>::new(0); // BANG!
| ^^^ function or associated item not found in `Inline<dyn Debug>`
error: internal compiler error: /rustc/2f348cb7ce4063fa4eb40038e6ada3c5214717bd/compiler/rustc_middle/src/ty/layout.rs:1397:21: offset of not-statically-aligned field (type dyn [Binder { value: Trait(std::fmt::Debug), bound_vars: [] }] + '{erased}) cannot be computed statically
thread 'rustc' panicked at /rustc/2f348cb7ce4063fa4eb40038e6ada3c5214717bd/compiler/rustc_middle/src/ty/layout.rs:1397:21:
Box<dyn Any>
stack backtrace:
0: 0x7e903a3aae40 - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::he98e11da2daa96a9
1: 0x7e903ac14ee6 - core::fmt::write::had177877e89931fb
2: 0x7e903bb50b51 - std::io::Write::write_fmt::hc355e6fef9c0a3ce
3: 0x7e903a3aaca2 - std::sys::backtrace::BacktraceLock::print::h676c1f81be95e0b1
4: 0x7e903a3ad122 - std::panicking::default_hook::{{closure}}::hd28d3669866dc126
5: 0x7e903a3acfaa - std::panicking::default_hook::h039746809c2c5ae1
6: 0x7e903955ff39 - std[644fad426ed526f7]::panicking::update_hook::<alloc[5097d557d6b96634]::boxed::Box<rustc_driver_impl[438371d8e84705cb]::install_ice_hook::{closure#1}>>::{closure#0}
7: 0x7e903a3adc63 - std::panicking::rust_panic_with_hook::h88108df39d1d1441
8: 0x7e903959b421 - std[644fad426ed526f7]::panicking::begin_panic::<rustc_errors[d6afe1f3c80315c7]::ExplicitBug>::{closure#0}
9: 0x7e9039590326 - std[644fad426ed526f7]::sys::backtrace::__rust_end_short_backtrace::<std[644fad426ed526f7]::panicking::begin_panic<rustc_errors[d6afe1f3c80315c7]::ExplicitBug>::{closure#0}, !>
10: 0x7e903958d05d - std[644fad426ed526f7]::panicking::begin_panic::<rustc_errors[d6afe1f3c80315c7]::ExplicitBug>
11: 0x7e90395a5351 - <rustc_errors[d6afe1f3c80315c7]::diagnostic::BugAbort as rustc_errors[d6afe1f3c80315c7]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
12: 0x7e9039b867f3 - rustc_middle[dfbbc45bb841e134]::util::bug::opt_span_bug_fmt::<rustc_span[45d362c5296a3b7f]::span_encoding::Span>::{closure#0}
13: 0x7e9039b6f7aa - rustc_middle[dfbbc45bb841e134]::ty::context::tls::with_opt::<rustc_middle[dfbbc45bb841e134]::util::bug::opt_span_bug_fmt<rustc_span[45d362c5296a3b7f]::span_encoding::Span>::{closure#0}, !>::{closure#0}
14: 0x7e9039b6f63b - rustc_middle[dfbbc45bb841e134]::ty::context::tls::with_context_opt::<rustc_middle[dfbbc45bb841e134]::ty::context::tls::with_opt<rustc_middle[dfbbc45bb841e134]::util::bug::opt_span_bug_fmt<rustc_span[45d362c5296a3b7f]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
15: 0x7e9037de19a0 - rustc_middle[dfbbc45bb841e134]::util::bug::bug_fmt
16: 0x7e903b7a4bb5 - <rustc_const_eval[4c73f18587537670]::interpret::eval_context::InterpCx<rustc_const_eval[4c73f18587537670]::const_eval::machine::CompileTimeMachine>>::eval_rvalue_into_place
17: 0x7e90385dce39 - rustc_const_eval[4c73f18587537670]::const_eval::eval_queries::eval_to_allocation_raw_provider
18: 0x7e903b412e9c - rustc_query_impl[9923fb681be542d6]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[9923fb681be542d6]::query_impl::eval_to_allocation_raw::dynamic_query::{closure#2}::{closure#0}, rustc_middle[dfbbc45bb841e134]::query::erase::Erased<[u8; 24usize]>>
19: 0x7e903b41283a - rustc_query_system[ea81b1814f2bc579]::query::plumbing::try_execute_query::<rustc_query_impl[9923fb681be542d6]::DynamicConfig<rustc_query_system[ea81b1814f2bc579]::query::caches::DefaultCache<rustc_middle[dfbbc45bb841e134]::ty::PseudoCanonicalInput<rustc_middle[dfbbc45bb841e134]::mir::interpret::GlobalId>, rustc_middle[dfbbc45bb841e134]::query::erase::Erased<[u8; 24usize]>>, false, false, false>, rustc_query_impl[9923fb681be542d6]::plumbing::QueryCtxt, false>
20: 0x7e903b4124bb - rustc_query_impl[9923fb681be542d6]::query_impl::eval_to_allocation_raw::get_query_non_incr::__rust_end_short_backtrace
21: 0x7e903b419d65 - rustc_const_eval[4c73f18587537670]::const_eval::valtrees::eval_to_valtree
22: 0x7e903b419b1c - <rustc_const_eval[4c73f18587537670]::provide::{closure#0} as core[d2a938784d8f7dcb]::ops::function::FnOnce<(rustc_middle[dfbbc45bb841e134]::ty::context::TyCtxt, rustc_middle[dfbbc45bb841e134]::ty::PseudoCanonicalInput<rustc_middle[dfbbc45bb841e134]::mir::interpret::GlobalId>)>>::call_once
23: 0x7e903b419ac6 - rustc_query_impl[9923fb681be542d6]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[9923fb681be542d6]::query_impl::eval_to_valtree::dynamic_query::{closure#2}::{closure#0}, rustc_middle[dfbbc45bb841e134]::query::erase::Erased<[u8; 24usize]>>
24: 0x7e903b419a7f - <rustc_query_impl[9923fb681be542d6]::query_impl::eval_to_valtree::dynamic_query::{closure#2} as core[d2a938784d8f7dcb]::ops::function::FnOnce<(rustc_middle[dfbbc45bb841e134]::ty::context::TyCtxt, rustc_middle[dfbbc45bb841e134]::ty::PseudoCanonicalInput<rustc_middle[dfbbc45bb841e134]::mir::interpret::GlobalId>)>>::call_once
25: 0x7e903b412913 - rustc_query_system[ea81b1814f2bc579]::query::plumbing::try_execute_query::<rustc_query_impl[9923fb681be542d6]::DynamicConfig<rustc_query_system[ea81b1814f2bc579]::query::caches::DefaultCache<rustc_middle[dfbbc45bb841e134]::ty::PseudoCanonicalInput<rustc_middle[dfbbc45bb841e134]::mir::interpret::GlobalId>, rustc_middle[dfbbc45bb841e134]::query::erase::Erased<[u8; 24usize]>>, false, false, false>, rustc_query_impl[9923fb681be542d6]::plumbing::QueryCtxt, false>
26: 0x7e903b41222d - rustc_query_impl[9923fb681be542d6]::query_impl::eval_to_valtree::get_query_non_incr::__rust_end_short_backtrace
27: 0x7e903b7d390c - rustc_middle[dfbbc45bb841e134]::query::plumbing::query_get_at::<rustc_query_system[ea81b1814f2bc579]::query::caches::DefaultCache<rustc_middle[dfbbc45bb841e134]::ty::PseudoCanonicalInput<rustc_middle[dfbbc45bb841e134]::mir::interpret::GlobalId>, rustc_middle[dfbbc45bb841e134]::query::erase::Erased<[u8; 24usize]>>>
28: 0x7e903b7d2f22 - <rustc_middle[dfbbc45bb841e134]::ty::context::TyCtxt>::const_eval_global_id_for_typeck
29: 0x7e903b7d2db9 - <rustc_middle[dfbbc45bb841e134]::ty::context::TyCtxt>::const_eval_resolve_for_typeck
30: 0x7e903b7d2af7 - rustc_trait_selection[a0c4a4c304b8efe3]::traits::try_evaluate_const
31: 0x7e903c894ef8 - rustc_trait_selection[a0c4a4c304b8efe3]::traits::const_evaluatable::is_const_evaluatable.cold
32: 0x7e903b4ee30f - <rustc_trait_selection[a0c4a4c304b8efe3]::traits::fulfill::FulfillProcessor as rustc_data_structures[702a32bac37c74a0]::obligation_forest::ObligationProcessor>::process_obligation
33: 0x7e903ac10642 - <rustc_data_structures[702a32bac37c74a0]::obligation_forest::ObligationForest<rustc_trait_selection[a0c4a4c304b8efe3]::traits::fulfill::PendingPredicateObligation>>::process_obligations::<rustc_trait_selection[a0c4a4c304b8efe3]::traits::fulfill::FulfillProcessor>
34: 0x7e903ad69f6a - <rustc_hir_typeck[711cb0c541d6273d]::fn_ctxt::FnCtxt>::try_structurally_resolve_type
35: 0x7e903b9899fd - <rustc_hir_typeck[711cb0c541d6273d]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
36: 0x7e903ad7b371 - <rustc_hir_typeck[711cb0c541d6273d]::fn_ctxt::FnCtxt>::confirm_builtin_call
37: 0x7e903b98b526 - <rustc_hir_typeck[711cb0c541d6273d]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
38: 0x7e903b9885e7 - <rustc_hir_typeck[711cb0c541d6273d]::fn_ctxt::FnCtxt>::check_decl
39: 0x7e903b9856cd - <rustc_hir_typeck[711cb0c541d6273d]::fn_ctxt::FnCtxt>::check_expr_block
40: 0x7e903b98c03e - <rustc_hir_typeck[711cb0c541d6273d]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
41: 0x7e903b240d00 - rustc_hir_typeck[711cb0c541d6273d]::check::check_fn
42: 0x7e903b249b7d - rustc_hir_typeck[711cb0c541d6273d]::typeck_with_inspect::{closure#0}
43: 0x7e903b247b8c - rustc_query_impl[9923fb681be542d6]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[9923fb681be542d6]::query_impl::typeck::dynamic_query::{closure#2}::{closure#0}, rustc_middle[dfbbc45bb841e134]::query::erase::Erased<[u8; 8usize]>>
44: 0x7e903af996ce - rustc_query_system[ea81b1814f2bc579]::query::plumbing::try_execute_query::<rustc_query_impl[9923fb681be542d6]::DynamicConfig<rustc_data_structures[702a32bac37c74a0]::vec_cache::VecCache<rustc_span[45d362c5296a3b7f]::def_id::LocalDefId, rustc_middle[dfbbc45bb841e134]::query::erase::Erased<[u8; 8usize]>, rustc_query_system[ea81b1814f2bc579]::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl[9923fb681be542d6]::plumbing::QueryCtxt, false>
45: 0x7e903af97bd1 - rustc_query_impl[9923fb681be542d6]::query_impl::typeck::get_query_non_incr::__rust_end_short_backtrace
46: 0x7e903af9788b - <rustc_middle[dfbbc45bb841e134]::hir::map::Map>::par_body_owners::<rustc_hir_analysis[679b9e311f2f4bbc]::check_crate::{closure#4}>::{closure#0}
47: 0x7e903af9593f - rustc_hir_analysis[679b9e311f2f4bbc]::check_crate
48: 0x7e903af91f62 - rustc_interface[68fc4f7f4eaa26cf]::passes::run_required_analyses
49: 0x7e903bb4c25e - rustc_interface[68fc4f7f4eaa26cf]::passes::analysis
50: 0x7e903bb4c22f - rustc_query_impl[9923fb681be542d6]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[9923fb681be542d6]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[dfbbc45bb841e134]::query::erase::Erased<[u8; 0usize]>>
51: 0x7e903bb29855 - rustc_query_system[ea81b1814f2bc579]::query::plumbing::try_execute_query::<rustc_query_impl[9923fb681be542d6]::DynamicConfig<rustc_query_system[ea81b1814f2bc579]::query::caches::SingleCache<rustc_middle[dfbbc45bb841e134]::query::erase::Erased<[u8; 0usize]>>, false, false, false>, rustc_query_impl[9923fb681be542d6]::plumbing::QueryCtxt, false>
52: 0x7e903bb2958e - rustc_query_impl[9923fb681be542d6]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
53: 0x7e903bb65169 - rustc_interface[68fc4f7f4eaa26cf]::passes::create_and_enter_global_ctxt::<core[d2a938784d8f7dcb]::option::Option<rustc_interface[68fc4f7f4eaa26cf]::queries::Linker>, rustc_driver_impl[438371d8e84705cb]::run_compiler::{closure#0}::{closure#2}>::{closure#2}::{closure#0}
54: 0x7e903bba250a - rustc_interface[68fc4f7f4eaa26cf]::interface::run_compiler::<(), rustc_driver_impl[438371d8e84705cb]::run_compiler::{closure#0}>::{closure#1}
55: 0x7e903ba8a875 - std[644fad426ed526f7]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[68fc4f7f4eaa26cf]::util::run_in_thread_with_globals<rustc_interface[68fc4f7f4eaa26cf]::util::run_in_thread_pool_with_globals<rustc_interface[68fc4f7f4eaa26cf]::interface::run_compiler<(), rustc_driver_impl[438371d8e84705cb]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
56: 0x7e903ba8a559 - <<std[644fad426ed526f7]::thread::Builder>::spawn_unchecked_<rustc_interface[68fc4f7f4eaa26cf]::util::run_in_thread_with_globals<rustc_interface[68fc4f7f4eaa26cf]::util::run_in_thread_pool_with_globals<rustc_interface[68fc4f7f4eaa26cf]::interface::run_compiler<(), rustc_driver_impl[438371d8e84705cb]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[d2a938784d8f7dcb]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
57: 0x7e903ba89ceb - std::sys::pal::unix::thread::Thread::new::thread_start::h6b29fca7c6a267b7
58: 0x7e9035ca339d - <unknown>
59: 0x7e9035d2849c - <unknown>
60: 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: please make sure that you have updated to the latest nightly
note: rustc 1.86.0-nightly (2f348cb7c 2025-01-27) running on x86_64-unknown-linux-gnu
note: compiler flags: -Z dump-mir-dir=dir
query stack during panic:
#0 [eval_to_allocation_raw] const-evaluating + checking `Inline::{constant#0}`
#1 [eval_to_valtree] evaluating type-level constant
#2 [typeck] type-checking `main`
#3 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 4 previous errors; 1 warning emitted
Some errors have detailed explanations: E0392, E0599.
For more information about an error, try `rustc --explain E0392`.
@rustbot label +F-generic_const_exprs
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.Status: A Minimal Complete and Verifiable Example has been found for this issueRelevant to the compiler team, which will review and decide on the PR/issue.This issue requires the use of incomplete features.