Skip to content

ICE: [DefId for associated constant] does not have a "fn_sig" #104412

Closed
@jruderman

Description

@jruderman
Contributor

Found with a modified fuzz-rustc

Code

fn main() {
    1_u32.MAX();
}

Error output

thread 'rustc' panicked at 'DefId(2:32120 ~ core[0cc5]::num::{impl#9}::MAX) does not have a "fn_sig"', compiler/rustc_metadata/src/rmeta/decoder/cstore_impl.rs:189:1
Backtrace
stack backtrace:
   0:        0x1036f7c82 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hf06ce51d4d0caeb3
   1:        0x10375625a - core::fmt::write::h2fc005258d9a8ed2
   2:        0x1036e9d6c - std::io::Write::write_fmt::hdbd5bccaa65ba11b
   3:        0x1036f7a4a - std::sys_common::backtrace::print::hef8818c42d61fbbb
   4:        0x1036fad76 - std::panicking::default_hook::{{closure}}::hd0e94b659436916f
   5:        0x1036faac7 - std::panicking::default_hook::h1aef959ba7055d49
   6:        0x110ff14bd - rustc_driver[8881936ad1b6e06a]::DEFAULT_HOOK::{closure#0}::{closure#0}
   7:        0x1036fb55d - std::panicking::rust_panic_with_hook::hc1c67b2c5cfce433
   8:        0x1036fb303 - std::panicking::begin_panic_handler::{{closure}}::h2bbf368a3906c7d7
   9:        0x1036f8118 - std::sys_common::backtrace::__rust_end_short_backtrace::h9664f990656d8ac1
  10:        0x1036fafcd - _rust_begin_unwind
  11:        0x103782dc3 - core::panicking::panic_fmt::hd6a6b49e69bb3046
  12:        0x114f9ab18 - rustc_metadata[ac9e46248090fca2]::rmeta::decoder::cstore_impl::provide_extern::fn_sig::{closure#1}
  13:        0x114f9a994 - rustc_metadata[ac9e46248090fca2]::rmeta::decoder::cstore_impl::provide_extern::fn_sig
  14:        0x1147e2700 - rustc_query_system[85e239b639d7ba03]::query::plumbing::try_execute_query::<rustc_query_impl[67024637593c284e]::plumbing::QueryCtxt, rustc_query_system[85e239b639d7ba03]::query::caches::DefaultCache<rustc_span[f624a31b590b36d5]::def_id::DefId, rustc_middle[d1c654abd0283759]::ty::sty::Binder<rustc_middle[d1c654abd0283759]::ty::sty::FnSig>>>
  15:        0x1148bd4fc - rustc_query_system[85e239b639d7ba03]::query::plumbing::get_query::<rustc_query_impl[67024637593c284e]::queries::fn_sig, rustc_query_impl[67024637593c284e]::plumbing::QueryCtxt>
  16:        0x114965375 - <rustc_query_impl[67024637593c284e]::Queries as rustc_middle[d1c654abd0283759]::ty::query::QueryEngine>::fn_sig
  17:        0x1137d2d7d - <rustc_hir_typeck[9f32b647479e411]::fn_ctxt::FnCtxt>::report_method_error
  18:        0x113802523 - <rustc_hir_typeck[9f32b647479e411]::fn_ctxt::FnCtxt>::check_expr_kind
  19:        0x1137a8ee0 - <rustc_hir_typeck[9f32b647479e411]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  20:        0x1137be9b5 - <rustc_hir_typeck[9f32b647479e411]::fn_ctxt::FnCtxt>::check_stmt
  21:        0x1137bf12f - <rustc_hir_typeck[9f32b647479e411]::fn_ctxt::FnCtxt>::check_block_with_expected
  22:        0x113800548 - <rustc_hir_typeck[9f32b647479e411]::fn_ctxt::FnCtxt>::check_expr_kind
  23:        0x1137a8ee0 - <rustc_hir_typeck[9f32b647479e411]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  24:        0x1137a9f0a - <rustc_hir_typeck[9f32b647479e411]::fn_ctxt::FnCtxt>::check_return_expr
  25:        0x1138c10d8 - rustc_hir_typeck[9f32b647479e411]::check::check_fn
  26:        0x1138eb55d - <rustc_hir_typeck[9f32b647479e411]::inherited::InheritedBuilder>::enter::<rustc_hir_typeck[9f32b647479e411]::typeck_with_fallback<rustc_hir_typeck[9f32b647479e411]::typeck::{closure#0}>::{closure#0}::{closure#1}, &rustc_middle[d1c654abd0283759]::ty::context::TypeckResults>
  27:        0x11388292a - rustc_hir_typeck[9f32b647479e411]::typeck
  28:        0x1147c5a69 - rustc_query_system[85e239b639d7ba03]::query::plumbing::try_execute_query::<rustc_query_impl[67024637593c284e]::plumbing::QueryCtxt, rustc_query_system[85e239b639d7ba03]::query::caches::DefaultCache<rustc_span[f624a31b590b36d5]::def_id::LocalDefId, &rustc_middle[d1c654abd0283759]::ty::context::TypeckResults>>
  29:        0x1148bd7ec - rustc_query_system[85e239b639d7ba03]::query::plumbing::get_query::<rustc_query_impl[67024637593c284e]::queries::typeck, rustc_query_impl[67024637593c284e]::plumbing::QueryCtxt>
  30:        0x11391299b - rustc_data_structures[dd13da59beea54c4]::sync::par_for_each_in::<&[rustc_span[f624a31b590b36d5]::def_id::LocalDefId], <rustc_middle[d1c654abd0283759]::hir::map::Map>::par_body_owners<rustc_hir_typeck[9f32b647479e411]::typeck_item_bodies::{closure#0}>::{closure#0}>
  31:        0x1138820ad - rustc_hir_typeck[9f32b647479e411]::typeck_item_bodies
  32:        0x114851b39 - rustc_query_system[85e239b639d7ba03]::query::plumbing::try_execute_query::<rustc_query_impl[67024637593c284e]::plumbing::QueryCtxt, rustc_query_system[85e239b639d7ba03]::query::caches::DefaultCache<(), ()>>
  33:        0x1148b20b9 - rustc_query_system[85e239b639d7ba03]::query::plumbing::get_query::<rustc_query_impl[67024637593c284e]::queries::typeck_item_bodies, rustc_query_impl[67024637593c284e]::plumbing::QueryCtxt>
  34:        0x1139fa0e4 - <rustc_session[4ff7daead66c3e1]::session::Session>::time::<(), rustc_hir_analysis[83a2ff75d2f37455]::check_crate::{closure#7}>
  35:        0x113acc3ef - rustc_hir_analysis[83a2ff75d2f37455]::check_crate
  36:        0x1110b435a - rustc_interface[46122258456702f1]::passes::analysis
  37:        0x1148438fc - rustc_query_system[85e239b639d7ba03]::query::plumbing::try_execute_query::<rustc_query_impl[67024637593c284e]::plumbing::QueryCtxt, rustc_query_system[85e239b639d7ba03]::query::caches::DefaultCache<(), core[cc5b0330b51a598]::result::Result<(), rustc_errors[bb5deb365e07b23a]::ErrorGuaranteed>>>
  38:        0x1148bdb99 - rustc_query_system[85e239b639d7ba03]::query::plumbing::get_query::<rustc_query_impl[67024637593c284e]::queries::analysis, rustc_query_impl[67024637593c284e]::plumbing::QueryCtxt>
  39:        0x110f806c6 - <rustc_interface[46122258456702f1]::passes::QueryContext>::enter::<rustc_driver[8881936ad1b6e06a]::run_compiler::{closure#1}::{closure#2}::{closure#3}, core[cc5b0330b51a598]::result::Result<(), rustc_errors[bb5deb365e07b23a]::ErrorGuaranteed>>
  40:        0x110fc486d - rustc_span[f624a31b590b36d5]::with_source_map::<core[cc5b0330b51a598]::result::Result<(), rustc_errors[bb5deb365e07b23a]::ErrorGuaranteed>, rustc_interface[46122258456702f1]::interface::run_compiler<core[cc5b0330b51a598]::result::Result<(), rustc_errors[bb5deb365e07b23a]::ErrorGuaranteed>, rustc_driver[8881936ad1b6e06a]::run_compiler::{closure#1}>::{closure#0}::{closure#1}>
  41:        0x110fb4a0c - <scoped_tls[202f56d4923bb411]::ScopedKey<rustc_span[f624a31b590b36d5]::SessionGlobals>>::set::<rustc_interface[46122258456702f1]::interface::run_compiler<core[cc5b0330b51a598]::result::Result<(), rustc_errors[bb5deb365e07b23a]::ErrorGuaranteed>, rustc_driver[8881936ad1b6e06a]::run_compiler::{closure#1}>::{closure#0}, core[cc5b0330b51a598]::result::Result<(), rustc_errors[bb5deb365e07b23a]::ErrorGuaranteed>>
  42:        0x110f83c5a - std[480136efb6eff532]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[46122258456702f1]::util::run_in_thread_pool_with_globals<rustc_interface[46122258456702f1]::interface::run_compiler<core[cc5b0330b51a598]::result::Result<(), rustc_errors[bb5deb365e07b23a]::ErrorGuaranteed>, rustc_driver[8881936ad1b6e06a]::run_compiler::{closure#1}>::{closure#0}, core[cc5b0330b51a598]::result::Result<(), rustc_errors[bb5deb365e07b23a]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[cc5b0330b51a598]::result::Result<(), rustc_errors[bb5deb365e07b23a]::ErrorGuaranteed>>
  43:        0x110f6a3eb - <<std[480136efb6eff532]::thread::Builder>::spawn_unchecked_<rustc_interface[46122258456702f1]::util::run_in_thread_pool_with_globals<rustc_interface[46122258456702f1]::interface::run_compiler<core[cc5b0330b51a598]::result::Result<(), rustc_errors[bb5deb365e07b23a]::ErrorGuaranteed>, rustc_driver[8881936ad1b6e06a]::run_compiler::{closure#1}>::{closure#0}, core[cc5b0330b51a598]::result::Result<(), rustc_errors[bb5deb365e07b23a]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[cc5b0330b51a598]::result::Result<(), rustc_errors[bb5deb365e07b23a]::ErrorGuaranteed>>::{closure#1} as core[cc5b0330b51a598]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  44:        0x1037045b7 - std::sys::unix::thread::Thread::new::thread_start::hc5a5d752c3d8ebf1
  45:     0x7ff80d84d4e1 - __pthread_start

error: internal compiler error: unexpected panic

note: 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.67.0-nightly (6284998a2 2022-11-12) running on x86_64-apple-darwin

query stack during panic:
#0 [fn_sig] computing function signature of `core::num::<impl u32>::MAX`
#1 [typeck] type-checking `main`
#2 [typeck_item_bodies] type-checking all item bodies
#3 [analysis] running analysis passes on this crate
end of query stack

Regression

Regressed in nightly-2022-11-11 due to 5eef9b2 (#101990)

Version

rustc 1.67.0-nightly (6284998a2 2022-11-12)
binary: rustc
commit-hash: 6284998a2677d7e3e8420db783f3aa4fd80d7423
commit-date: 2022-11-12
host: x86_64-apple-darwin
release: 1.67.0-nightly
LLVM version: 15.0.4

@rustbot label +regression-from-stable-to-nightly

Activity

added
C-bugCategory: This is a bug.
I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
on Nov 14, 2022
added
I-prioritizeIssue: Indicates that prioritization has been requested for this issue.
on Nov 14, 2022
added a commit that references this issue on Nov 15, 2022

Rollup merge of rust-lang#104422 - compiler-errors:fix-suggest_associ…

ce263b7
apiraino

apiraino commented on Nov 15, 2022

@apiraino
Contributor

WG-prioritization assigning priority (Zulip discussion).

@rustbot label -I-prioritize +P-medium

added and removed
I-prioritizeIssue: Indicates that prioritization has been requested for this issue.
on Nov 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

C-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️P-mediumMedium priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-nightlyPerformance or correctness regression from stable to nightly.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

    Development

    Participants

    @jruderman@compiler-errors@apiraino@rustbot

    Issue actions

      ICE: [DefId for associated constant] does not have a "fn_sig" · Issue #104412 · rust-lang/rust