Skip to content

Rustc crashes at compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs:2156:17 #136139

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

Open
wangbo15 opened this issue Jan 27, 2025 · 1 comment
Labels
C-bug Category: This is a bug. F-min_generic_const_args `#![feature(min_generic_const_args)]` I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@wangbo15
Copy link

Code

Maybe related to #136138. Similarly, if we remove the first line #!feature(min_generic_const_args)], the panic disappears.
However, the stack trace is totally different.

#![feature(min_generic_const_args)]
static A: u32 = 0;
struct Foo<const N: u32>;
const B: Foo<{ A }> = Foo;
fn main() {}

Meta

rustc --version --verbose:

rustc 1.86.0-nightly (f85c6de55 2025-01-26)
binary: rustc
commit-hash: f85c6de55206dbee5ffedfd821df1503a7b92346
commit-date: 2025-01-26
host: x86_64-unknown-linux-gnu
release: 1.86.0-nightly
LLVM version: 19.1.7

Error output

warning: the feature `min_generic_const_args` is incomplete and may not be safe to use and/or cause compiler crashes
 --> 2.rs:1:12
  |
1 | #![feature(min_generic_const_args)]
  |            ^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: see issue #132980 <https://github.com/rust-lang/rust/issues/132980> for more information
  = note: `#[warn(incomplete_features)]` on by default

error: internal compiler error: compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs:2156:17: use of bare `static` ConstArgKind::Path's not yet supported
 --> 2.rs:4:16
  |
4 | const B: Foo<{ A }> = Foo;
  |                ^


