Skip to content

ICE:rustc panicked at compiler\rustc_mir_build\src\check_tail_calls.rs:130:17 #139305

Open
@sososopy

Description

@sososopy

Code

fn fun(x: u32){
    fn A(x: u32, y: u32) -> u32 {
    }
    fn B(x: u32, y: u32) -> impl ToString {
        become A(x, y);
    }
}
fn main() {
}

Meta

rustc --version --verbose:

rustc 1.88.0-nightly (d5b4c2e4f 2025-04-02)
binary: rustc
commit-hash: d5b4c2e4f19b6d7037371cdaecc3cc2c701c68df
commit-date: 2025-04-02
host: x86_64-pc-windows-msvc
release: 1.88.0-nightly
LLVM version: 20.1.1

Error output

error[E0658]: `become` expression is experimental
   --> .\ttt\test.rs:215:9
    |
215 |         become A(x, y);
    |         ^^^^^^^^^^^^^^
    |
    = note: see issue #112788 <https://github.com/rust-lang/rust/issues/112788> for more information
    = help: add `#![feature(explicit_tail_calls)]` to the crate attributes to enable
    = note: this compiler was built on 2025-04-02; consider upgrading it if it is out of date

error: internal compiler error: compiler\rustc_mir_build\src\check_tail_calls.rs:130:17: hir typeck should have checked the return type already
   --> .\ttt\test.rs:215:9
    |
215 |         become A(x, y);
Backtrace

