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 when using Instant type with the time crate. #125484

Closed
bend-n opened this issue May 24, 2024 · 6 comments · Fixed by #126068
Closed

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

bend-n opened this issue May 24, 2024 · 6 comments · Fixed by #126068
Labels
A-codegen Area: Code generation 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

@bend-n
Copy link
Contributor

bend-n commented May 24, 2024

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

@bend-n bend-n 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 May 24, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label May 24, 2024
@workingjubilee
Copy link
Member

hmm, probable duplicate of #125474

@bend-n
Copy link
Contributor Author

bend-n commented May 24, 2024

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?

@lqd
Copy link
Member

lqd commented May 24, 2024

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.

@lqd lqd closed this as not planned Won't fix, can't repro, duplicate, stale May 24, 2024
@theemathas
Copy link
Contributor

theemathas commented May 24, 2024

@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

@lqd
Copy link
Member

lqd commented May 24, 2024

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

@lqd lqd reopened this May 24, 2024
@lqd
Copy link
Member

lqd commented May 24, 2024

@theemathas fwiw time also has proc-macros with dependencies

@jieyouxu jieyouxu added A-codegen Area: Code generation and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels May 24, 2024
fmease added a commit to fmease/rust that referenced this issue Jun 6, 2024
Revert "use `tcx.used_crates(())` more" before it reaches beta

There are more open issues caused by rust-lang#124976 than will be fixed by rust-lang#125493 alone. The beta cut is soon, so let's revert it and buy some time to analyze and fix these issues in our own time.

fixes rust-lang#125474
fixes rust-lang#125484
fixes rust-lang#125646
fixes rust-lang#125707
fixes rust-lang#126066
fixes rust-lang#125934
fixes rust-lang#126021

r? `@petrochenkov`
`@bors` p=1
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this issue Jun 6, 2024
Revert "use `tcx.used_crates(())` more" before it reaches beta

There are more open issues caused by rust-lang#124976 than will be fixed by rust-lang#125493 alone. The beta cut is soon, so let's revert it and buy some time to analyze and fix these issues in our own time.

fixes rust-lang#125474
fixes rust-lang#125484
fixes rust-lang#125646
fixes rust-lang#125707
fixes rust-lang#126066
fixes rust-lang#125934
fixes rust-lang#126021

r? ``@petrochenkov``
``@bors`` p=1
@bors bors closed this as completed in 98489f2 Jun 6, 2024
github-actions bot pushed a commit to rust-lang/miri that referenced this issue Jun 7, 2024
Revert "use `tcx.used_crates(())` more" before it reaches beta

There are more open issues caused by #124976 than will be fixed by #125493 alone. The beta cut is soon, so let's revert it and buy some time to analyze and fix these issues in our own time.

fixes rust-lang/rust#125474
fixes rust-lang/rust#125484
fixes rust-lang/rust#125646
fixes rust-lang/rust#125707
fixes #126066
fixes #125934
fixes rust-lang/rust#126021

r? `@petrochenkov`
`@bors` p=1
flip1995 pushed a commit to flip1995/rust-clippy that referenced this issue Jun 13, 2024
Revert "use `tcx.used_crates(())` more" before it reaches beta

There are more open issues caused by #124976 than will be fixed by #125493 alone. The beta cut is soon, so let's revert it and buy some time to analyze and fix these issues in our own time.

fixes rust-lang/rust#125474
fixes rust-lang/rust#125484
fixes rust-lang/rust#125646
fixes rust-lang/rust#125707
fixes #126066
fixes #125934
fixes rust-lang/rust#126021

r? `@petrochenkov`
`@bors` p=1
flip1995 pushed a commit to flip1995/rust-clippy that referenced this issue Jun 28, 2024
Revert "use `tcx.used_crates(())` more" before it reaches beta

There are more open issues caused by #124976 than will be fixed by #125493 alone. The beta cut is soon, so let's revert it and buy some time to analyze and fix these issues in our own time.

fixes rust-lang/rust#125474
fixes rust-lang/rust#125484
fixes rust-lang/rust#125646
fixes rust-lang/rust#125707
fixes #126066
fixes #125934
fixes rust-lang/rust#126021

r? `@petrochenkov`
`@bors` p=1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-codegen Area: Code generation 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
6 participants