thread 'rustc' panicked at compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs:2156:17:
Box<dyn Any>
stack backtrace:
   0:     0x7fe42260a210 - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::hec9bc6463e252640
   1:     0x7fe422e7aee6 - core::fmt::write::h962cad0079919c7e
   2:     0x7fe423d78c51 - std::io::Write::write_fmt::h081e59591f35f868
   3:     0x7fe42260a072 - std::sys::backtrace::BacktraceLock::print::he0deffbd85e9a2c5
   4:     0x7fe42260c4f2 - std::panicking::default_hook::{{closure}}::h99776b3a5456e866
   5:     0x7fe42260c37a - std::panicking::default_hook::hcad38b9ed4b5517d
   6:     0x7fe4217c1279 - std[cc940dec3ff43b12]::panicking::update_hook::<alloc[5f7a888829935c2b]::boxed::Box<rustc_driver_impl[af2bdb3744899392]::install_ice_hook::{closure#1}>>::{closure#0}
   7:     0x7fe42260d073 - std::panicking::rust_panic_with_hook::hbfeeff1ab3569ba1
   8:     0x7fe4217fbf41 - std[cc940dec3ff43b12]::panicking::begin_panic::<rustc_errors[b2f066873e334d61]::ExplicitBug>::{closure#0}
   9:     0x7fe4217f0e46 - std[cc940dec3ff43b12]::sys::backtrace::__rust_end_short_backtrace::<std[cc940dec3ff43b12]::panicking::begin_panic<rustc_errors[b2f066873e334d61]::ExplicitBug>::{closure#0}, !>
  10:     0x7fe4217f0e33 - std[cc940dec3ff43b12]::panicking::begin_panic::<rustc_errors[b2f066873e334d61]::ExplicitBug>
  11:     0x7fe421805e71 - <rustc_errors[b2f066873e334d61]::diagnostic::BugAbort as rustc_errors[b2f066873e334d61]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
  12:     0x7fe421d63bdc - <rustc_errors[b2f066873e334d61]::DiagCtxtHandle>::span_bug::<rustc_span[d5a27b28009c9e0]::span_encoding::Span, alloc[5f7a888829935c2b]::string::String>
  13:     0x7fe421de62d7 - rustc_middle[ea35cf57050946b4]::util::bug::opt_span_bug_fmt::<rustc_span[d5a27b28009c9e0]::span_encoding::Span>::{closure#0}
  14:     0x7fe421dcf34a - rustc_middle[ea35cf57050946b4]::ty::context::tls::with_opt::<rustc_middle[ea35cf57050946b4]::util::bug::opt_span_bug_fmt<rustc_span[d5a27b28009c9e0]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  15:     0x7fe421dcf1db - rustc_middle[ea35cf57050946b4]::ty::context::tls::with_context_opt::<rustc_middle[ea35cf57050946b4]::ty::context::tls::with_opt<rustc_middle[ea35cf57050946b4]::util::bug::opt_span_bug_fmt<rustc_span[d5a27b28009c9e0]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  16:     0x7fe42080d097 - rustc_middle[ea35cf57050946b4]::util::bug::span_bug_fmt::<rustc_span[d5a27b28009c9e0]::span_encoding::Span>
  17:     0x7fe4248251c9 - <dyn rustc_hir_analysis[ce12ae6d63b57b8a]::hir_ty_lowering::HirTyLowerer>::lower_const_arg.cold
  18:     0x7fe4237fafc6 - <dyn rustc_hir_analysis[ce12ae6d63b57b8a]::hir_ty_lowering::HirTyLowerer>::lower_path
  19:     0x7fe4237f56e0 - <dyn rustc_hir_analysis[ce12ae6d63b57b8a]::hir_ty_lowering::HirTyLowerer>::lower_ty
  20:     0x7fe42319cefe - rustc_hir_analysis[ce12ae6d63b57b8a]::collect::type_of::type_of
  21:     0x7fe4231985fe - rustc_query_impl[52b9445d4dcf70be]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[52b9445d4dcf70be]::query_impl::type_of::dynamic_query::{closure#2}::{closure#0}, rustc_middle[ea35cf57050946b4]::query::erase::Erased<[u8; 8usize]>>
  22:     0x7fe42319739f - rustc_query_system[b5c6449b7ccd2566]::query::plumbing::try_execute_query::<rustc_query_impl[52b9445d4dcf70be]::DynamicConfig<rustc_query_system[b5c6449b7ccd2566]::query::caches::DefIdCache<rustc_middle[ea35cf57050946b4]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[52b9445d4dcf70be]::plumbing::QueryCtxt, false>
  23:     0x7fe423196f2b - rustc_query_impl[52b9445d4dcf70be]::query_impl::type_of::get_query_non_incr::__rust_end_short_backtrace
  24:     0x7fe4234939a3 - <rustc_hir_analysis[ce12ae6d63b57b8a]::collect::CollectItemTypesVisitor as rustc_hir[2d8a80fbfdaaf69c]::intravisit::Visitor>::visit_item
  25:     0x7fe42349c42d - rustc_hir_analysis[ce12ae6d63b57b8a]::check::wfcheck::check_well_formed
  26:     0x7fe42349c247 - rustc_query_impl[52b9445d4dcf70be]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[52b9445d4dcf70be]::query_impl::check_well_formed::dynamic_query::{closure#2}::{closure#0}, rustc_middle[ea35cf57050946b4]::query::erase::Erased<[u8; 1usize]>>
  27:     0x7fe42349bce9 - rustc_query_system[b5c6449b7ccd2566]::query::plumbing::try_execute_query::<rustc_query_impl[52b9445d4dcf70be]::DynamicConfig<rustc_data_structures[aef26e4d10f0fc6d]::vec_cache::VecCache<rustc_span[d5a27b28009c9e0]::def_id::LocalDefId, rustc_middle[ea35cf57050946b4]::query::erase::Erased<[u8; 1usize]>, rustc_query_system[b5c6449b7ccd2566]::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl[52b9445d4dcf70be]::plumbing::QueryCtxt, false>
  28:     0x7fe42349b746 - rustc_query_impl[52b9445d4dcf70be]::query_impl::check_well_formed::get_query_non_incr::__rust_end_short_backtrace
  29:     0x7fe42349936c - rustc_hir_analysis[ce12ae6d63b57b8a]::check::wfcheck::check_mod_type_wf
  30:     0x7fe42349918b - rustc_query_impl[52b9445d4dcf70be]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[52b9445d4dcf70be]::query_impl::check_mod_type_wf::dynamic_query::{closure#2}::{closure#0}, rustc_middle[ea35cf57050946b4]::query::erase::Erased<[u8; 1usize]>>
  31:     0x7fe423d80ac8 - rustc_query_system[b5c6449b7ccd2566]::query::plumbing::try_execute_query::<rustc_query_impl[52b9445d4dcf70be]::DynamicConfig<rustc_query_system[b5c6449b7ccd2566]::query::caches::DefaultCache<rustc_span[d5a27b28009c9e0]::def_id::LocalModDefId, rustc_middle[ea35cf57050946b4]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[52b9445d4dcf70be]::plumbing::QueryCtxt, false>
  32:     0x7fe423d80870 - rustc_query_impl[52b9445d4dcf70be]::query_impl::check_mod_type_wf::get_query_non_incr::__rust_end_short_backtrace
  33:     0x7fe4232051e6 - rustc_hir_analysis[ce12ae6d63b57b8a]::check_crate
  34:     0x7fe423201aa2 - rustc_interface[d0d5d02e7a56d74f]::passes::run_required_analyses
  35:     0x7fe423d7435e - rustc_interface[d0d5d02e7a56d74f]::passes::analysis
  36:     0x7fe423d7432f - rustc_query_impl[52b9445d4dcf70be]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[52b9445d4dcf70be]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[ea35cf57050946b4]::query::erase::Erased<[u8; 0usize]>>
  37:     0x7fe423d61315 - rustc_query_system[b5c6449b7ccd2566]::query::plumbing::try_execute_query::<rustc_query_impl[52b9445d4dcf70be]::DynamicConfig<rustc_query_system[b5c6449b7ccd2566]::query::caches::SingleCache<rustc_middle[ea35cf57050946b4]::query::erase::Erased<[u8; 0usize]>>, false, false, false>, rustc_query_impl[52b9445d4dcf70be]::plumbing::QueryCtxt, false>
  38:     0x7fe423d6104e - rustc_query_impl[52b9445d4dcf70be]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  39:     0x7fe423d87429 - rustc_interface[d0d5d02e7a56d74f]::passes::create_and_enter_global_ctxt::<core[c1de5c9ad145c0db]::option::Option<rustc_interface[d0d5d02e7a56d74f]::queries::Linker>, rustc_driver_impl[af2bdb3744899392]::run_compiler::{closure#0}::{closure#2}>::{closure#2}::{closure#0}
  40:     0x7fe423dd2213 - rustc_interface[d0d5d02e7a56d74f]::interface::run_compiler::<(), rustc_driver_impl[af2bdb3744899392]::run_compiler::{closure#0}>::{closure#1}
  41:     0x7fe423cceeb5 - std[cc940dec3ff43b12]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[d0d5d02e7a56d74f]::util::run_in_thread_with_globals<rustc_interface[d0d5d02e7a56d74f]::util::run_in_thread_pool_with_globals<rustc_interface[d0d5d02e7a56d74f]::interface::run_compiler<(), rustc_driver_impl[af2bdb3744899392]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
  42:     0x7fe423cceb99 - <<std[cc940dec3ff43b12]::thread::Builder>::spawn_unchecked_<rustc_interface[d0d5d02e7a56d74f]::util::run_in_thread_with_globals<rustc_interface[d0d5d02e7a56d74f]::util::run_in_thread_pool_with_globals<rustc_interface[d0d5d02e7a56d74f]::interface::run_compiler<(), rustc_driver_impl[af2bdb3744899392]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[c1de5c9ad145c0db]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  43:     0x7fe423cce32b - std::sys::pal::unix::thread::Thread::new::thread_start::hb22e947f5885a296
  44:     0x7fe41e024609 - start_thread
                               at /build/glibc-LcI20x/glibc-2.31/nptl/pthread_create.c:477:8
  45:     0x7fe41df49353 - clone
                               at /build/glibc-LcI20x/glibc-2.31/misc/../sysdeps/unix/sysv/linux/x86_64/clone.S:95:0
  46:                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: please attach the file at `/home/nightwish/workspace/compiler/rust_test/2025-01-23/rustc-ice-2025-01-27T15_11_58-25723.txt` to your bug report

query stack during panic:
#0 [type_of] computing type of `B`
#1 [check_well_formed] checking that `B` is well-formed
... and 2 other queries... use `env RUST_BACKTRACE=1` to see the full query stack
error: aborting due to 1 previous error; 1 warning emitted
Backtrace

<backtrace>

@wangbo15 wangbo15 added C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jan 27, 2025
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Jan 27, 2025
@fmease fmease added F-min_generic_const_args `#![feature(min_generic_const_args)]` and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Jan 27, 2025
@cyrgani
Copy link
Contributor

cyrgani commented Jan 27, 2025

Also tracked in #132986.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. F-min_generic_const_args `#![feature(min_generic_const_args)]` I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

4 participants