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

keyword become yields ICE now. #131673

Closed
Neutron3529 opened this issue Oct 14, 2024 · 1 comment
Closed

keyword become yields ICE now. #131673

Neutron3529 opened this issue Oct 14, 2024 · 1 comment
Labels
C-bug Category: This is a bug. F-explicit_tail_calls `#![feature(explicit_tail_calls)]` I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ requires-incomplete-features This issue requires the use of incomplete features. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@Neutron3529
Copy link
Contributor

Neutron3529 commented Oct 14, 2024

Code

I tried this code:

#![feature(explicit_tail_calls)]
fn foo() -> i32 {
    become 42 // ICE since Rust 1.81
}
pub fn main() {
    println!("{}", foo())
}

I expected to see this happen: Compile

Instead, this happened: ICE

rustc-ice-date.txt

thread 'rustc' panicked at compiler/rustc_mir_build/src/build/expr/stmt.rs:106:21:
Box<dyn Any>
stack backtrace:
   0:     0x7221523163e5 - std::backtrace::Backtrace::create::hd648a4a8e855af1e
   1:     0x722150ac7355 - std::backtrace::Backtrace::force_capture::he87459478c0a3ec6
   2:     0x72214fba33b4 - std[170610031590a965]::panicking::update_hook::<alloc[66d4c008c69e86cd]::boxed::Box<rustc_driver_impl[26aaba0b9f674e85]::install_ice_hook::{closure#0}>>::{closure#0}
   3:     0x722150adea08 - std::panicking::rust_panic_with_hook::hf9da426777cf33fb
   4:     0x72214fbdcf11 - std[170610031590a965]::panicking::begin_panic::<rustc_errors[2b9f4ebbc725b026]::ExplicitBug>::{closure#0}
   5:     0x72214fbcffb6 - std[170610031590a965]::sys::backtrace::__rust_end_short_backtrace::<std[170610031590a965]::panicking::begin_panic<rustc_errors[2b9f4ebbc725b026]::ExplicitBug>::{closure#0}, !>
   6:     0x72214fbcb499 - std[170610031590a965]::panicking::begin_panic::<rustc_errors[2b9f4ebbc725b026]::ExplicitBug>
   7:     0x72214fbe67a1 - <rustc_errors[2b9f4ebbc725b026]::diagnostic::BugAbort as rustc_errors[2b9f4ebbc725b026]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
   8:     0x7221502332ed - <rustc_errors[2b9f4ebbc725b026]::DiagCtxtHandle>::span_bug::<rustc_span[d0163105bd3f350c]::span_encoding::Span, alloc[66d4c008c69e86cd]::string::String>
   9:     0x7221502463e8 - rustc_middle[1155dac776b01d50]::util::bug::opt_span_bug_fmt::<rustc_span[d0163105bd3f350c]::span_encoding::Span>::{closure#0}
  10:     0x72215024641a - rustc_middle[1155dac776b01d50]::ty::context::tls::with_opt::<rustc_middle[1155dac776b01d50]::util::bug::opt_span_bug_fmt<rustc_span[d0163105bd3f350c]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  11:     0x72215023be1b - rustc_middle[1155dac776b01d50]::ty::context::tls::with_context_opt::<rustc_middle[1155dac776b01d50]::ty::context::tls::with_opt<rustc_middle[1155dac776b01d50]::util::bug::opt_span_bug_fmt<rustc_span[d0163105bd3f350c]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  12:     0x72214f47a277 - rustc_middle[1155dac776b01d50]::util::bug::span_bug_fmt::<rustc_span[d0163105bd3f350c]::span_encoding::Span>
  13:     0x7221514c9738 - <rustc_mir_build[bcefb118f41dfad5]::build::Builder>::stmt_expr
  14:     0x722151527163 - <rustc_mir_build[bcefb118f41dfad5]::build::Builder>::expr_into_dest
  15:     0x72215151c585 - <rustc_mir_build[bcefb118f41dfad5]::build::Builder>::as_temp::{closure#0}
  16:     0x7221515263fb - <rustc_mir_build[bcefb118f41dfad5]::build::Builder>::expr_into_dest
  17:     0x72215152666f - <rustc_mir_build[bcefb118f41dfad5]::build::Builder>::expr_into_dest
  18:     0x722151daf14d - <rustc_mir_build[bcefb118f41dfad5]::build::Builder>::ast_block_stmts
  19:     0x722151dae147 - <rustc_mir_build[bcefb118f41dfad5]::build::Builder>::ast_block
  20:     0x7221515245a1 - <rustc_mir_build[bcefb118f41dfad5]::build::Builder>::expr_into_dest
  21:     0x72215152666f - <rustc_mir_build[bcefb118f41dfad5]::build::Builder>::expr_into_dest
  22:     0x722151b70fc1 - rustc_mir_build[bcefb118f41dfad5]::build::mir_build
  23:     0x722151204f06 - rustc_mir_transform[de8989103c0dc9d3]::mir_built
  24:     0x722151204ec9 - rustc_query_impl[180b75f2ddc39270]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[180b75f2ddc39270]::query_impl::mir_built::dynamic_query::{closure#2}::{closure#0}, rustc_middle[1155dac776b01d50]::query::erase::Erased<[u8; 8usize]>>
  25:     0x7221515b16ba - rustc_query_system[9f857c887a67b714]::query::plumbing::try_execute_query::<rustc_query_impl[180b75f2ddc39270]::DynamicConfig<rustc_query_system[9f857c887a67b714]::query::caches::VecCache<rustc_span[d0163105bd3f350c]::def_id::LocalDefId, rustc_middle[1155dac776b01d50]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[180b75f2ddc39270]::plumbing::QueryCtxt, false>
  26:     0x7221515b11cd - rustc_query_impl[180b75f2ddc39270]::query_impl::mir_built::get_query_non_incr::__rust_end_short_backtrace
  27:     0x72214d8ee8a3 - rustc_mir_build[bcefb118f41dfad5]::check_unsafety::check_unsafety
  28:     0x722151a3b9e7 - rustc_query_impl[180b75f2ddc39270]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[180b75f2ddc39270]::query_impl::check_unsafety::dynamic_query::{closure#2}::{closure#0}, rustc_middle[1155dac776b01d50]::query::erase::Erased<[u8; 0usize]>>
  29:     0x722151a3bc8b - rustc_query_system[9f857c887a67b714]::query::plumbing::try_execute_query::<rustc_query_impl[180b75f2ddc39270]::DynamicConfig<rustc_query_system[9f857c887a67b714]::query::caches::VecCache<rustc_span[d0163105bd3f350c]::def_id::LocalDefId, rustc_middle[1155dac776b01d50]::query::erase::Erased<[u8; 0usize]>>, false, false, false>, rustc_query_impl[180b75f2ddc39270]::plumbing::QueryCtxt, false>
  30:     0x722151a3b917 - rustc_query_impl[180b75f2ddc39270]::query_impl::check_unsafety::get_query_non_incr::__rust_end_short_backtrace
  31:     0x7221515aaf47 - rustc_interface[67c5fa7b03b13b84]::passes::run_required_analyses
  32:     0x722151d5ee9e - rustc_interface[67c5fa7b03b13b84]::passes::analysis
  33:     0x722151d5ee71 - rustc_query_impl[180b75f2ddc39270]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[180b75f2ddc39270]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[1155dac776b01d50]::query::erase::Erased<[u8; 1usize]>>
  34:     0x72215207cbee - rustc_query_system[9f857c887a67b714]::query::plumbing::try_execute_query::<rustc_query_impl[180b75f2ddc39270]::DynamicConfig<rustc_query_system[9f857c887a67b714]::query::caches::SingleCache<rustc_middle[1155dac776b01d50]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[180b75f2ddc39270]::plumbing::QueryCtxt, false>
  35:     0x72215207c8cf - rustc_query_impl[180b75f2ddc39270]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  36:     0x722151f0939e - rustc_interface[67c5fa7b03b13b84]::interface::run_compiler::<core[d68a251df926a28b]::result::Result<(), rustc_span[d0163105bd3f350c]::ErrorGuaranteed>, rustc_driver_impl[26aaba0b9f674e85]::run_compiler::{closure#0}>::{closure#1}
  37:     0x722152029650 - std[170610031590a965]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[67c5fa7b03b13b84]::util::run_in_thread_with_globals<rustc_interface[67c5fa7b03b13b84]::util::run_in_thread_pool_with_globals<rustc_interface[67c5fa7b03b13b84]::interface::run_compiler<core[d68a251df926a28b]::result::Result<(), rustc_span[d0163105bd3f350c]::ErrorGuaranteed>, rustc_driver_impl[26aaba0b9f674e85]::run_compiler::{closure#0}>::{closure#1}, core[d68a251df926a28b]::result::Result<(), rustc_span[d0163105bd3f350c]::ErrorGuaranteed>>::{closure#0}, core[d68a251df926a28b]::result::Result<(), rustc_span[d0163105bd3f350c]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[d68a251df926a28b]::result::Result<(), rustc_span[d0163105bd3f350c]::ErrorGuaranteed>>
  38:     0x722152029cba - <<std[170610031590a965]::thread::Builder>::spawn_unchecked_<rustc_interface[67c5fa7b03b13b84]::util::run_in_thread_with_globals<rustc_interface[67c5fa7b03b13b84]::util::run_in_thread_pool_with_globals<rustc_interface[67c5fa7b03b13b84]::interface::run_compiler<core[d68a251df926a28b]::result::Result<(), rustc_span[d0163105bd3f350c]::ErrorGuaranteed>, rustc_driver_impl[26aaba0b9f674e85]::run_compiler::{closure#0}>::{closure#1}, core[d68a251df926a28b]::result::Result<(), rustc_span[d0163105bd3f350c]::ErrorGuaranteed>>::{closure#0}, core[d68a251df926a28b]::result::Result<(), rustc_span[d0163105bd3f350c]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[d68a251df926a28b]::result::Result<(), rustc_span[d0163105bd3f350c]::ErrorGuaranteed>>::{closure#1} as core[d68a251df926a28b]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  39:     0x72215202a0ab - std::sys::pal::unix::thread::Thread::new::thread_start::h5cf1ac2878833c32
  40:     0x7221535b739d - <unknown>
  41:     0x72215363c49c - <unknown>
  42:                0x0 - <unknown>


rustc version: 1.83.0-nightly (fb4aebddd 2024-09-30)
platform: x86_64-unknown-linux-gnu

query stack during panic:
#0 [mir_built] building MIR for `foo`
#1 [check_unsafety] unsafety-checking `foo`
#2 [analysis] running analysis passes on this crate
end of query stack

Version it worked on

It most recently worked on: Rust 1.80 (with RUSTC_BOOTSTRAP=1 set, which could be verified in godbolt)

Version with regression

rustc --version --verbose:

rustc 1.83.0-nightly (fb4aebddd 2024-09-30)
binary: rustc
commit-hash: fb4aebddd18d258046ddb51fd41589295259a0fa
commit-date: 2024-09-30
host: x86_64-unknown-linux-gnu
release: 1.83.0-nightly
LLVM version: 19.1.0

Backtrace

Backtrace

thread 'rustc' panicked at compiler/rustc_mir_build/src/build/expr/stmt.rs:106:21:
Box<dyn Any>
stack backtrace:
   0: std::panicking::begin_panic::<rustc_errors::ExplicitBug>
   1: <rustc_errors::diagnostic::BugAbort as rustc_errors::diagnostic::EmissionGuarantee>::emit_producing_guarantee
   2: <rustc_errors::DiagCtxtHandle>::span_bug::<rustc_span::span_encoding::Span, alloc::string::String>
   3: rustc_middle::util::bug::opt_span_bug_fmt::<rustc_span::span_encoding::Span>::{closure#0}
   4: rustc_middle::ty::context::tls::with_opt::<rustc_middle::util::bug::opt_span_bug_fmt<rustc_span::span_encoding::Span>::{closure#0}, !>::{closure#0}
   5: rustc_middle::ty::context::tls::with_context_opt::<rustc_middle::ty::context::tls::with_opt<rustc_middle::util::bug::opt_span_bug_fmt<rustc_span::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
   6: rustc_middle::util::bug::span_bug_fmt::<rustc_span::span_encoding::Span>
   7: <rustc_mir_build::build::Builder>::stmt_expr
   8: <rustc_mir_build::build::Builder>::expr_into_dest
   9: <rustc_mir_build::build::Builder>::as_temp::{closure#0}
  10: <rustc_mir_build::build::Builder>::expr_into_dest
  11: <rustc_mir_build::build::Builder>::expr_into_dest
  12: <rustc_mir_build::build::Builder>::ast_block_stmts
  13: <rustc_mir_build::build::Builder>::ast_block
  14: <rustc_mir_build::build::Builder>::expr_into_dest
  15: <rustc_mir_build::build::Builder>::expr_into_dest
  16: rustc_mir_build::build::mir_build
  17: rustc_mir_transform::mir_built
      [... omitted 1 frame ...]
  18: rustc_mir_build::check_unsafety::check_unsafety
      [... omitted 1 frame ...]
  19: rustc_interface::passes::run_required_analyses
  20: rustc_interface::passes::analysis
      [... omitted 1 frame ...]
  21: rustc_interface::interface::run_compiler::<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

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 `/me/rustc-ice-2024-10-14T04_38_18-24201.txt` to your bug report

note: compiler flags: -Z unstable-options -C link-arg=-fuse-ld=mold

query stack during panic:
#0 [mir_built] building MIR for `foo`
#1 [check_unsafety] unsafety-checking `foo`
#2 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 1 previous error; 1 warning emitted

@Neutron3529 Neutron3529 added C-bug Category: This is a bug. regression-untriaged Untriaged performance or correctness regression. labels Oct 14, 2024
@rustbot rustbot added I-prioritize Issue: Indicates that prioritization has been requested for this issue. needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Oct 14, 2024
@jieyouxu jieyouxu added F-explicit_tail_calls `#![feature(explicit_tail_calls)]` 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. requires-incomplete-features This issue requires the use of incomplete features. and removed regression-untriaged Untriaged performance or correctness regression. I-prioritize Issue: Indicates that prioritization has been requested for this issue. needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Oct 14, 2024
@WaffleLapkin
Copy link
Member

explicit tail calls is an incomplete feature, it is not properly implemented yet (and never was, the fact that it compiled before did not mean it compiled to something sensible)

@WaffleLapkin WaffleLapkin closed this as not planned Won't fix, can't repro, duplicate, stale Oct 14, 2024
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. F-explicit_tail_calls `#![feature(explicit_tail_calls)]` I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ requires-incomplete-features This issue requires the use of incomplete features. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

4 participants