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

ICE: no type for local variable #94516

Closed
matthiaskrgr opened this issue Mar 2, 2022 · 2 comments · Fixed by #94596
Closed

ICE: no type for local variable #94516

matthiaskrgr opened this issue Mar 2, 2022 · 2 comments · Fixed by #94596
Assignees
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Milestone

Comments

@matthiaskrgr
Copy link
Member

matthiaskrgr commented Mar 2, 2022

Code

code from ./src/tools/rustfmt/tests/source/expr-block.rs

fn foo() {}

fn combine_block() {
    foo((1, 2, 3, |x| {
        let y = x + 1;        
    }));
}
pub fn main() {}

Meta

rustc --version --verbose:

rustc 1.61.0-nightly (f0c4da499 2022-03-01)
binary: rustc
commit-hash: f0c4da49983aa699f715caf681e3154b445fb60b
commit-date: 2022-03-01
host: x86_64-unknown-linux-gnu
release: 1.61.0-nightly
LLVM version: 14.0.0

Error output

error[E0061]: this function takes 0 arguments but 1 argument was supplied
 --> ./src/tools/rustfmt/tests/source/expr-block.rs:4:5
  |
4 |       foo((1, 2, 3, |x| {
  |  _____^^^_-
  | |     |
  | |     expected 0 arguments
5 | |         let y = x + 1;
6 | |     }));
  | |______- supplied 1 argument
  |
note: function defined here
 --> ./src/tools/rustfmt/tests/source/expr-block.rs:1:4
  |
1 | fn foo() {}
  |    ^^^

error: internal compiler error: compiler/rustc_typeck/src/check/fn_ctxt/_impl.rs:139:13: no type for local variable local let y = x + 1; (hir_id=HirId { owner: DefId(0:4 ~ expr_block[ee93]::combine_block), local_id: 13 })
 --> ./src/tools/rustfmt/tests/source/expr-block.rs:5:9
  |
5 |         let y = x + 1;
  |         ^^^^^^^^^^^^^^

thread 'rustc' panicked at 'Box<dyn Any>', /rustc/f0c4da49983aa699f715caf681e3154b445fb60b/compiler/rustc_errors/src/lib.rs:1102:9
Backtrace

thread 'rustc' panicked at 'Box<dyn Any>', /rustc/f0c4da49983aa699f715caf681e3154b445fb60b/compiler/rustc_errors/src/lib.rs:1102:9
stack backtrace:
   0:     0x7efe83c98abc - std::backtrace_rs::backtrace::libunwind::trace::h99a8625949c72b25
                               at /rustc/f0c4da49983aa699f715caf681e3154b445fb60b/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7efe83c98abc - std::backtrace_rs::backtrace::trace_unsynchronized::h76313fc194d5b414
                               at /rustc/f0c4da49983aa699f715caf681e3154b445fb60b/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7efe83c98abc - std::sys_common::backtrace::_print_fmt::h65ed0da1f95be40b
                               at /rustc/f0c4da49983aa699f715caf681e3154b445fb60b/library/std/src/sys_common/backtrace.rs:66:5
   3:     0x7efe83c98abc - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h77737a7bac5db27e
                               at /rustc/f0c4da49983aa699f715caf681e3154b445fb60b/library/std/src/sys_common/backtrace.rs:45:22
   4:     0x7efe83cf7dbc - core::fmt::write::h915ea97b591832b2
                               at /rustc/f0c4da49983aa699f715caf681e3154b445fb60b/library/core/src/fmt/mod.rs:1190:17
   5:     0x7efe83c88e41 - std::io::Write::write_fmt::hcffa30259ccb6bdb
                               at /rustc/f0c4da49983aa699f715caf681e3154b445fb60b/library/std/src/io/mod.rs:1657:15
   6:     0x7efe83c9caf5 - std::sys_common::backtrace::_print::hcfa317b5bdf3ad37
                               at /rustc/f0c4da49983aa699f715caf681e3154b445fb60b/library/std/src/sys_common/backtrace.rs:48:5
   7:     0x7efe83c9caf5 - std::sys_common::backtrace::print::h5f9e06e6f1d02773
                               at /rustc/f0c4da49983aa699f715caf681e3154b445fb60b/library/std/src/sys_common/backtrace.rs:35:9
   8:     0x7efe83c9caf5 - std::panicking::default_hook::{{closure}}::he1a05425135ebb35
                               at /rustc/f0c4da49983aa699f715caf681e3154b445fb60b/library/std/src/panicking.rs:295:22
   9:     0x7efe83c9c7a4 - std::panicking::default_hook::hf5fb851d4955d9f5
                               at /rustc/f0c4da49983aa699f715caf681e3154b445fb60b/library/std/src/panicking.rs:314:9
  10:     0x7efe844c2c51 - rustc_driver[21e91ca004648271]::DEFAULT_HOOK::{closure#0}::{closure#0}
  11:     0x7efe83c9d37f - std::panicking::rust_panic_with_hook::h5b2aa56667e0c597
                               at /rustc/f0c4da49983aa699f715caf681e3154b445fb60b/library/std/src/panicking.rs:702:17
  12:     0x7efe848162c1 - std[3ade094fb3183502]::panicking::begin_panic::<rustc_errors[a7fdb1b8faaf8b98]::ExplicitBug>::{closure#0}
  13:     0x7efe84816206 - std[3ade094fb3183502]::sys_common::backtrace::__rust_end_short_backtrace::<std[3ade094fb3183502]::panicking::begin_panic<rustc_errors[a7fdb1b8faaf8b98]::ExplicitBug>::{closure#0}, !>
  14:     0x7efe8480878f - std[3ade094fb3183502]::panicking::begin_panic::<rustc_errors[a7fdb1b8faaf8b98]::ExplicitBug>
  15:     0x7efe8481557d - std[3ade094fb3183502]::panic::panic_any::<rustc_errors[a7fdb1b8faaf8b98]::ExplicitBug>
  16:     0x7efe8480ff48 - <rustc_errors[a7fdb1b8faaf8b98]::HandlerInner>::span_bug::<rustc_span[7ca50f9024201fd1]::span_encoding::Span>
  17:     0x7efe8480fc20 - <rustc_errors[a7fdb1b8faaf8b98]::Handler>::span_bug::<rustc_span[7ca50f9024201fd1]::span_encoding::Span>
  18:     0x7efe848694e2 - rustc_middle[9221b4e20c323b32]::ty::context::tls::with_opt::<rustc_middle[9221b4e20c323b32]::util::bug::opt_span_bug_fmt<rustc_span[7ca50f9024201fd1]::span_encoding::Span>::{closure#0}, ()>
  19:     0x7efe848699d0 - rustc_middle[9221b4e20c323b32]::util::bug::opt_span_bug_fmt::<rustc_span[7ca50f9024201fd1]::span_encoding::Span>
  20:     0x7efe8486999c - rustc_middle[9221b4e20c323b32]::util::bug::span_bug_fmt::<rustc_span[7ca50f9024201fd1]::span_encoding::Span>
  21:     0x7efe859343e4 - <rustc_typeck[1c7c09902fef065d]::check::writeback::WritebackCx as rustc_hir[71a4b4b13452cac5]::intravisit::Visitor>::visit_local
  22:     0x7efe859315ed - <rustc_typeck[1c7c09902fef065d]::check::writeback::WritebackCx as rustc_hir[71a4b4b13452cac5]::intravisit::Visitor>::visit_expr
  23:     0x7efe85930602 - <rustc_typeck[1c7c09902fef065d]::check::writeback::WritebackCx as rustc_hir[71a4b4b13452cac5]::intravisit::Visitor>::visit_expr
  24:     0x7efe85931590 - <rustc_typeck[1c7c09902fef065d]::check::writeback::WritebackCx as rustc_hir[71a4b4b13452cac5]::intravisit::Visitor>::visit_expr
  25:     0x7efe8592faa9 - <rustc_typeck[1c7c09902fef065d]::check::writeback::WritebackCx as rustc_hir[71a4b4b13452cac5]::intravisit::Visitor>::visit_expr
  26:     0x7efe859315cc - <rustc_typeck[1c7c09902fef065d]::check::writeback::WritebackCx as rustc_hir[71a4b4b13452cac5]::intravisit::Visitor>::visit_expr
  27:     0x7efe8586e101 - <rustc_typeck[1c7c09902fef065d]::check::fn_ctxt::FnCtxt>::resolve_type_vars_in_body
  28:     0x7efe858ea4d5 - <rustc_infer[31342668325f450e]::infer::InferCtxtBuilder>::enter::<&rustc_middle[9221b4e20c323b32]::ty::context::TypeckResults, <rustc_typeck[1c7c09902fef065d]::check::inherited::InheritedBuilder>::enter<rustc_typeck[1c7c09902fef065d]::check::typeck_with_fallback<rustc_typeck[1c7c09902fef065d]::check::typeck::{closure#0}>::{closure#1}, &rustc_middle[9221b4e20c323b32]::ty::context::TypeckResults>::{closure#0}>
  29:     0x7efe858ca42e - rustc_typeck[1c7c09902fef065d]::check::typeck
  30:     0x7efe85d708cf - rustc_query_system[9188a2e1b2fa7249]::query::plumbing::try_execute_query::<rustc_query_impl[e009e6874744e682]::plumbing::QueryCtxt, rustc_query_system[9188a2e1b2fa7249]::query::caches::DefaultCache<rustc_span[7ca50f9024201fd1]::def_id::LocalDefId, &rustc_middle[9221b4e20c323b32]::ty::context::TypeckResults>>
  31:     0x7efe85e459b8 - <rustc_query_impl[e009e6874744e682]::Queries as rustc_middle[9221b4e20c323b32]::ty::query::QueryEngine>::typeck
  32:     0x7efe858ca605 - rustc_typeck[1c7c09902fef065d]::check::typeck
  33:     0x7efe85d708cf - rustc_query_system[9188a2e1b2fa7249]::query::plumbing::try_execute_query::<rustc_query_impl[e009e6874744e682]::plumbing::QueryCtxt, rustc_query_system[9188a2e1b2fa7249]::query::caches::DefaultCache<rustc_span[7ca50f9024201fd1]::def_id::LocalDefId, &rustc_middle[9221b4e20c323b32]::ty::context::TypeckResults>>
  34:     0x7efe85e459b8 - <rustc_query_impl[e009e6874744e682]::Queries as rustc_middle[9221b4e20c323b32]::ty::query::QueryEngine>::typeck
  35:     0x7efe8592a5dc - <rustc_middle[9221b4e20c323b32]::hir::map::Map>::par_body_owners::<rustc_typeck[1c7c09902fef065d]::check::typeck_item_bodies::{closure#0}>
  36:     0x7efe8659d92c - rustc_typeck[1c7c09902fef065d]::check::typeck_item_bodies
  37:     0x7efe867e6dc5 - rustc_query_system[9188a2e1b2fa7249]::query::plumbing::try_execute_query::<rustc_query_impl[e009e6874744e682]::plumbing::QueryCtxt, rustc_query_system[9188a2e1b2fa7249]::query::caches::DefaultCache<(), ()>>
  38:     0x7efe8680e0e1 - rustc_query_system[9188a2e1b2fa7249]::query::plumbing::get_query::<rustc_query_impl[e009e6874744e682]::queries::typeck_item_bodies, rustc_query_impl[e009e6874744e682]::plumbing::QueryCtxt>
  39:     0x7efe865a2c53 - <rustc_session[274d8531b09a3035]::session::Session>::time::<(), rustc_typeck[1c7c09902fef065d]::check_crate::{closure#7}>
  40:     0x7efe8659e173 - rustc_typeck[1c7c09902fef065d]::check_crate
  41:     0x7efe86326497 - rustc_interface[a423bfa6342c229d]::passes::analysis
  42:     0x7efe867dd05b - rustc_query_system[9188a2e1b2fa7249]::query::plumbing::try_execute_query::<rustc_query_impl[e009e6874744e682]::plumbing::QueryCtxt, rustc_query_system[9188a2e1b2fa7249]::query::caches::DefaultCache<(), core[dda31b9937958c06]::result::Result<(), rustc_errors[a7fdb1b8faaf8b98]::ErrorReported>>>
  43:     0x7efe8681c74e - rustc_query_system[9188a2e1b2fa7249]::query::plumbing::get_query::<rustc_query_impl[e009e6874744e682]::queries::analysis, rustc_query_impl[e009e6874744e682]::plumbing::QueryCtxt>
  44:     0x7efe86310a44 - <rustc_interface[a423bfa6342c229d]::passes::QueryContext>::enter::<rustc_driver[21e91ca004648271]::run_compiler::{closure#1}::{closure#2}::{closure#3}, core[dda31b9937958c06]::result::Result<(), rustc_errors[a7fdb1b8faaf8b98]::ErrorReported>>
  45:     0x7efe862ffe6a - <rustc_interface[a423bfa6342c229d]::interface::Compiler>::enter::<rustc_driver[21e91ca004648271]::run_compiler::{closure#1}::{closure#2}, core[dda31b9937958c06]::result::Result<core[dda31b9937958c06]::option::Option<rustc_interface[a423bfa6342c229d]::queries::Linker>, rustc_errors[a7fdb1b8faaf8b98]::ErrorReported>>
  46:     0x7efe86301d1d - rustc_span[7ca50f9024201fd1]::with_source_map::<core[dda31b9937958c06]::result::Result<(), rustc_errors[a7fdb1b8faaf8b98]::ErrorReported>, rustc_interface[a423bfa6342c229d]::interface::create_compiler_and_run<core[dda31b9937958c06]::result::Result<(), rustc_errors[a7fdb1b8faaf8b98]::ErrorReported>, rustc_driver[21e91ca004648271]::run_compiler::{closure#1}>::{closure#1}>
  47:     0x7efe862ff8c0 - rustc_interface[a423bfa6342c229d]::interface::create_compiler_and_run::<core[dda31b9937958c06]::result::Result<(), rustc_errors[a7fdb1b8faaf8b98]::ErrorReported>, rustc_driver[21e91ca004648271]::run_compiler::{closure#1}>
  48:     0x7efe862ed432 - <scoped_tls[1c61111d50d35047]::ScopedKey<rustc_span[7ca50f9024201fd1]::SessionGlobals>>::set::<rustc_interface[a423bfa6342c229d]::interface::run_compiler<core[dda31b9937958c06]::result::Result<(), rustc_errors[a7fdb1b8faaf8b98]::ErrorReported>, rustc_driver[21e91ca004648271]::run_compiler::{closure#1}>::{closure#0}, core[dda31b9937958c06]::result::Result<(), rustc_errors[a7fdb1b8faaf8b98]::ErrorReported>>
  49:     0x7efe862eca3d - std[3ade094fb3183502]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[a423bfa6342c229d]::util::run_in_thread_pool_with_globals<rustc_interface[a423bfa6342c229d]::interface::run_compiler<core[dda31b9937958c06]::result::Result<(), rustc_errors[a7fdb1b8faaf8b98]::ErrorReported>, rustc_driver[21e91ca004648271]::run_compiler::{closure#1}>::{closure#0}, core[dda31b9937958c06]::result::Result<(), rustc_errors[a7fdb1b8faaf8b98]::ErrorReported>>::{closure#0}, core[dda31b9937958c06]::result::Result<(), rustc_errors[a7fdb1b8faaf8b98]::ErrorReported>>
  50:     0x7efe862e9cd9 - <<std[3ade094fb3183502]::thread::Builder>::spawn_unchecked_<rustc_interface[a423bfa6342c229d]::util::run_in_thread_pool_with_globals<rustc_interface[a423bfa6342c229d]::interface::run_compiler<core[dda31b9937958c06]::result::Result<(), rustc_errors[a7fdb1b8faaf8b98]::ErrorReported>, rustc_driver[21e91ca004648271]::run_compiler::{closure#1}>::{closure#0}, core[dda31b9937958c06]::result::Result<(), rustc_errors[a7fdb1b8faaf8b98]::ErrorReported>>::{closure#0}, core[dda31b9937958c06]::result::Result<(), rustc_errors[a7fdb1b8faaf8b98]::ErrorReported>>::{closure#1} as core[dda31b9937958c06]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  51:     0x7efe83ca8c43 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::ha2e5f436d171b70c
                               at /rustc/f0c4da49983aa699f715caf681e3154b445fb60b/library/alloc/src/boxed.rs:1854:9
  52:     0x7efe83ca8c43 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h9372d40d7cdd1652
                               at /rustc/f0c4da49983aa699f715caf681e3154b445fb60b/library/alloc/src/boxed.rs:1854:9
  53:     0x7efe83ca8c43 - std::sys::unix::thread::Thread::new::thread_start::h73908ce582304204
                               at /rustc/f0c4da49983aa699f715caf681e3154b445fb60b/library/std/src/sys/unix/thread.rs:108:17
  54:     0x7efe83a835c2 - start_thread
  55:     0x7efe83b08584 - __clone
  56:                0x0 - <unknown>

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.61.0-nightly (f0c4da499 2022-03-01) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [typeck] type-checking `combine_block`
#1 [typeck] type-checking `combine_block::{closure#0}`
#2 [typeck_item_bodies] type-checking all item bodies
#3 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0061`.

@matthiaskrgr matthiaskrgr added 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. C-bug Category: This is a bug. labels Mar 2, 2022
@matthiaskrgr
Copy link
Member Author

searched toolchains 48132ca through f0c4da4


Regression in 6e5a6ff


probably #94438 cc @compiler-errors

@camelid camelid added I-prioritize Issue: Indicates that prioritization has been requested for this issue. regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. labels Mar 2, 2022
@camelid camelid added this to the 1.61.0 milestone Mar 2, 2022
@compiler-errors
Copy link
Member

I can look into this

@rustbot claim

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) ❄️ regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. 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.

4 participants