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: index out of bounds: the len is 1 but the index is 2' in format macro #99261

Closed
Cryptex-github opened this issue Jul 15, 2022 · 4 comments · Fixed by #99263
Closed

ICE: index out of bounds: the len is 1 but the index is 2' in format macro #99261

Cryptex-github opened this issue Jul 15, 2022 · 4 comments · Fixed by #99263
Assignees
Labels
C-bug Category: This is a bug. 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.

Comments

@Cryptex-github
Copy link

Code

I don't know how this ICE happened, nor can I reproduce it on another machine. It only occurs in CI.

CI Output:
https://github.com/jay3332/Turbine/runs/7350777961

Repo:
https://github.com/jay3332/Turbine/tree/d77c84af2eb0dbd06825045ae0deb3ae18d98672

Meta

rustc --version --verbose:

rustc 1.64.0-nightly (c2f428d2f 2022-07-14)
binary: rustc
commit-hash: c2f428d2f3340a0e7d995f4726223db91b93704c
commit-date: 2022-07-14
host: x86_64-unknown-linux-gnu
release: 1.64.0-nightly
LLVM version: 14.0.6

Seems to be originating from this line: https://github.com/rust-lang/rust/blob/1219f72f9049817cf5933112f75bbddf360a7a1f/compiler/rustc_builtin_macros/src/format.rs#L1001/src/format.rs#L1001

Error output

Compiling time v0.3.11
thread 'rustc' panicked at 'index out of bounds: the len is 1 but the index is 2', compiler/rustc_builtin_macros/src/format.rs:1001:28
<stack backtrace>
Compiling time v0.1.44
error: internal compiler error: unexpected panic
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.64.0-nightly (c2f428d2f 2022-07-14) running on x86_64-unknown-linux-gnu
note: compiler flags: --crate-type lib -C embed-bitcode=no -C debuginfo=2
note: some of the compiler flags provided by cargo are hidden
query stack during panic:
end of query stack
error: could not compile `time`
Backtrace