thread 'rustc' panicked at compiler\rustc_mir_build\src\check_tail_calls.rs:130:17:
Box<dyn Any>
stack backtrace:
   0:     0x7ff958fb5272 - std::backtrace_rs::backtrace::win64::trace
                               at /rustc/d5b4c2e4f19b6d7037371cdaecc3cc2c701c68df/library\std\src\..\..\backtrace\src\backtrace\win64.rs:85
   1:     0x7ff958fb5272 - std::backtrace_rs::backtrace::trace_unsynchronized
                               at /rustc/d5b4c2e4f19b6d7037371cdaecc3cc2c701c68df/library\std\src\..\..\backtrace\src\backtrace\mod.rs:66
   2:     0x7ff958fb5272 - std::sys::backtrace::_print_fmt
                               at /rustc/d5b4c2e4f19b6d7037371cdaecc3cc2c701c68df/library\std\src\sys\backtrace.rs:66
   3:     0x7ff958fb5272 - std::sys::backtrace::impl$0::print::impl$0::fmt
                               at /rustc/d5b4c2e4f19b6d7037371cdaecc3cc2c701c68df/library\std\src\sys\backtrace.rs:39
   4:     0x7ff958fe757b - core::fmt::rt::Argument::fmt
                               at /rustc/d5b4c2e4f19b6d7037371cdaecc3cc2c701c68df/library\core\src\fmt\rt.rs:178
   5:     0x7ff958fe757b - core::fmt::write
                               at /rustc/d5b4c2e4f19b6d7037371cdaecc3cc2c701c68df/library\core\src\fmt\mod.rs:1480
   6:     0x7ff958fab577 - std::io::default_write_fmt
                               at /rustc/d5b4c2e4f19b6d7037371cdaecc3cc2c701c68df/library\std\src\io\mod.rs:639
   7:     0x7ff958fab577 - std::io::Write::write_fmt<std::sys::stdio::windows::Stderr>
                               at /rustc/d5b4c2e4f19b6d7037371cdaecc3cc2c701c68df/library\std\src\io\mod.rs:1914
   8:     0x7ff958fb50b5 - std::sys::backtrace::BacktraceLock::print
                               at /rustc/d5b4c2e4f19b6d7037371cdaecc3cc2c701c68df/library\std\src\sys\backtrace.rs:42
   9:     0x7ff958fbbf7a - std::panicking::default_hook::closure$0
                               at /rustc/d5b4c2e4f19b6d7037371cdaecc3cc2c701c68df/library\std\src\panicking.rs:300
  10:     0x7ff958fbbd10 - std::panicking::default_hook
                               at /rustc/d5b4c2e4f19b6d7037371cdaecc3cc2c701c68df/library\std\src\panicking.rs:327
  11:     0x7ff95a682427 - core[dc542ccc761a93d1]::slice::sort::unstable::heapsort::heapsort::<((rustc_lint_defs[c80db952a9a9e479]::Level, &str), usize), <((rustc_lint_defs[c80db952a9a9e479]::Level, &str), usize) as core[dc542ccc761a93d1]::cmp::PartialOrd>::lt>
  12:     0x7ff958fbcc0e - std::panicking::rust_panic_with_hook
                               at /rustc/d5b4c2e4f19b6d7037371cdaecc3cc2c701c68df/library\std\src\panicking.rs:841
  13:     0x7ff95be92863 - RINvNtNtNtNtCsiUNUIDks29p_4core5slice4sort6stable9quicksort9quicksortTjRNtNtCsbm0eYcYANYr_12rustc_errors7snippet10AnnotationENCINvMNtCsfQSFmXOyJZn_5alloc5sliceSB15_11sort_by_keyTINtNtBa_3cmp7ReversejEbENCNCNvMs5_NtB1c_7emitterNtB3o_12HumanEmitter18render_s
  14:     0x7ff95be859e9 - std[d2278e79d4ecef8a]::sys::backtrace::__rust_end_short_backtrace::<std[d2278e79d4ecef8a]::panicking::begin_panic<rustc_errors[8441ef8758805389]::ExplicitBug>::{closure#0}, !>
  15:     0x7ff95be808b8 - std[d2278e79d4ecef8a]::panicking::begin_panic::<rustc_errors[8441ef8758805389]::ExplicitBug>
  16:     0x7ff95be9f8d5 - <rustc_errors[8441ef8758805389]::diagnostic::BugAbort as rustc_errors[8441ef8758805389]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
  17:     0x7ff95bd3a1ef - RINvMs6_NtCsecCnZO9y2YX_9hashbrown3rawINtB6_8RawTablejE14reserve_rehashNCINvNtNtCs4z27HeCxURF_8indexmap3map4core8get_hashTINtNtCsk01p6CsaoSU_13rustc_type_ir6binder6BinderNtNtNtCs8dq9bBHR3kY_12rustc_middle2ty7context6TyCtxtTRINtNtB2M_4list7RawListuNtB2M_2Ty
  18:     0x7ff95bde6686 - rustc_middle[5fb3d1e7f89237ca]::util::bug::span_bug_fmt::<rustc_span[342e4b5d4f7f104a]::span_encoding::Span>
  19:     0x7ff95bdbbbfd - <rustc_middle[5fb3d1e7f89237ca]::ty::consts::Const>::to_value
  20:     0x7ff95bdbb9c6 - <rustc_middle[5fb3d1e7f89237ca]::ty::consts::Const>::to_value
  21:     0x7ff95bde65e9 - rustc_middle[5fb3d1e7f89237ca]::util::bug::span_bug_fmt::<rustc_span[342e4b5d4f7f104a]::span_encoding::Span>
  22:     0x7ff9595ca565 - <rustc_mir_build[b7318cf334f4a7ee]::check_tail_calls::TailCallCkVisitor as rustc_middle[5fb3d1e7f89237ca]::thir::visit::Visitor>::visit_expr
  23:     0x7ff9595c833c - <rustc_mir_build[b7318cf334f4a7ee]::check_tail_calls::TailCallCkVisitor as rustc_middle[5fb3d1e7f89237ca]::thir::visit::Visitor>::visit_expr
  24:     0x7ff95956c824 - <rustc_arena[d3684f082febd529]::TypedArena<rustc_pattern_analysis[11f5058b6b6ca9b3]::pat::DeconstructedPat<rustc_pattern_analysis[11f5058b6b6ca9b3]::rustc::RustcPatCtxt>>>::grow
  25:     0x7ff9595c843e - <rustc_mir_build[b7318cf334f4a7ee]::check_tail_calls::TailCallCkVisitor as rustc_middle[5fb3d1e7f89237ca]::thir::visit::Visitor>::visit_expr
  26:     0x7ff9595c833c - <rustc_mir_build[b7318cf334f4a7ee]::check_tail_calls::TailCallCkVisitor as rustc_middle[5fb3d1e7f89237ca]::thir::visit::Visitor>::visit_expr
  27:     0x7ff9595c833c - <rustc_mir_build[b7318cf334f4a7ee]::check_tail_calls::TailCallCkVisitor as rustc_middle[5fb3d1e7f89237ca]::thir::visit::Visitor>::visit_expr
  28:     0x7ff9595c7ead - rustc_mir_build[b7318cf334f4a7ee]::check_tail_calls::check_tail_calls
  29:     0x7ff959e974db - rustc_query_impl[d9335ea94c0b0ece]::plumbing::query_key_hash_verify_all
  30:     0x7ff959dd0c93 - RINvNtNtCskvioGLgoOG9_18rustc_query_system5query8plumbing17try_execute_queryINtCsiE9y6tCaNS4_16rustc_query_impl13DynamicConfigINtNtCsilDQ9z9nh3l_21rustc_data_structures9vec_cache8VecCacheNtNtCs4tKXlikXsF2_10rustc_span6def_id10LocalDefIdINtNtNtCs8dq9bBHR3kY
  31:     0x7ff959ea0a30 - rustc_query_impl[d9335ea94c0b0ece]::plumbing::query_key_hash_verify_all
  32:     0x7ff95956ce6b - rustc_mir_build[b7318cf334f4a7ee]::builder::build_mir
  33:     0x7ff959429eb4 - rustc_mir_transform[c1960b92e6f6143d]::mir_built
  34:     0x7ff959e98e8b - rustc_query_impl[d9335ea94c0b0ece]::plumbing::query_key_hash_verify_all
  35:     0x7ff959dd72bb - RINvNtNtCskvioGLgoOG9_18rustc_query_system5query8plumbing17try_execute_queryINtCsiE9y6tCaNS4_16rustc_query_impl13DynamicConfigINtNtCsilDQ9z9nh3l_21rustc_data_structures9vec_cache8VecCacheNtNtCs4tKXlikXsF2_10rustc_span6def_id10LocalDefIdINtNtNtCs8dq9bBHR3kY
  36:     0x7ff959e9ce92 - rustc_query_impl[d9335ea94c0b0ece]::plumbing::query_key_hash_verify_all
  37:     0x7ff95941b747 - rustc_mir_transform[c1960b92e6f6143d]::ffi_unwind_calls::has_ffi_unwind_calls
  38:     0x7ff959e97e2b - rustc_query_impl[d9335ea94c0b0ece]::plumbing::query_key_hash_verify_all
  39:     0x7ff959dd0c93 - RINvNtNtCskvioGLgoOG9_18rustc_query_system5query8plumbing17try_execute_queryINtCsiE9y6tCaNS4_16rustc_query_impl13DynamicConfigINtNtCsilDQ9z9nh3l_21rustc_data_structures9vec_cache8VecCacheNtNtCs4tKXlikXsF2_10rustc_span6def_id10LocalDefIdINtNtNtCs8dq9bBHR3kY
  40:     0x7ff959ea7d90 - rustc_query_impl[d9335ea94c0b0ece]::plumbing::query_key_hash_verify_all
  41:     0x7ff95942c718 - rustc_mir_transform[c1960b92e6f6143d]::mir_promoted
  42:     0x7ff959e96e49 - rustc_query_impl[d9335ea94c0b0ece]::plumbing::query_key_hash_verify_all
  43:     0x7ff959dcd2a6 - RINvNtNtCskvioGLgoOG9_18rustc_query_system5query8plumbing17try_execute_queryINtCsiE9y6tCaNS4_16rustc_query_impl13DynamicConfigINtNtCsilDQ9z9nh3l_21rustc_data_structures9vec_cache8VecCacheNtNtCs4tKXlikXsF2_10rustc_span6def_id10LocalDefIdINtNtNtCs8dq9bBHR3kY
  44:     0x7ff959e9d442 - rustc_query_impl[d9335ea94c0b0ece]::plumbing::query_key_hash_verify_all
  45:     0x7ff9596e4c50 - rustc_borrowck[235ceed02603ae4f]::mir_borrowck
  46:     0x7ff959e96dcb - rustc_query_impl[d9335ea94c0b0ece]::plumbing::query_key_hash_verify_all
  47:     0x7ff959dd72bb - RINvNtNtCskvioGLgoOG9_18rustc_query_system5query8plumbing17try_execute_queryINtCsiE9y6tCaNS4_16rustc_query_impl13DynamicConfigINtNtCsilDQ9z9nh3l_21rustc_data_structures9vec_cache8VecCacheNtNtCs4tKXlikXsF2_10rustc_span6def_id10LocalDefIdINtNtNtCs8dq9bBHR3kY
  48:     0x7ff959ea1772 - rustc_query_impl[d9335ea94c0b0ece]::plumbing::query_key_hash_verify_all
  49:     0x7ff9587f8774 - <rustc_hir_analysis[653cc36538c3ef1]::collect::type_of::opaque::RpitConstraintChecker as rustc_hir[54d9011b315e8a82]::intravisit::Visitor>::visit_expr
  50:     0x7ff958b3779b - <alloc[b8a61deb1be72a43]::sync::Arc<rustc_session[15763e0c540e77d7]::cstore::CrateSource>>::drop_slow
  51:     0x7ff959d62e0b - RINvNtNtCskvioGLgoOG9_18rustc_query_system5query8plumbing17try_execute_queryINtCsiE9y6tCaNS4_16rustc_query_impl13DynamicConfigINtNtB4_6caches10DefIdCacheINtNtNtCs8dq9bBHR3kY_12rustc_middle5query5erase6ErasedAhj8_EEKb0_KB3r_KB3r_ENtNtB1f_8plumbing9QueryCtxt
  52:     0x7ff958b40d54 - rustc_query_impl[d9335ea94c0b0ece]::query_system
  53:     0x7ff95930b442 - <rustc_hir_analysis[653cc36538c3ef1]::collect::resolve_bound_vars::is_late_bound_map::ConstrainedCollector as rustc_hir[54d9011b315e8a82]::intravisit::Visitor>::visit_ty
  54:     0x7ff959e98d00 - rustc_query_impl[d9335ea94c0b0ece]::plumbing::query_key_hash_verify_all
  55:     0x7ff959d62e0b - RINvNtNtCskvioGLgoOG9_18rustc_query_system5query8plumbing17try_execute_queryINtCsiE9y6tCaNS4_16rustc_query_impl13DynamicConfigINtNtB4_6caches10DefIdCacheINtNtNtCs8dq9bBHR3kY_12rustc_middle5query5erase6ErasedAhj8_EEKb0_KB3r_KB3r_ENtNtB1f_8plumbing9QueryCtxt
  56:     0x7ff959e9ad76 - rustc_query_impl[d9335ea94c0b0ece]::plumbing::query_key_hash_verify_all
  57:     0x7ff9587d3825 - rustc_hir_analysis[653cc36538c3ef1]::check::check::check_abi_fn_ptr
  58:     0x7ff9592d3fc8 - rustc_hir_analysis[653cc36538c3ef1]::check::wfcheck::check_well_formed
  59:     0x7ff959e9788b - rustc_query_impl[d9335ea94c0b0ece]::plumbing::query_key_hash_verify_all
  60:     0x7ff959dd0f33 - RINvNtNtCskvioGLgoOG9_18rustc_query_system5query8plumbing17try_execute_queryINtCsiE9y6tCaNS4_16rustc_query_impl13DynamicConfigINtNtCsilDQ9z9nh3l_21rustc_data_structures9vec_cache8VecCacheNtNtCs4tKXlikXsF2_10rustc_span6def_id10LocalDefIdINtNtNtCs8dq9bBHR3kY
  61:     0x7ff959ea83b5 - rustc_query_impl[d9335ea94c0b0ece]::plumbing::query_key_hash_verify_all
  62:     0x7ff9592e41d2 - rustc_hir_analysis[653cc36538c3ef1]::check::wfcheck::check_mod_type_wf
  63:     0x7ff958b3886b - <alloc[b8a61deb1be72a43]::sync::Arc<rustc_session[15763e0c540e77d7]::cstore::CrateSource>>::drop_slow
  64:     0x7ff958a834cc - RINvNtNtCskvioGLgoOG9_18rustc_query_system5query8plumbing17try_execute_queryINtCsiE9y6tCaNS4_16rustc_query_impl13DynamicConfigINtNtB4_6caches12DefaultCacheNtNtCs4tKXlikXsF2_10rustc_span6def_id13LocalModDefIdINtNtNtCs8dq9bBHR3kY_12rustc_middle5query5erase6E
  65:     0x7ff958b4c730 - rustc_query_impl[d9335ea94c0b0ece]::query_system
  66:     0x7ff95932db2a - rustc_hir_analysis[653cc36538c3ef1]::check_crate
  67:     0x7ff95902499f - rustc_interface[cabc4d9db40f56f8]::passes::resolver_for_lowering_raw
  68:     0x7ff955926697 - rustc_interface[cabc4d9db40f56f8]::passes::analysis
  69:     0x7ff958b3b64a - <alloc[b8a61deb1be72a43]::sync::Arc<rustc_session[15763e0c540e77d7]::cstore::CrateSource>>::drop_slow
  70:     0x7ff958a43ece - RINvNtNtCskvioGLgoOG9_18rustc_query_system5query8plumbing17try_execute_queryINtCsiE9y6tCaNS4_16rustc_query_impl13DynamicConfigINtNtB4_6caches11SingleCacheINtNtNtCs8dq9bBHR3kY_12rustc_middle5query5erase6ErasedAhj0_EEKb0_KB3s_KB3s_ENtNtB1f_8plumbing9QueryCtx
  71:     0x7ff958b418b3 - rustc_query_impl[d9335ea94c0b0ece]::query_system
  72:     0x7ff9558ea10f - RINvNtNtCsi2E9fhZYu8g_3std3sys9backtrace28___rust_begin_short_backtraceNCNCNCINvMNtB6_6threadNtB1h_7Builder16spawn_unchecked_INtNtCsfQSFmXOyJZn_5alloc5boxed3BoxDINtNtNtCsiUNUIDks29p_4core3ops8function6FnOnceuEp6OutputuNtNtB2G_6marker4SendEL_EuEs_000uECs7V8
  73:     0x7ff9558e4043 - RINvNtNtCsi2E9fhZYu8g_3std3sys9backtrace28___rust_begin_short_backtraceNCNCNCINvMNtB6_6threadNtB1h_7Builder16spawn_unchecked_INtNtCsfQSFmXOyJZn_5alloc5boxed3BoxDINtNtNtCsiUNUIDks29p_4core3ops8function6FnOnceuEp6OutputuNtNtB2G_6marker4SendEL_EuEs_000uECs7V8
  74:     0x7ff9558ded13 - RINvNtNtCsi2E9fhZYu8g_3std3sys9backtrace28___rust_begin_short_backtraceNCNCINvNtCshp9I49agxXE_15rustc_interface4util26run_in_thread_with_globalsNCINvB1e_31run_in_thread_pool_with_globalsNCINvNtB1g_9interface12run_compileruNCNvCs7V8n164MtzI_17rustc_driver_i
  75:     0x7ff9558ee6f0 - RINvNtNtCsi2E9fhZYu8g_3std3sys9backtrace28___rust_begin_short_backtraceNCNCNCINvMNtB6_6threadNtB1h_7Builder16spawn_unchecked_INtNtCsfQSFmXOyJZn_5alloc5boxed3BoxDINtNtNtCsiUNUIDks29p_4core3ops8function6FnOnceuEp6OutputuNtNtB2G_6marker4SendEL_EuEs_000uECs7V8
  76:     0x7ff958fc192d - alloc::boxed::impl$28::call_once
                               at /rustc/d5b4c2e4f19b6d7037371cdaecc3cc2c701c68df/library\alloc\src\boxed.rs:1966
  77:     0x7ff958fc192d - alloc::boxed::impl$28::call_once
                               at /rustc/d5b4c2e4f19b6d7037371cdaecc3cc2c701c68df/library\alloc\src\boxed.rs:1966
  78:     0x7ff958fc192d - std::sys::pal::windows::thread::impl$0::new::thread_start
                               at /rustc/d5b4c2e4f19b6d7037371cdaecc3cc2c701c68df/library\std\src\sys\pal\windows\thread.rs:56
  79:     0x7ffa233b7374 - BaseThreadInitThunk
  80:     0x7ffa23f3cc91 - RtlUserThreadStart

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 `D:\rust_test\test1\src\rustc-ice-2025-04-03T06_07_02-3872.txt` to your bug report

query stack during panic:
#0 [check_tail_calls] tail-call-checking `fun::B`
#1 [mir_built] building MIR for `fun::B`
... and 8 other queries... use `env RUST_BACKTRACE=1` to see the full query stack
error: aborting due to 2 previous errors

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.F-explicit_tail_calls`#![feature(explicit_tail_calls)]`I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️S-blockedStatus: Blocked on something else such as an RFC or other implementation work.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.requires-incomplete-featuresThis issue requires the use of incomplete features.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions