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: const-prop encountered formatting error: unsized locals are not supported #111353

Closed
tmiasko opened this issue May 8, 2023 · 1 comment · Fixed by #114543
Closed

ICE: const-prop encountered formatting error: unsized locals are not supported #111353

tmiasko opened this issue May 8, 2023 · 1 comment · Fixed by #114543
Labels
C-bug Category: This is a bug. F-unsized_fn_params `#![feature(unsized_fn_params)]` glacier ICE tracked in rust-lang/glacier. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ requires-nightly This issue requires a nightly compiler in some way. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@tmiasko
Copy link
Contributor

tmiasko commented May 8, 2023

Code

#![feature(unsized_fn_params)]
pub fn f(mut x: [i32]) {
    x[0] = 1;
}

Meta

rustc --version --verbose:

rustc 1.71.0-nightly (a77c55248 2023-05-06)
binary: rustc
commit-hash: a77c552485a19245a266bc03c450676c666b605f
commit-date: 2023-05-06
host: x86_64-unknown-linux-gnu
release: 1.71.0-nightly
LLVM version: 16.0.2

Error

Backtrace

thread 'rustc' panicked at 'const-prop encountered formatting error: unsized locals are not supported', compiler/rustc_mir_transform/src/const_prop_lint.rs:271:17
stack backtrace:
   0:     0x7f832bf690d1 - std::backtrace_rs::backtrace::libunwind::trace::h748efa8d196594ea
                               at /rustc/a77c552485a19245a266bc03c450676c666b605f/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7f832bf690d1 - std::backtrace_rs::backtrace::trace_unsynchronized::hba1b195853d9d394
                               at /rustc/a77c552485a19245a266bc03c450676c666b605f/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f832bf690d1 - std::sys_common::backtrace::_print_fmt::hf5baf2e14c45ba0c
                               at /rustc/a77c552485a19245a266bc03c450676c666b605f/library/std/src/sys_common/backtrace.rs:65:5
   3:     0x7f832bf690d1 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hbf761e313ca3ada9
                               at /rustc/a77c552485a19245a266bc03c450676c666b605f/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7f832bfc9d9f - core::fmt::rt::Argument::fmt::h9a4b2d89a60be8da
                               at /rustc/a77c552485a19245a266bc03c450676c666b605f/library/core/src/fmt/rt.rs:138:9
   5:     0x7f832bfc9d9f - core::fmt::write::h66441248ae33813a
                               at /rustc/a77c552485a19245a266bc03c450676c666b605f/library/core/src/fmt/mod.rs:1094:21
   6:     0x7f832bf5c1b1 - std::io::Write::write_fmt::ha691d967a2ddc69c
                               at /rustc/a77c552485a19245a266bc03c450676c666b605f/library/std/src/io/mod.rs:1712:15
   7:     0x7f832bf68ee5 - std::sys_common::backtrace::_print::hdcec4f4c10a19269
                               at /rustc/a77c552485a19245a266bc03c450676c666b605f/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x7f832bf68ee5 - std::sys_common::backtrace::print::ha30bc382982a7953
                               at /rustc/a77c552485a19245a266bc03c450676c666b605f/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x7f832bf6bb77 - std::panicking::default_hook::{{closure}}::hcc3f39fea9e4a023
  10:     0x7f832bf6b964 - std::panicking::default_hook::h126f3b7e37854051
                               at /rustc/a77c552485a19245a266bc03c450676c666b605f/library/std/src/panicking.rs:288:9
  11:     0x7f832f17850b - <rustc_driver_impl[aec4a7513f090b1c]::install_ice_hook::{closure#0} as core[f726735fcfc4c81f]::ops::function::FnOnce<(&core[f726735fcfc4c81f]::panic::panic_info::PanicInfo,)>>::call_once::{shim:vtable#0}
  12:     0x7f832bf6c297 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h6b1f581dc385c03f
                               at /rustc/a77c552485a19245a266bc03c450676c666b605f/library/alloc/src/boxed.rs:1999:9
  13:     0x7f832bf6c297 - std::panicking::rust_panic_with_hook::ha3a27ba12ace114b
                               at /rustc/a77c552485a19245a266bc03c450676c666b605f/library/std/src/panicking.rs:695:13
  14:     0x7f832bf6c017 - std::panicking::begin_panic_handler::{{closure}}::h6db61a38b58c99ee
                               at /rustc/a77c552485a19245a266bc03c450676c666b605f/library/std/src/panicking.rs:582:13
  15:     0x7f832bf69516 - std::sys_common::backtrace::__rust_end_short_backtrace::h281ac153d73a34fc
                               at /rustc/a77c552485a19245a266bc03c450676c666b605f/library/std/src/sys_common/backtrace.rs:150:18
  16:     0x7f832bf6bd82 - rust_begin_unwind
                               at /rustc/a77c552485a19245a266bc03c450676c666b605f/library/std/src/panicking.rs:578:5
  17:     0x7f832bfc6023 - core::panicking::panic_fmt::h44f915e75f789b36
                               at /rustc/a77c552485a19245a266bc03c450676c666b605f/library/core/src/panicking.rs:67:14
  18:     0x7f832e179408 - <rustc_mir_transform[2ef7e3d9e9a6caf7]::const_prop_lint::ConstPropagator as rustc_middle[3ab9e3af7de3f1b4]::mir::visit::Visitor>::visit_basic_block_data
  19:     0x7f832e16af62 - <rustc_mir_transform[2ef7e3d9e9a6caf7]::const_prop_lint::ConstProp as rustc_mir_transform[2ef7e3d9e9a6caf7]::pass_manager::MirLint>::run_lint
  20:     0x7f832e49b16f - rustc_mir_transform[2ef7e3d9e9a6caf7]::mir_drops_elaborated_and_const_checked
  21:     0x7f832e4995f8 - rustc_query_system[917e91cab306a717]::query::plumbing::try_execute_query::<rustc_query_impl[43a49a3d2918852e]::queries::mir_drops_elaborated_and_const_checked, rustc_query_impl[43a49a3d2918852e]::plumbing::QueryCtxt>
  22:     0x7f832e612b3e - rustc_interface[8020cbc989be0ea1]::passes::analysis
  23:     0x7f832e902d07 - rustc_query_system[917e91cab306a717]::query::plumbing::try_execute_query::<rustc_query_impl[43a49a3d2918852e]::queries::analysis, rustc_query_impl[43a49a3d2918852e]::plumbing::QueryCtxt>
  24:     0x7f832e902a23 - rustc_query_impl[43a49a3d2918852e]::get_query::analysis
  25:     0x7f832e3a861f - <rustc_middle[3ab9e3af7de3f1b4]::ty::context::GlobalCtxt>::enter::<rustc_driver_impl[aec4a7513f090b1c]::run_compiler::{closure#1}::{closure#2}::{closure#4}, core[f726735fcfc4c81f]::result::Result<(), rustc_span[bfe87b81068afb7a]::ErrorGuaranteed>>
  26:     0x7f832e3a780f - <rustc_interface[8020cbc989be0ea1]::interface::Compiler>::enter::<rustc_driver_impl[aec4a7513f090b1c]::run_compiler::{closure#1}::{closure#2}, core[f726735fcfc4c81f]::result::Result<core[f726735fcfc4c81f]::option::Option<rustc_interface[8020cbc989be0ea1]::queries::Linker>, rustc_span[bfe87b81068afb7a]::ErrorGuaranteed>>
  27:     0x7f832e3a58b1 - rustc_span[bfe87b81068afb7a]::set_source_map::<core[f726735fcfc4c81f]::result::Result<(), rustc_span[bfe87b81068afb7a]::ErrorGuaranteed>, rustc_interface[8020cbc989be0ea1]::interface::run_compiler<core[f726735fcfc4c81f]::result::Result<(), rustc_span[bfe87b81068afb7a]::ErrorGuaranteed>, rustc_driver_impl[aec4a7513f090b1c]::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
  28:     0x7f832e3a4f60 - std[e4b786b2c1bf012e]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[8020cbc989be0ea1]::util::run_in_thread_pool_with_globals<rustc_interface[8020cbc989be0ea1]::interface::run_compiler<core[f726735fcfc4c81f]::result::Result<(), rustc_span[bfe87b81068afb7a]::ErrorGuaranteed>, rustc_driver_impl[aec4a7513f090b1c]::run_compiler::{closure#1}>::{closure#0}, core[f726735fcfc4c81f]::result::Result<(), rustc_span[bfe87b81068afb7a]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[f726735fcfc4c81f]::result::Result<(), rustc_span[bfe87b81068afb7a]::ErrorGuaranteed>>
  29:     0x7f832ea6b3e5 - <<std[e4b786b2c1bf012e]::thread::Builder>::spawn_unchecked_<rustc_interface[8020cbc989be0ea1]::util::run_in_thread_pool_with_globals<rustc_interface[8020cbc989be0ea1]::interface::run_compiler<core[f726735fcfc4c81f]::result::Result<(), rustc_span[bfe87b81068afb7a]::ErrorGuaranteed>, rustc_driver_impl[aec4a7513f090b1c]::run_compiler::{closure#1}>::{closure#0}, core[f726735fcfc4c81f]::result::Result<(), rustc_span[bfe87b81068afb7a]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[f726735fcfc4c81f]::result::Result<(), rustc_span[bfe87b81068afb7a]::ErrorGuaranteed>>::{closure#1} as core[f726735fcfc4c81f]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  30:     0x7f832bf76775 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hcf250329e90c3f77
                               at /rustc/a77c552485a19245a266bc03c450676c666b605f/library/alloc/src/boxed.rs:1985:9
  31:     0x7f832bf76775 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h3a648c216d9fc25d
                               at /rustc/a77c552485a19245a266bc03c450676c666b605f/library/alloc/src/boxed.rs:1985:9
  32:     0x7f832bf76775 - std::sys::unix::thread::Thread::new::thread_start::ha9800a047bb8dea3
                               at /rustc/a77c552485a19245a266bc03c450676c666b605f/library/std/src/sys/unix/thread.rs:108:17
  33:     0x7f832bd1afd4 - start_thread
                               at ./nptl/pthread_create.c:442:8
  34:     0x7f832bd9b5bc - __GI___clone3
                               at ./misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
  35:                0x0 - <unknown>

error: 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.71.0-nightly (a77c55248 2023-05-06) running on x86_64-unknown-linux-gnu

note: compiler flags: --crate-type lib

query stack during panic:
#0 [mir_drops_elaborated_and_const_checked] elaborating drops for `f`
#1 [analysis] running analysis passes on this crate
end of query stack

@tmiasko tmiasko 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. F-unsized_fn_params `#![feature(unsized_fn_params)]` requires-nightly This issue requires a nightly compiler in some way. labels May 8, 2023
@rust-lang-glacier-bot rust-lang-glacier-bot added the glacier ICE tracked in rust-lang/glacier. label Jul 14, 2023
RalfJung added a commit to RalfJung/rust that referenced this issue Aug 6, 2023
@RalfJung
Copy link
Member

RalfJung commented Aug 6, 2023

This got fixed as a side-effect of #114011. #114543 will add a test.

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-unsized_fn_params `#![feature(unsized_fn_params)]` glacier ICE tracked in rust-lang/glacier. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ requires-nightly This issue requires a nightly compiler in some way. 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.

3 participants