stack backtrace:
   0:     0x7fcce027f950 - std::backtrace_rs::backtrace::libunwind::trace::heeafe1f1ea6b4c2f
                               at /rustc/c2f428d2f3340a0e7d995f4726223db91b93704c/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   1:     0x7fcce027f950 - std::backtrace_rs::backtrace::trace_unsynchronized::hf08684e78cd6c167
                               at /rustc/c2f428d2f3340a0e7d995f4726223db91b93704c/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7fcce027f950 - std::sys_common::backtrace::_print_fmt::had9e99c2c8763a1e
                               at /rustc/c2f428d2f3340a0e7d995f4726223db91b93704c/library/std/src/sys_common/backtrace.rs:66:5
   3:     0x7fcce027f950 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h1b4c432d2a1e6303
                               at /rustc/c2f428d2f3340a0e7d995f4726223db91b93704c/library/std/src/sys_common/backtrace.rs:45:22
   4:     0x7fcce02d8f2c - core::fmt::write::h87085de871a99231
                               at /rustc/c2f428d2f3340a0e7d995f4726223db91b93704c/library/core/src/fmt/mod.rs:1198:17
   5:     0x7fcce0271015 - std::io::Write::write_fmt::h7635d2f423aa55dc
                               at /rustc/c2f428d2f3340a0e7d995f4726223db91b93704c/library/std/src/io/mod.rs:1672:15
   6:     0x7fcce02825e1 - std::sys_common::backtrace::_print::hc003bc1c22b7967b
                               at /rustc/c2f428d2f3340a0e7d995f4726223db91b93704c/library/std/src/sys_common/backtrace.rs:48:5
   7:     0x7fcce02825e1 - std::sys_common::backtrace::print::h1baa1ab7758e52b0
                               at /rustc/c2f428d2f3340a0e7d995f4726223db91b93704c/library/std/src/sys_common/backtrace.rs:35:9
   8:     0x7fcce02825e1 - std::panicking::default_hook::{{closure}}::he2f5e84c6ab77817
                               at /rustc/c2f428d2f3340a0e7d995f4726223db91b93704c/library/std/src/panicking.rs:295:22
   9:     0x7fcce02822b3 - std::panicking::default_hook::h3f96069db270c68f
                               at /rustc/c2f428d2f3340a0e7d995f4726223db91b93704c/library/std/src/panicking.rs:314:9
  10:     0x7fcce0aa9de4 - rustc_driver[1ce26eb46f30f4d]::DEFAULT_HOOK::{closure#0}::{closure#0}
  11:     0x7fcce0282db6 - std::panicking::rust_panic_with_hook::hed0c1597bbc695a6
                               at /rustc/c2f428d2f3340a0e7d995f4726223db91b93704c/library/std/src/panicking.rs:702:17
  12:     0x7fcce0282c07 - std::panicking::begin_panic_handler::{{closure}}::h0fc9e6b3154da131
                               at /rustc/c2f428d2f3340a0e7d995f4726223db91b93704c/library/std/src/panicking.rs:588:13
  13:     0x7fcce027fe34 - std::sys_common::backtrace::__rust_end_short_backtrace::hb9c2240a67931ff9
                               at /rustc/c2f428d2f3340a0e7d995f4726223db91b93704c/library/std/src/sys_common/backtrace.rs:138:18
  14:     0x7fcce0282932 - rust_begin_unwind
                               at /rustc/c2f428d2f3340a0e7d995f4726223db91b93704c/library/std/src/panicking.rs:584:5
  15:     0x7fcce0246c33 - core::panicking::panic_fmt::h6bda1b0556b509cd
                               at /rustc/c2f428d2f3340a0e7d995f4726223db91b93704c/library/core/src/panicking.rs:142:14
  16:     0x7fcce0246b72 - core::panicking::panic_bounds_check::hf8fc252dfbb36006
                               at /rustc/c2f428d2f3340a0e7d995f4726223db91b93704c/library/core/src/panicking.rs:84:5
  17:     0x7fcce2ee4643 - rustc_builtin_macros[6a564b3b10d3c327]::format::expand_preparsed_format_args
  18:     0x7fcce2edddac - rustc_builtin_macros[6a564b3b10d3c327]::format::expand_format_args_impl
  19:     0x7fcce281cbed - <rustc_expand[ec7f7165620ca96d]::expand::MacroExpander>::fully_expand_fragment
  20:     0x7fcce339194b - <rustc_expand[ec7f7165620ca96d]::expand::MacroExpander>::expand_crate
  21:     0x7fcce2cb6aa2 - <rustc_session[4ac326324d613686]::session::Session>::time::<core[32c218dbf3427c26]::result::Result<rustc_ast[f9ddef6e3c579104]::ast::Crate, rustc_errors[3b3e5bcd1e9c2834]::ErrorGuaranteed>, rustc_interface[694c7ab70a1d38bc]::passes::configure_and_expand::{closure#1}>
  22:     0x7fcce2ca0832 - rustc_interface[694c7ab70a1d38bc]::passes::configure_and_expand
  23:     0x7fcce2cad2c1 - <rustc_interface[694c7ab70a1d38bc]::queries::Queries>::expansion
  24:     0x7fcce2c6bfcc - <rustc_interface[694c7ab70a1d38bc]::interface::Compiler>::enter::<rustc_driver[1ce26eb46f30f4d]::run_compiler::{closure#1}::{closure#2}, core[32c218dbf3427c26]::result::Result<core[32c218dbf3427c26]::option::Option<rustc_interface[694c7ab70a1d38bc]::queries::Linker>, rustc_errors[3b3e5bcd1e9c2834]::ErrorGuaranteed>>
  25:     0x7fcce2c681ff - rustc_span[717885ec7c6cd182]::with_source_map::<core[32c218dbf3427c26]::result::Result<(), rustc_errors[3b3e5bcd1e9c2834]::ErrorGuaranteed>, rustc_interface[694c7ab70a1d38bc]::interface::create_compiler_and_run<core[32c218dbf3427c26]::result::Result<(), rustc_errors[3b3e5bcd1e9c2834]::ErrorGuaranteed>, rustc_driver[1ce26eb46f30f4d]::run_compiler::{closure#1}>::{closure#1}>
  26:     0x7fcce2c844b0 - rustc_interface[694c7ab70a1d38bc]::interface::create_compiler_and_run::<core[32c218dbf3427c26]::result::Result<(), rustc_errors[3b3e5bcd1e9c2834]::ErrorGuaranteed>, rustc_driver[1ce26eb46f30f4d]::run_compiler::{closure#1}>
  27:     0x7fcce2c985b2 - <scoped_tls[f235d80db834c386]::ScopedKey<rustc_span[717885ec7c6cd182]::SessionGlobals>>::set::<rustc_interface[694c7ab70a1d38bc]::interface::run_compiler<core[32c218dbf3427c26]::result::Result<(), rustc_errors[3b3e5bcd1e9c2834]::ErrorGuaranteed>, rustc_driver[1ce26eb46f30f4d]::run_compiler::{closure#1}>::{closure#0}, core[32c218dbf3427c26]::result::Result<(), rustc_errors[3b3e5bcd1e9c2834]::ErrorGuaranteed>>
  28:     0x7fcce2c6a78f - std[167b23ae759531ff]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[694c7ab70a1d38bc]::util::run_in_thread_pool_with_globals<rustc_interface[694c7ab70a1d38bc]::interface::run_compiler<core[32c218dbf3427c26]::result::Result<(), rustc_errors[3b3e5bcd1e9c2834]::ErrorGuaranteed>, rustc_driver[1ce26eb46f30f4d]::run_compiler::{closure#1}>::{closure#0}, core[32c218dbf3427c26]::result::Result<(), rustc_errors[3b3e5bcd1e9c2834]::ErrorGuaranteed>>::{closure#0}, core[32c218dbf3427c26]::result::Result<(), rustc_errors[3b3e5bcd1e9c2834]::ErrorGuaranteed>>
  29:     0x7fcce2c84909 - <<std[167b23ae759531ff]::thread::Builder>::spawn_unchecked_<rustc_interface[694c7ab70a1d38bc]::util::run_in_thread_pool_with_globals<rustc_interface[694c7ab70a1d38bc]::interface::run_compiler<core[32c218dbf3427c26]::result::Result<(), rustc_errors[3b3e5bcd1e9c2834]::ErrorGuaranteed>, rustc_driver[1ce26eb46f30f4d]::run_compiler::{closure#1}>::{closure#0}, core[32c218dbf3427c26]::result::Result<(), rustc_errors[3b3e5bcd1e9c2834]::ErrorGuaranteed>>::{closure#0}, core[32c218dbf3427c26]::result::Result<(), rustc_errors[3b3e5bcd1e9c2834]::ErrorGuaranteed>>::{closure#1} as core[32c218dbf3427c26]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  30:     0x7fcce028c803 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h86b1834fb0da834b
                               at /rustc/c2f428d2f3340a0e7d995f4726223db91b93704c/library/alloc/src/boxed.rs:1934:9
  31:     0x7fcce028c803 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h124d05192aaf60e0
                               at /rustc/c2f428d2f3340a0e7d995f4726223db91b93704c/library/alloc/src/boxed.rs:1934:9
  32:     0x7fcce028c803 - std::sys::unix::thread::Thread::new::thread_start::h01e8d05fb6e030ea
                               at /rustc/c2f428d2f3340a0e7d995f4726223db91b93704c/library/std/src/sys/unix/thread.rs:108:17
  33:     0x7fcce01a3609 - start_thread
  34:     0x7fcce00c6133 - clone
  35:                0x0 - <unknown>
error: internal compiler error: unexpected panic
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.64.0-nightly (c2f428d2f 2022-07-14) running on x86_64-unknown-linux-gnu
note: compiler flags: --crate-type lib -C embed-bitcode=no -C debuginfo=2
note: some of the compiler flags provided by cargo are hidden
query stack during panic:
end of query stack

@Cryptex-github Cryptex-github added C-bug Category: This is a bug. 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. labels Jul 15, 2022
@compiler-errors
Copy link
Member

Reproduces a bit easier by making a blank cargo project with all of the time crate's features enabled. I'll look into this!

@Cryptex-github
Copy link
Author

Reproduces a bit easier by making a blank cargo project with all of the time crate's features enabled. I'll look into this!

Thank you for looking into it this quickly. I really appreciate it!

@ithinuel
Copy link
Contributor

ithinuel commented Jul 15, 2022

Discovered this issue while installing cargo-flash v0.13.0 and svls v0.2.4 on my MacBook Air M1, both failing during compilation of the time dependency.

@letto4135
Copy link

Reproducible on my m1, just run cargo install trunk when on nightly, complies fine on stable.

@matthiaskrgr matthiaskrgr pinned this issue Jul 16, 2022
@bors bors closed this as completed in 5635158 Jul 16, 2022
@joshtriplett joshtriplett unpinned this issue Jul 16, 2022
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) ❄️ 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