Skip to content

ICE when using Instant type with the time crate. #125484

Closed

Description

@bend-n

Code

type hi_rustc_devs_you_are_the_best = std::time::Instant;
fn main() {}
[dependencies]
time = { version = "=0.3.36", default-features = false }
rustc 1.80.0-nightly (867900499 2024-05-23)
binary: rustc
commit-hash: 8679004993f08807289911d9f400f4ac4391d2bc
commit-date: 2024-05-23
host: x86_64-unknown-linux-gnu
release: 1.80.0-nightly
LLVM version: 18.1.6

make sure to use cargo {build, run, test}.

Error output

thread 'rustc' panicked at compiler/rustc_codegen_ssa/src/back/link.rs:2700:27:
index out of bounds: the len is 19 but the index is 19
Backtrace

thread 'rustc' panicked at compiler/rustc_codegen_ssa/src/back/link.rs:2700:27:
index out of bounds: the len is 19 but the index is 19
stack backtrace:
   0:     0x7f4c72d14bd5 - std::backtrace_rs::backtrace::libunwind::trace::hc81ddd892f37780a
                               at /rustc/8679004993f08807289911d9f400f4ac4391d2bc/library/std/src/../../backtrace/src/backtrace/libunwind.rs:105:5
   1:     0x7f4c72d14bd5 - std::backtrace_rs::backtrace::trace_unsynchronized::h25113f8f3907d8be
                               at /rustc/8679004993f08807289911d9f400f4ac4391d2bc/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f4c72d14bd5 - std::backtrace::Backtrace::create::h4f3748e24e2503eb
                               at /rustc/8679004993f08807289911d9f400f4ac4391d2bc/library/std/src/backtrace.rs:331:13
   3:     0x7f4c72d14b25 - std::backtrace::Backtrace::force_capture::he79a6af8ebf22849
                               at /rustc/8679004993f08807289911d9f400f4ac4391d2bc/library/std/src/backtrace.rs:312:9
   4:     0x7f4c6f713446 - std[c84386057951cdf1]::panicking::update_hook::<alloc[4592256d7c6fc8c3]::boxed::Box<rustc_driver_impl[c7973d17cf87f5de]::install_ice_hook::{closure#0}>>::{closure#0}
   5:     0x7f4c72d2f95b - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h44aa27eef4dccdcb
                               at /rustc/8679004993f08807289911d9f400f4ac4391d2bc/library/alloc/src/boxed.rs:2077:9
   6:     0x7f4c72d2f95b - std::panicking::rust_panic_with_hook::h1aa3c5553cd412a6
                               at /rustc/8679004993f08807289911d9f400f4ac4391d2bc/library/std/src/panicking.rs:799:13
   7:     0x7f4c72d2f6d4 - std::panicking::begin_panic_handler::{{closure}}::ha60e6e6c3ca02408
                               at /rustc/8679004993f08807289911d9f400f4ac4391d2bc/library/std/src/panicking.rs:664:13
   8:     0x7f4c72d2cee9 - std::sys_common::backtrace::__rust_end_short_backtrace::he47d033b604f34e1
                               at /rustc/8679004993f08807289911d9f400f4ac4391d2bc/library/std/src/sys_common/backtrace.rs:171:18
   9:     0x7f4c72d2f407 - rust_begin_unwind
                               at /rustc/8679004993f08807289911d9f400f4ac4391d2bc/library/std/src/panicking.rs:652:5
  10:     0x7f4c72d780c3 - core::panicking::panic_fmt::he0b49d9fe944afab
                               at /rustc/8679004993f08807289911d9f400f4ac4391d2bc/library/core/src/panicking.rs:72:14
  11:     0x7f4c72d782e7 - core::panicking::panic_bounds_check::h4aab5c6abdb84502
                               at /rustc/8679004993f08807289911d9f400f4ac4391d2bc/library/core/src/panicking.rs:274:5
  12:     0x7f4c7182f58e - rustc_codegen_ssa[de9b47d4234be54f]::back::link::linker_with_args
  13:     0x7f4c71824b1e - rustc_codegen_ssa[de9b47d4234be54f]::back::link::link_natively
  14:     0x7f4c71754a0f - rustc_codegen_ssa[de9b47d4234be54f]::back::link::link_binary
  15:     0x7f4c71753f22 - <rustc_codegen_llvm[63b5484f8e8a1abd]::LlvmCodegenBackend as rustc_codegen_ssa[de9b47d4234be54f]::traits::backend::CodegenBackend>::link
  16:     0x7f4c7175737a - <rustc_interface[1555bb895ed40208]::queries::Linker>::link
  17:     0x7f4c715b8aa9 - rustc_interface[1555bb895ed40208]::interface::run_compiler::<core[d780e6c6047fe0c9]::result::Result<(), rustc_span[7e054f7c4ab6d345]::ErrorGuaranteed>, rustc_driver_impl[c7973d17cf87f5de]::run_compiler::{closure#0}>::{closure#1}
  18:     0x7f4c715a3f67 - std[c84386057951cdf1]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[1555bb895ed40208]::util::run_in_thread_with_globals<rustc_interface[1555bb895ed40208]::util::run_in_thread_pool_with_globals<rustc_interface[1555bb895ed40208]::interface::run_compiler<core[d780e6c6047fe0c9]::result::Result<(), rustc_span[7e054f7c4ab6d345]::ErrorGuaranteed>, rustc_driver_impl[c7973d17cf87f5de]::run_compiler::{closure#0}>::{closure#1}, core[d780e6c6047fe0c9]::result::Result<(), rustc_span[7e054f7c4ab6d345]::ErrorGuaranteed>>::{closure#0}, core[d780e6c6047fe0c9]::result::Result<(), rustc_span[7e054f7c4ab6d345]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[d780e6c6047fe0c9]::result::Result<(), rustc_span[7e054f7c4ab6d345]::ErrorGuaranteed>>
  19:     0x7f4c715a3d2a - <<std[c84386057951cdf1]::thread::Builder>::spawn_unchecked_<rustc_interface[1555bb895ed40208]::util::run_in_thread_with_globals<rustc_interface[1555bb895ed40208]::util::run_in_thread_pool_with_globals<rustc_interface[1555bb895ed40208]::interface::run_compiler<core[d780e6c6047fe0c9]::result::Result<(), rustc_span[7e054f7c4ab6d345]::ErrorGuaranteed>, rustc_driver_impl[c7973d17cf87f5de]::run_compiler::{closure#0}>::{closure#1}, core[d780e6c6047fe0c9]::result::Result<(), rustc_span[7e054f7c4ab6d345]::ErrorGuaranteed>>::{closure#0}, core[d780e6c6047fe0c9]::result::Result<(), rustc_span[7e054f7c4ab6d345]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[d780e6c6047fe0c9]::result::Result<(), rustc_span[7e054f7c4ab6d345]::ErrorGuaranteed>>::{closure#2} as core[d780e6c6047fe0c9]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  20:     0x7f4c72d3973b - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::he7419603c6721fe9
                               at /rustc/8679004993f08807289911d9f400f4ac4391d2bc/library/alloc/src/boxed.rs:2063:9
  21:     0x7f4c72d3973b - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hdd889fbd56bc6c7f
                               at /rustc/8679004993f08807289911d9f400f4ac4391d2bc/library/alloc/src/boxed.rs:2063:9
  22:     0x7f4c72d3973b - std::sys::pal::unix::thread::Thread::new::thread_start::hc8faaa9672833890
                               at /rustc/8679004993f08807289911d9f400f4ac4391d2bc/library/std/src/sys/pal/unix/thread.rs:108:17
  23:     0x7f4c6c4a6ded - <unknown>
  24:     0x7f4c6c52a0dc - <unknown>
  25:                0x0 - <unknown>


rustc version: 1.80.0-nightly (867900499 2024-05-23)
platform: x86_64-unknown-linux-gnu

Activity

  1. added
    C-bugCategory: This is a bug.
    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.
    on May 24, 2024
  2. added
    needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
    on May 24, 2024
  3. workingjubilee commented on May 24, 2024

    @workingjubilee
    Member

    hmm, probable duplicate of #125474

  4. bend-n commented on May 24, 2024

    @bend-n
    ContributorAuthor

    it might be, but also this one is tied to a Instant, so we can see if this one gets resolved too when that one is resolved, perhaps?

  5. lqd commented on May 24, 2024

    @lqd
    Member

    Yes, this is a duplicate of #125474. That issue contains an MCVE, so I'll close this one as a duplicate to focus discussion in a single place.

    Thanks for opening an issue!

    I'll prepare a draft revert of #124976 in case @petrochenkov doesn't have time to investigate/fix before the next nightly.

  6. theemathas commented on May 24, 2024

    @theemathas
    Contributor

    @lqd I believe this is a different ICE. The repro in #125474 seems to be with circular dependencies a proc macro crate. I have this repro which ICEs when a module name is the same as a crate name.

    Cargo.toml

    [package]
    name = "foo"
    version = "0.1.0"
    edition = "2021"
    
    [dependencies]
    same = { path = "same" }

    src/main.rs

    #![allow(dead_code)]
    
    type Foo = something::same::Thing;
    
    mod something {
        pub mod same {
            pub struct Thing;
        }
    }
    
    fn main() {}

    same/src/Cargo.toml

    [package]
    edition = "2021"
    name = "same"
    version = "0.1.0"

    same/src/lib.rs

    // empty
  7. lqd commented on May 24, 2024

    @lqd
    Member

    AFAICT there is no circular dependency in that other repro, but ok.

  8. reopened this on May 24, 2024
  9. lqd commented on May 24, 2024

    @lqd
    Member

    @theemathas fwiw time also has proc-macros with dependencies

  10. added
    A-codegenArea: Code generation
    and removed
    needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
    on May 24, 2024
  11. added a commit that references this issue on Jun 6, 2024
  12. added a commit that references this issue on Jun 6, 2024
  13. added a commit that references this issue on Jun 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-codegenArea: Code generationC-bugCategory: This is a bug.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.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions