Skip to content
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

Compiler Error when creating a variable with a function from a module of the same name that doesn't exist #105364

Closed
darkfireZZ opened this issue Dec 6, 2022 · 3 comments
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@darkfireZZ
Copy link

Code

lib.rs:

fn cause_compiler_bug() {
    let content_line = content_line::fail();
}

Then, run cargo check to produce the error.

Meta

rustc --version --verbose:

rustc 1.67.0-nightly (e1d819583 2022-12-05)
binary: rustc
commit-hash: e1d819583f0bf13b016b119c1c2c43e6d3979450
commit-date: 2022-12-05
host: aarch64-apple-darwin
release: 1.67.0-nightly
LLVM version: 15.0.4

This bug only seems to exist on nightly. Wasn't able to reproduce it in stable or beta.

Error output

error: internal compiler error: compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs:494:17: no type for node HirId { owner: OwnerId { def_id: DefId(0:3 ~ compiler_bug[a9cb]::cause_compiler_bug) }, local_id: 5 }: expr content_line::fail() (hir_id=HirId { owner: OwnerId { def_id: DefId(0:3 ~ compiler_bug[a9cb]::cause_compiler_bug) }, local_id: 5 }) in fcx 0x16b892c78
Backtrace

$ RUST_BACKTRACE=full cargo check
    Checking compiler-bug v0.1.0 (/Users/nicolabruhin/proj/compiler-bug)
error: internal compiler error: compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs:494:17: no type for node HirId { owner: OwnerId { def_id: DefId(0:3 ~ compiler_bug[a9cb]::cause_compiler_bug) }, local_id: 5 }: expr content_line::fail() (hir_id=HirId { owner: OwnerId { def_id: DefId(0:3 ~ compiler_bug[a9cb]::cause_compiler_bug) }, local_id: 5 }) in fcx 0x16b6eec78

thread 'rustc' panicked at 'Box<dyn Any>', /rustc/e1d819583f0bf13b016b119c1c2c43e6d3979450/compiler/rustc_errors/src/lib.rs:1576:9
stack backtrace:
   0:        0x105adaa10 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h0c84b61faf0229ce
   1:        0x105b2bd14 - core::fmt::write::hfa20ec9c38f6c479
   2:        0x105ace0b4 - std::io::Write::write_fmt::h524f175257c76218
   3:        0x105ada824 - std::sys_common::backtrace::print::hddcebad0cb15f470
   4:        0x105add2d4 - std::panicking::default_hook::{{closure}}::hc4ed05202b95777e
   5:        0x105add02c - std::panicking::default_hook::haaed734fe565b86e
   6:        0x10dc683cc - rustc_driver[baeecd9a8368fa6f]::DEFAULT_HOOK::{closure#0}::{closure#0}
   7:        0x105add9cc - std::panicking::rust_panic_with_hook::h2c5cfac53345a3b0
   8:        0x111917518 - std[5aacee3d4ae205b2]::panicking::begin_panic::<rustc_errors[5b7430d0deac5858]::ExplicitBug>::{closure#0}
   9:        0x111916ea4 - std[5aacee3d4ae205b2]::sys_common::backtrace::__rust_end_short_backtrace::<std[5aacee3d4ae205b2]::panicking::begin_panic<rustc_errors[5b7430d0deac5858]::ExplicitBug>::{closure#0}, !>
  10:        0x111f2b86c - std[5aacee3d4ae205b2]::panicking::begin_panic::<rustc_errors[5b7430d0deac5858]::ExplicitBug>
  11:        0x1119111f8 - std[5aacee3d4ae205b2]::panic::panic_any::<rustc_errors[5b7430d0deac5858]::ExplicitBug>
  12:        0x11190ff70 - <rustc_errors[5b7430d0deac5858]::HandlerInner>::bug::<&alloc[6c8a30c1d22d7cf6]::string::String>
  13:        0x11190fac0 - <rustc_errors[5b7430d0deac5858]::Handler>::bug::<&alloc[6c8a30c1d22d7cf6]::string::String>
  14:        0x111a667c0 - rustc_middle[a558d95c6d0827b9]::ty::context::tls::with_context_opt::<rustc_middle[a558d95c6d0827b9]::ty::context::tls::with_opt<rustc_middle[a558d95c6d0827b9]::util::bug::opt_span_bug_fmt<rustc_span[d020583edd4f3bbf]::span_encoding::Span>::{closure#0}, ()>::{closure#0}, ()>
  15:        0x111a677b0 - rustc_middle[a558d95c6d0827b9]::util::bug::opt_span_bug_fmt::<rustc_span[d020583edd4f3bbf]::span_encoding::Span>
  16:        0x111f2d1ac - rustc_middle[a558d95c6d0827b9]::util::bug::bug_fmt
  17:        0x10fefd08c - <rustc_hir_typeck[8b1ad01c143fdd1e]::fn_ctxt::FnCtxt>::node_ty
  18:        0x10fef391c - <rustc_hir_typeck[8b1ad01c143fdd1e]::fn_ctxt::FnCtxt>::check_expr_path
  19:        0x10fef32fc - <rustc_hir_typeck[8b1ad01c143fdd1e]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  20:        0x10fee4434 - <rustc_hir_typeck[8b1ad01c143fdd1e]::fn_ctxt::FnCtxt>::check_call
  21:        0x10ff39274 - <rustc_hir_typeck[8b1ad01c143fdd1e]::fn_ctxt::FnCtxt>::check_expr_kind
  22:        0x10fef3370 - <rustc_hir_typeck[8b1ad01c143fdd1e]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  23:        0x10ff06314 - <rustc_hir_typeck[8b1ad01c143fdd1e]::fn_ctxt::FnCtxt>::check_decl
  24:        0x10ff06750 - <rustc_hir_typeck[8b1ad01c143fdd1e]::fn_ctxt::FnCtxt>::check_stmt
  25:        0x10ff06ef0 - <rustc_hir_typeck[8b1ad01c143fdd1e]::fn_ctxt::FnCtxt>::check_block_with_expected
  26:        0x10ff394a8 - <rustc_hir_typeck[8b1ad01c143fdd1e]::fn_ctxt::FnCtxt>::check_expr_kind
  27:        0x10fef3370 - <rustc_hir_typeck[8b1ad01c143fdd1e]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  28:        0x10fef4690 - <rustc_hir_typeck[8b1ad01c143fdd1e]::fn_ctxt::FnCtxt>::check_return_expr
  29:        0x10ffee4c4 - rustc_hir_typeck[8b1ad01c143fdd1e]::check::check_fn
  30:        0x10ffb9b90 - rustc_hir_typeck[8b1ad01c143fdd1e]::typeck
  31:        0x110ea4208 - <rustc_query_system[881b81955b7d3a1f]::dep_graph::graph::DepGraph<rustc_middle[a558d95c6d0827b9]::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle[a558d95c6d0827b9]::ty::context::TyCtxt, rustc_span[d020583edd4f3bbf]::def_id::LocalDefId, &rustc_middle[a558d95c6d0827b9]::ty::context::TypeckResults>
  32:        0x110c97614 - rustc_query_system[881b81955b7d3a1f]::query::plumbing::try_execute_query::<rustc_query_impl[10270d6d28a400b1]::plumbing::QueryCtxt, rustc_query_system[881b81955b7d3a1f]::query::caches::VecCache<rustc_span[d020583edd4f3bbf]::def_id::LocalDefId, &rustc_middle[a558d95c6d0827b9]::ty::context::TypeckResults>>
  33:        0x110d2f9ec - rustc_query_system[881b81955b7d3a1f]::query::plumbing::get_query::<rustc_query_impl[10270d6d28a400b1]::queries::typeck, rustc_query_impl[10270d6d28a400b1]::plumbing::QueryCtxt>
  34:        0x1100272c0 - rustc_data_structures[6b4c19381ad17c7b]::sync::par_for_each_in::<&[rustc_span[d020583edd4f3bbf]::def_id::LocalDefId], <rustc_middle[a558d95c6d0827b9]::hir::map::Map>::par_body_owners<rustc_hir_typeck[8b1ad01c143fdd1e]::typeck_item_bodies::{closure#0}>::{closure#0}>
  35:        0x10ffb7e50 - rustc_hir_typeck[8b1ad01c143fdd1e]::typeck_item_bodies
  36:        0x110ed5ce8 - <rustc_query_system[881b81955b7d3a1f]::dep_graph::graph::DepGraph<rustc_middle[a558d95c6d0827b9]::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle[a558d95c6d0827b9]::ty::context::TyCtxt, (), ()>
  37:        0x110c78cf8 - rustc_query_system[881b81955b7d3a1f]::query::plumbing::try_execute_query::<rustc_query_impl[10270d6d28a400b1]::plumbing::QueryCtxt, rustc_query_system[881b81955b7d3a1f]::query::caches::DefaultCache<(), ()>>
  38:        0x110d0d5b4 - rustc_query_system[881b81955b7d3a1f]::query::plumbing::get_query::<rustc_query_impl[10270d6d28a400b1]::queries::typeck_item_bodies, rustc_query_impl[10270d6d28a400b1]::plumbing::QueryCtxt>
  39:        0x110104f80 - <rustc_session[581d2633b842fe89]::session::Session>::time::<(), rustc_hir_analysis[7367f76290afd602]::check_crate::{closure#7}>
  40:        0x1100ad8f0 - rustc_hir_analysis[7367f76290afd602]::check_crate
  41:        0x10dcf73e8 - rustc_interface[5f1f7ed1fc884db8]::passes::analysis
  42:        0x110ecc4f4 - <rustc_query_system[881b81955b7d3a1f]::dep_graph::graph::DepGraph<rustc_middle[a558d95c6d0827b9]::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle[a558d95c6d0827b9]::ty::context::TyCtxt, (), core[505bfcfd4f798a3b]::result::Result<(), rustc_errors[5b7430d0deac5858]::ErrorGuaranteed>>
  43:        0x110c6affc - rustc_query_system[881b81955b7d3a1f]::query::plumbing::try_execute_query::<rustc_query_impl[10270d6d28a400b1]::plumbing::QueryCtxt, rustc_query_system[881b81955b7d3a1f]::query::caches::DefaultCache<(), core[505bfcfd4f798a3b]::result::Result<(), rustc_errors[5b7430d0deac5858]::ErrorGuaranteed>>>
  44:        0x110d2fdf4 - rustc_query_system[881b81955b7d3a1f]::query::plumbing::get_query::<rustc_query_impl[10270d6d28a400b1]::queries::analysis, rustc_query_impl[10270d6d28a400b1]::plumbing::QueryCtxt>
  45:        0x10dc05eec - <rustc_interface[5f1f7ed1fc884db8]::passes::QueryContext>::enter::<rustc_driver[baeecd9a8368fa6f]::run_compiler::{closure#1}::{closure#2}::{closure#2}, core[505bfcfd4f798a3b]::result::Result<(), rustc_errors[5b7430d0deac5858]::ErrorGuaranteed>>
  46:        0x10dc44bac - rustc_span[d020583edd4f3bbf]::with_source_map::<core[505bfcfd4f798a3b]::result::Result<(), rustc_errors[5b7430d0deac5858]::ErrorGuaranteed>, rustc_interface[5f1f7ed1fc884db8]::interface::run_compiler<core[505bfcfd4f798a3b]::result::Result<(), rustc_errors[5b7430d0deac5858]::ErrorGuaranteed>, rustc_driver[baeecd9a8368fa6f]::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
  47:        0x10dc3c04c - <scoped_tls[f95b1765c2853b29]::ScopedKey<rustc_span[d020583edd4f3bbf]::SessionGlobals>>::set::<rustc_interface[5f1f7ed1fc884db8]::interface::run_compiler<core[505bfcfd4f798a3b]::result::Result<(), rustc_errors[5b7430d0deac5858]::ErrorGuaranteed>, rustc_driver[baeecd9a8368fa6f]::run_compiler::{closure#1}>::{closure#0}, core[505bfcfd4f798a3b]::result::Result<(), rustc_errors[5b7430d0deac5858]::ErrorGuaranteed>>
  48:        0x10dc0dfc4 - std[5aacee3d4ae205b2]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[5f1f7ed1fc884db8]::util::run_in_thread_pool_with_globals<rustc_interface[5f1f7ed1fc884db8]::interface::run_compiler<core[505bfcfd4f798a3b]::result::Result<(), rustc_errors[5b7430d0deac5858]::ErrorGuaranteed>, rustc_driver[baeecd9a8368fa6f]::run_compiler::{closure#1}>::{closure#0}, core[505bfcfd4f798a3b]::result::Result<(), rustc_errors[5b7430d0deac5858]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[505bfcfd4f798a3b]::result::Result<(), rustc_errors[5b7430d0deac5858]::ErrorGuaranteed>>
  49:        0x10dbf43b8 - <<std[5aacee3d4ae205b2]::thread::Builder>::spawn_unchecked_<rustc_interface[5f1f7ed1fc884db8]::util::run_in_thread_pool_with_globals<rustc_interface[5f1f7ed1fc884db8]::interface::run_compiler<core[505bfcfd4f798a3b]::result::Result<(), rustc_errors[5b7430d0deac5858]::ErrorGuaranteed>, rustc_driver[baeecd9a8368fa6f]::run_compiler::{closure#1}>::{closure#0}, core[505bfcfd4f798a3b]::result::Result<(), rustc_errors[5b7430d0deac5858]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[505bfcfd4f798a3b]::result::Result<(), rustc_errors[5b7430d0deac5858]::ErrorGuaranteed>>::{closure#1} as core[505bfcfd4f798a3b]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  50:        0x105ae5d40 - std::sys::unix::thread::Thread::new::thread_start::ha49b2ab3a599abde
  51:        0x19014c26c - __pthread_deallocate

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 (e1d819583 2022-12-05) running on aarch64-apple-darwin

note: compiler flags: --crate-type lib -C embed-bitcode=no -C split-debuginfo=unpacked -C debuginfo=2 -C incremental=[REDACTED]

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
#0 [typeck] type-checking `cause_compiler_bug`
#1 [typeck_item_bodies] type-checking all item bodies
#2 [analysis] running analysis passes on this crate
end of query stack
error: could not compile `compiler-bug`

@darkfireZZ darkfireZZ 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 Dec 6, 2022
@matthiaskrgr
Copy link
Member

probably duplicate of #105288

TaKO8Ki added a commit to TaKO8Ki/rust that referenced this issue Dec 11, 2022
@langston-barrett
Copy link

@rustbot label +S-bug-has-mcve

@rustbot rustbot added the S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue label Mar 17, 2023
@compiler-errors
Copy link
Member

this is a dupe of a fixed issue

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. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants