Skip to content

ICE. thir_check_tail_calls should have disallowed this Expr #127530

Closed as not planned
@matthiaskrgr

Description

@matthiaskrgr

snippet:

const fn f() {
    become {}
}

Version information

rustc 1.81.0-nightly (a2d58197a 2024-07-09)
binary: rustc
commit-hash: a2d58197a766085856504328948c89a33a6a36e8
commit-date: 2024-07-09
host: x86_64-unknown-linux-gnu
release: 1.81.0-nightly
LLVM version: 18.1.7

Command:
/home/matthias/.rustup/toolchains/master/bin/rustc

Program output

error[E0658]: `become` expression is experimental
 --> /tmp/icemaker_global_tempdir.xME2IXpTo5sg/rustc_testrunner_tmpdir_reporting.I0PitYv22r1S/mvce.rs:2:5
  |
2 |     become {}
  |     ^^^^^^^^^
  |
  = 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 2024-07-09; consider upgrading it if it is out of date

error[E0601]: `main` function not found in crate `mvce`
 --> /tmp/icemaker_global_tempdir.xME2IXpTo5sg/rustc_testrunner_tmpdir_reporting.I0PitYv22r1S/mvce.rs:3:2
  |
3 | }
  |  ^ consider adding a `main` function to `/tmp/icemaker_global_tempdir.xME2IXpTo5sg/rustc_testrunner_tmpdir_reporting.I0PitYv22r1S/mvce.rs`

error: internal compiler error: compiler/rustc_mir_build/src/build/expr/stmt.rs:104:21: `thir_check_tail_calls` should have disallowed this Expr { kind: Block { block: b0 }, ty: (), temp_lifetime: Some(Node(5)), span: /tmp/icemaker_global_tempdir.xME2IXpTo5sg/rustc_testrunner_tmpdir_reporting.I0PitYv22r1S/mvce.rs:2:12: 2:14 (#0) }
 --> /tmp/icemaker_global_tempdir.xME2IXpTo5sg/rustc_testrunner_tmpdir_reporting.I0PitYv22r1S/mvce.rs:2:12
  |
2 |     become {}
  |            ^^

thread 'rustc' panicked at compiler/rustc_mir_build/src/build/expr/stmt.rs:104:21:
Box<dyn Any>
stack backtrace:
   0:     0x71b030854635 - std::backtrace_rs::backtrace::libunwind::trace::he13237cce988f53a
                               at /rustc/a2d58197a766085856504328948c89a33a6a36e8/library/std/src/../../backtrace/src/backtrace/libunwind.rs:116:5
   1:     0x71b030854635 - std::backtrace_rs::backtrace::trace_unsynchronized::ha201234a79e1b48c
                               at /rustc/a2d58197a766085856504328948c89a33a6a36e8/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x71b030854635 - std::sys::backtrace::_print_fmt::hd9cfa658072ab2df
                               at /rustc/a2d58197a766085856504328948c89a33a6a36e8/library/std/src/sys/backtrace.rs:68:5
   3:     0x71b030854635 - <std::sys::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h2dad1e978c9e79ed
                               at /rustc/a2d58197a766085856504328948c89a33a6a36e8/library/std/src/sys/backtrace.rs:44:22
   4:     0x71b0308a3d1b - core::fmt::rt::Argument::fmt::h730e19369aa4f808
                               at /rustc/a2d58197a766085856504328948c89a33a6a36e8/library/core/src/fmt/rt.rs:173:76
   5:     0x71b0308a3d1b - core::fmt::write::hdfe1035cf0a4efa1
                               at /rustc/a2d58197a766085856504328948c89a33a6a36e8/library/core/src/fmt/mod.rs:1182:21
   6:     0x71b030848f6f - std::io::Write::write_fmt::h03dd478e1beb99ad
                               at /rustc/a2d58197a766085856504328948c89a33a6a36e8/library/std/src/io/mod.rs:1835:15
   7:     0x71b03085440e - std::sys::backtrace::_print::h57a2b1e60fc2c4b9
                               at /rustc/a2d58197a766085856504328948c89a33a6a36e8/library/std/src/sys/backtrace.rs:47:5
   8:     0x71b03085440e - std::sys::backtrace::print::h9505429ddc3ddaae
                               at /rustc/a2d58197a766085856504328948c89a33a6a36e8/library/std/src/sys/backtrace.rs:34:9
   9:     0x71b030856d59 - std::panicking::default_hook::{{closure}}::hdda69c4ec7eb9df6
  10:     0x71b030856afc - std::panicking::default_hook::h86919ed8fb6d78eb
                               at /rustc/a2d58197a766085856504328948c89a33a6a36e8/library/std/src/panicking.rs:292:9
  11:     0x71b02cc6233a - std[17a9183c6e3c57f9]::panicking::update_hook::<alloc[96dff5c9794ac641]::boxed::Box<rustc_driver_impl[54b2714eb49b5e44]::install_ice_hook::{closure#0}>>::{closure#0}
  12:     0x71b03085767f - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h48d0327b488509c8
                               at /rustc/a2d58197a766085856504328948c89a33a6a36e8/library/alloc/src/boxed.rs:2078:9
  13:     0x71b03085767f - std::panicking::rust_panic_with_hook::h064be6ac2c876781
                               at /rustc/a2d58197a766085856504328948c89a33a6a36e8/library/std/src/panicking.rs:804:13
  14:     0x71b02cc9d291 - std[17a9183c6e3c57f9]::panicking::begin_panic::<rustc_errors[d6d035c9d1e266a6]::ExplicitBug>::{closure#0}
  15:     0x71b02cc90246 - std[17a9183c6e3c57f9]::sys::backtrace::__rust_end_short_backtrace::<std[17a9183c6e3c57f9]::panicking::begin_panic<rustc_errors[d6d035c9d1e266a6]::ExplicitBug>::{closure#0}, !>
  16:     0x71b02cc8b576 - std[17a9183c6e3c57f9]::panicking::begin_panic::<rustc_errors[d6d035c9d1e266a6]::ExplicitBug>
  17:     0x71b02cca64d1 - <rustc_errors[d6d035c9d1e266a6]::diagnostic::BugAbort as rustc_errors[d6d035c9d1e266a6]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
  18:     0x71b02d2cdb6d - <rustc_errors[d6d035c9d1e266a6]::DiagCtxtHandle>::span_bug::<rustc_span[b622c74bbfdcda1]::span_encoding::Span, alloc[96dff5c9794ac641]::string::String>
  19:     0x71b02d2e6588 - rustc_middle[5daf59f269113cc0]::util::bug::opt_span_bug_fmt::<rustc_span[b622c74bbfdcda1]::span_encoding::Span>::{closure#0}
  20:     0x71b02d2e65ba - rustc_middle[5daf59f269113cc0]::ty::context::tls::with_opt::<rustc_middle[5daf59f269113cc0]::util::bug::opt_span_bug_fmt<rustc_span[b622c74bbfdcda1]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  21:     0x71b02d2d8b0b - rustc_middle[5daf59f269113cc0]::ty::context::tls::with_context_opt::<rustc_middle[5daf59f269113cc0]::ty::context::tls::with_opt<rustc_middle[5daf59f269113cc0]::util::bug::opt_span_bug_fmt<rustc_span[b622c74bbfdcda1]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  22:     0x71b02c58ee57 - rustc_middle[5daf59f269113cc0]::util::bug::span_bug_fmt::<rustc_span[b622c74bbfdcda1]::span_encoding::Span>
  23:     0x71b02e69078c - <rustc_mir_build[83fad7e019b39822]::build::Builder>::stmt_expr
  24:     0x71b02e6ad2b0 - <rustc_mir_build[83fad7e019b39822]::build::Builder>::expr_into_dest
  25:     0x71b02e6a53d8 - <rustc_mir_build[83fad7e019b39822]::build::Builder>::as_temp::{closure#0}
  26:     0x71b02e6ac4ce - <rustc_mir_build[83fad7e019b39822]::build::Builder>::expr_into_dest
  27:     0x71b02e6ac746 - <rustc_mir_build[83fad7e019b39822]::build::Builder>::expr_into_dest
  28:     0x71b02edd5255 - <rustc_mir_build[83fad7e019b39822]::build::Builder>::ast_block_stmts
  29:     0x71b02edd4208 - <rustc_mir_build[83fad7e019b39822]::build::Builder>::ast_block
  30:     0x71b02e6ab443 - <rustc_mir_build[83fad7e019b39822]::build::Builder>::expr_into_dest
  31:     0x71b02e6ac746 - <rustc_mir_build[83fad7e019b39822]::build::Builder>::expr_into_dest
  32:     0x71b02e677628 - rustc_mir_build[83fad7e019b39822]::build::mir_build
  33:     0x71b02e675412 - rustc_query_impl[a82680dd64788ded]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[a82680dd64788ded]::query_impl::mir_built::dynamic_query::{closure#2}::{closure#0}, rustc_middle[5daf59f269113cc0]::query::erase::Erased<[u8; 8usize]>>
  34:     0x71b02e507fb9 - rustc_query_system[6e4c5f05fdec07b1]::query::plumbing::try_execute_query::<rustc_query_impl[a82680dd64788ded]::DynamicConfig<rustc_query_system[6e4c5f05fdec07b1]::query::caches::VecCache<rustc_span[b622c74bbfdcda1]::def_id::LocalDefId, rustc_middle[5daf59f269113cc0]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[a82680dd64788ded]::plumbing::QueryCtxt, false>
  35:     0x71b02e507acd - rustc_query_impl[a82680dd64788ded]::query_impl::mir_built::get_query_non_incr::__rust_end_short_backtrace
  36:     0x71b02e4f7a3e - rustc_mir_build[83fad7e019b39822]::check_unsafety::check_unsafety
  37:     0x71b02e4f77dd - rustc_query_impl[a82680dd64788ded]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[a82680dd64788ded]::query_impl::check_unsafety::dynamic_query::{closure#2}::{closure#0}, rustc_middle[5daf59f269113cc0]::query::erase::Erased<[u8; 0usize]>>
  38:     0x71b02e4f6917 - rustc_query_system[6e4c5f05fdec07b1]::query::plumbing::try_execute_query::<rustc_query_impl[a82680dd64788ded]::DynamicConfig<rustc_query_system[6e4c5f05fdec07b1]::query::caches::VecCache<rustc_span[b622c74bbfdcda1]::def_id::LocalDefId, rustc_middle[5daf59f269113cc0]::query::erase::Erased<[u8; 0usize]>>, false, false, false>, rustc_query_impl[a82680dd64788ded]::plumbing::QueryCtxt, false>
  39:     0x71b02e4f65db - rustc_query_impl[a82680dd64788ded]::query_impl::check_unsafety::get_query_non_incr::__rust_end_short_backtrace
  40:     0x71b02e4fb2b8 - rustc_interface[303575eb6bc5efad]::passes::analysis
  41:     0x71b02e4fa407 - rustc_query_impl[a82680dd64788ded]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[a82680dd64788ded]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[5daf59f269113cc0]::query::erase::Erased<[u8; 1usize]>>
  42:     0x71b02f126025 - rustc_query_system[6e4c5f05fdec07b1]::query::plumbing::try_execute_query::<rustc_query_impl[a82680dd64788ded]::DynamicConfig<rustc_query_system[6e4c5f05fdec07b1]::query::caches::SingleCache<rustc_middle[5daf59f269113cc0]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[a82680dd64788ded]::plumbing::QueryCtxt, false>
  43:     0x71b02f125d8f - rustc_query_impl[a82680dd64788ded]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  44:     0x71b02efec805 - rustc_interface[303575eb6bc5efad]::interface::run_compiler::<core[f2873ee8fdb51630]::result::Result<(), rustc_span[b622c74bbfdcda1]::ErrorGuaranteed>, rustc_driver_impl[54b2714eb49b5e44]::run_compiler::{closure#0}>::{closure#1}
  45:     0x71b02efd2ac9 - std[17a9183c6e3c57f9]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[303575eb6bc5efad]::util::run_in_thread_with_globals<rustc_interface[303575eb6bc5efad]::util::run_in_thread_pool_with_globals<rustc_interface[303575eb6bc5efad]::interface::run_compiler<core[f2873ee8fdb51630]::result::Result<(), rustc_span[b622c74bbfdcda1]::ErrorGuaranteed>, rustc_driver_impl[54b2714eb49b5e44]::run_compiler::{closure#0}>::{closure#1}, core[f2873ee8fdb51630]::result::Result<(), rustc_span[b622c74bbfdcda1]::ErrorGuaranteed>>::{closure#0}, core[f2873ee8fdb51630]::result::Result<(), rustc_span[b622c74bbfdcda1]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[f2873ee8fdb51630]::result::Result<(), rustc_span[b622c74bbfdcda1]::ErrorGuaranteed>>
  46:     0x71b02efd287a - <<std[17a9183c6e3c57f9]::thread::Builder>::spawn_unchecked_<rustc_interface[303575eb6bc5efad]::util::run_in_thread_with_globals<rustc_interface[303575eb6bc5efad]::util::run_in_thread_pool_with_globals<rustc_interface[303575eb6bc5efad]::interface::run_compiler<core[f2873ee8fdb51630]::result::Result<(), rustc_span[b622c74bbfdcda1]::ErrorGuaranteed>, rustc_driver_impl[54b2714eb49b5e44]::run_compiler::{closure#0}>::{closure#1}, core[f2873ee8fdb51630]::result::Result<(), rustc_span[b622c74bbfdcda1]::ErrorGuaranteed>>::{closure#0}, core[f2873ee8fdb51630]::result::Result<(), rustc_span[b622c74bbfdcda1]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[f2873ee8fdb51630]::result::Result<(), rustc_span[b622c74bbfdcda1]::ErrorGuaranteed>>::{closure#2} as core[f2873ee8fdb51630]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  47:     0x71b0308614db - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h2e7f345ce8c283af
                               at /rustc/a2d58197a766085856504328948c89a33a6a36e8/library/alloc/src/boxed.rs:2064:9
  48:     0x71b0308614db - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hace4a6e345e267d6
                               at /rustc/a2d58197a766085856504328948c89a33a6a36e8/library/alloc/src/boxed.rs:2064:9
  49:     0x71b0308614db - std::sys::pal::unix::thread::Thread::new::thread_start::hebe8226876a7b7bb
                               at /rustc/a2d58197a766085856504328948c89a33a6a36e8/library/std/src/sys/pal/unix/thread.rs:108:17
  50:     0x71b0305f5ded - <unknown>
  51:     0x71b0306790dc - <unknown>
  52:                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: rustc 1.81.0-nightly (a2d58197a 2024-07-09) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [mir_built] building MIR for `f`
#1 [check_unsafety] unsafety-checking `f`
end of query stack
error: aborting due to 3 previous errors

Some errors have detailed explanations: E0601, E0658.
For more information about an error, try `rustc --explain E0601`.

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) ❄️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