rust-lang / rust

Empowering everyone to build reliable and efficient software.
https://www.rust-lang.org
Other
97.9k stars 12.68k forks source link

ICE: 'copy LTO artifacts' panicked at 'no saved object file in work product' #109879

Open JangSchopenhauer opened 1 year ago

JangSchopenhauer commented 1 year ago

As you can see in my code. I'm rookie at programming. I don't know how to write a report, so I wrote every information that I know. I hope this information is useful to you.

Code


fn main() {

let value_size = (true,false);
let number = 110;
// I test many numbers at "number" variable.
// At 99, 101 value, it worked well. but when I use "100" it start to broke up, and it keep doesn't work,

if number>100 {
    print_msg(value_size.0);
    } else {
        print_msg(value_size.1);
    }
}    

// * Use a function to print the messages
fn print_msg (result : bool) {
    // * Use a match expression to determine which message
    //   to print
    match result {
        true => println!("its big"),
        false => println!("its small"),
    }

}

Meta

<version>
rustc 1.68.2 (9eb3afe9e 2023-03-27)
binary: rustc
commit-hash: 9eb3afe9ebe9c7d2b84b71002d44f4a0edac95e0
commit-date: 2023-03-27
host: x86_64-pc-windows-msvc
release: 1.68.2
LLVM version: 15.0.6

Error output

<output>

thread 'copy LTO artifacts for ocgxck580qsbn29' panicked at 'no saved object file in work product', /rustc/9eb3afe9ebe9c7d2b84b71002d44f4a0edac95e0\compiler\rustc_codegen_ssa\src\back\write.rs:890:45
stack backtrace:
   0:     0x7ffe0e6b9d02 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hbb6eec21cb8e3d1b
   1:     0x7ffe0e6f570b - core::fmt::write::h3f34d6e08b5a11e8
   2:     0x7ffe0e6acdfa - <std::io::IoSlice as core::fmt::Debug>::fmt::h1d8b4e60e4c9e548
   3:     0x7ffe0e6b9a4b - std::sys::common::alloc::realloc_fallback::h258dcd65da5985d2
   4:     0x7ffe0e6bd3f9 - std::panicking::default_hook::h90b70b966050cb60
   5:     0x7ffe0e6bd07b - std::panicking::default_hook::h90b70b966050cb60
   6:     0x7ffdbcc29425 - rustc_driver[fbeb20e0897b27eb]::describe_lints
   7:     0x7ffe0e6bdd5f - std::panicking::rust_panic_with_hook::h1d50ae3462f62f01
   8:     0x7ffe0e6bdabe - <std::panicking::begin_panic_handler::StrPanicPayload as core::panic::BoxMeUp>::get::h79e1803705c718ce
   9:     0x7ffe0e6ba9ff - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hbb6eec21cb8e3d1b
  10:     0x7ffe0e6bd770 - rust_begin_unwind
  11:     0x7ffe0e72b3d5 - core::panicking::panic_fmt::haf2d819891c687b2
  12:     0x7ffe0e6f24a0 - <core::panic::panic_info::PanicInfo as core::fmt::Display>::fmt::ha6751ac49168652e
  13:     0x7ffe0e6f244b - <core::panic::panic_info::PanicInfo as core::fmt::Display>::fmt::ha6751ac49168652e
  14:     0x7ffe0e72b399 - core::option::expect_failed::h0da32229c4d02ab1
  15:     0x7ffdba4773aa - <rustc_codegen_llvm[a370bbf5c5532cf9]::context::CodegenCx as rustc_codegen_ssa[b0364e910a0a34e7]::traits::type_::LayoutTypeMethods>::fn_ptr_backend_type
  16:     0x7ffdba418a59 - rustc_interface[5b253cef4d5aad89]::passes::start_codegen
  17:     0x7ffdba448377 - <rustc_codegen_llvm[a370bbf5c5532cf9]::builder::Builder as rustc_codegen_ssa[b0364e910a0a34e7]::traits::builder::BuilderMethods>::unchecked_smul
  18:     0x7ffe0e6d021c - std::sys::windows::thread::Thread::new::hf7aab9c244c58572
  19:     0x7ffe4b3b7614 - BaseThreadInitThunk
  20:     0x7ffe4b9c26a1 - RtlUserThreadStart

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.68.2 (9eb3afe9e 2023-03-27) running on x86_64-pc-windows-msvc

note: compiler flags: --crate-type bin -C embed-bitcode=no -C debuginfo=2 -C incremental=[REDACTED]

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
end of query stack
thread '<unnamed>' panicked at '/rustc/9eb3afe9ebe9c7d2b84b71002d44f4a0edac95e0\compiler\rustc_codegen_ssa\src\back\write.rs:1530:21: worker thread panicked', compiler\rustc_middle\src\util\bug.rs:36:26
stack backtrace:
   0:     0x7ffe0e6b9d02 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hbb6eec21cb8e3d1b
   1:     0x7ffe0e6f570b - core::fmt::write::h3f34d6e08b5a11e8
   2:     0x7ffe0e6acdfa - <std::io::IoSlice as core::fmt::Debug>::fmt::h1d8b4e60e4c9e548
   3:     0x7ffe0e6b9a4b - std::sys::common::alloc::realloc_fallback::h258dcd65da5985d2
   4:     0x7ffe0e6bd3f9 - std::panicking::default_hook::h90b70b966050cb60
   5:     0x7ffe0e6bd07b - std::panicking::default_hook::h90b70b966050cb60
   6:     0x7ffdbcc29425 - rustc_driver[fbeb20e0897b27eb]::describe_lints
   7:     0x7ffe0e6bdd5f - std::panicking::rust_panic_with_hook::h1d50ae3462f62f01
   8:     0x7ffdbefd9c5f - <rustc_middle[1d4803ea9c08b419]::ty::rvalue_scopes::RvalueScopes as core[15ae0b8045847941]::fmt::Debug>::fmt
   9:     0x7ffdbefd999c - <rustc_middle[1d4803ea9c08b419]::ty::rvalue_scopes::RvalueScopes as core[15ae0b8045847941]::fmt::Debug>::fmt
  10:     0x7ffdbef72753 - <rustc_middle[1d4803ea9c08b419]::ty::DestructuredConst as core[15ae0b8045847941]::fmt::Debug>::fmt
  11:     0x7ffdbefc54ad - rustc_middle[1d4803ea9c08b419]::util::bug::bug_fmt
  12:     0x7ffdbefc526d - <rustc_middle[1d4803ea9c08b419]::ty::subst::GenericArg as rustc_middle[1d4803ea9c08b419]::ty::context::Lift>::lift_to_tcx
  13:     0x7ffdbefc5222 - <rustc_middle[1d4803ea9c08b419]::ty::subst::GenericArg as rustc_middle[1d4803ea9c08b419]::ty::context::Lift>::lift_to_tcx
  14:     0x7ffdbefc5408 - rustc_middle[1d4803ea9c08b419]::util::bug::bug_fmt
  15:     0x7ffdbefc5385 - rustc_middle[1d4803ea9c08b419]::util::bug::bug_fmt
  16:     0x7ffdba416ccc - rustc_interface[5b253cef4d5aad89]::passes::start_codegen
  17:     0x7ffdba447e3e - <rustc_codegen_llvm[a370bbf5c5532cf9]::builder::Builder as rustc_codegen_ssa[b0364e910a0a34e7]::traits::builder::BuilderMethods>::unchecked_smul
  18:     0x7ffe0e6d021c - std::sys::windows::thread::Thread::new::hf7aab9c244c58572
  19:     0x7ffe4b3b7614 - BaseThreadInitThunk
  20:     0x7ffe4b9c26a1 - RtlUserThreadStart

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.68.2 (9eb3afe9e 2023-03-27) running on x86_64-pc-windows-msvc

note: compiler flags: --crate-type bin -C embed-bitcode=no -C debuginfo=2 -C incremental=[REDACTED]

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
end of query stack
thread 'rustc' panicked at '/rustc/9eb3afe9ebe9c7d2b84b71002d44f4a0edac95e0\compiler\rustc_codegen_ssa\src\back\write.rs:1888:17: panic during codegen/LLVM phase', compiler\rustc_middle\src\util\bug.rs:36:26
stack backtrace:
   0:     0x7ffe0e6b9d02 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hbb6eec21cb8e3d1b
   1:     0x7ffe0e6f570b - core::fmt::write::h3f34d6e08b5a11e8
   2:     0x7ffe0e6acdfa - <std::io::IoSlice as core::fmt::Debug>::fmt::h1d8b4e60e4c9e548
   3:     0x7ffe0e6b9a4b - std::sys::common::alloc::realloc_fallback::h258dcd65da5985d2
   4:     0x7ffe0e6bd3f9 - std::panicking::default_hook::h90b70b966050cb60
   5:     0x7ffe0e6bd07b - std::panicking::default_hook::h90b70b966050cb60
   6:     0x7ffdbcc29425 - rustc_driver[fbeb20e0897b27eb]::describe_lints
   7:     0x7ffe0e6bdd5f - std::panicking::rust_panic_with_hook::h1d50ae3462f62f01
   8:     0x7ffdbefd9c5f - <rustc_middle[1d4803ea9c08b419]::ty::rvalue_scopes::RvalueScopes as core[15ae0b8045847941]::fmt::Debug>::fmt
   9:     0x7ffdbefd999c - <rustc_middle[1d4803ea9c08b419]::ty::rvalue_scopes::RvalueScopes as core[15ae0b8045847941]::fmt::Debug>::fmt
  10:     0x7ffdbef72753 - <rustc_middle[1d4803ea9c08b419]::ty::DestructuredConst as core[15ae0b8045847941]::fmt::Debug>::fmt
  11:     0x7ffdbefc54ad - rustc_middle[1d4803ea9c08b419]::util::bug::bug_fmt
  12:     0x7ffdbefc526d - <rustc_middle[1d4803ea9c08b419]::ty::subst::GenericArg as rustc_middle[1d4803ea9c08b419]::ty::context::Lift>::lift_to_tcx
  13:     0x7ffdbefc5222 - <rustc_middle[1d4803ea9c08b419]::ty::subst::GenericArg as rustc_middle[1d4803ea9c08b419]::ty::context::Lift>::lift_to_tcx
  14:     0x7ffdbefc5408 - rustc_middle[1d4803ea9c08b419]::util::bug::bug_fmt
  15:     0x7ffdbefc5385 - rustc_middle[1d4803ea9c08b419]::util::bug::bug_fmt
  16:     0x7ffdba43ec8e - rustc_codegen_llvm[a370bbf5c5532cf9]::llvm_::set_value_name
  17:     0x7ffdba484a58 - <rustc_codegen_llvm[a370bbf5c5532cf9]::context::CodegenCx as rustc_codegen_ssa[b0364e910a0a34e7]::traits::type_::LayoutTypeMethods>::fn_ptr_backend_type
  18:     0x7ffdba420309 - <rustc_codegen_llvm[a370bbf5c5532cf9]::LlvmCodegenBackend as rustc_codegen_ssa[b0364e910a0a34e7]::traits::backend::CodegenBackend>::join_codegen
  19:     0x7ffdba3de2f1 - <rustc_interface[5b253cef4d5aad89]::queries::Linker>::link
  20:     0x7ffdba392b9e - <unknown>
  21:     0x7ffdba39cacb - <rustc_middle[1d4803ea9c08b419]::ty::SymbolName as core[15ae0b8045847941]::fmt::Debug>::fmt
  22:     0x7ffdba39c319 - <rustc_middle[1d4803ea9c08b419]::ty::SymbolName as core[15ae0b8045847941]::fmt::Debug>::fmt
  23:     0x7ffdba39404d - <rustc_middle[1d4803ea9c08b419]::ty::SymbolName as core[15ae0b8045847941]::fmt::Debug>::fmt
  24:     0x7ffe0e6d021c - std::sys::windows::thread::Thread::new::hf7aab9c244c58572
  25:     0x7ffe4b3b7614 - BaseThreadInitThunk
  26:     0x7ffe4b9c26a1 - RtlUserThreadStart

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.68.2 (9eb3afe9e 2023-03-27) running on x86_64-pc-windows-msvc

note: compiler flags: --crate-type bin -C embed-bitcode=no -C debuginfo=2 -C incremental=[REDACTED]

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
end of query stack
error: could not compile `activities`
Backtrace

``` ```

saethlin commented 1 year ago

Just to clear a few things up

As you can see in my code. I'm rookie at programming.

This is the kind of code we usually see in reports like this. The only thing that looks rookie here is that you don't use rustfmt. rustup component add rustfmt then run cargo fmt. If you want. (Your editor may also have a plugin)

I don't know how to write a report, so I wrote every information that I know.

Perfect. That's how you write a good report. You're doing great, really.

JangSchopenhauer commented 1 year ago

Thanks a lot for your comment. Really I am. and from now I'll try to learn about & use rustfmt.

Noratrieb commented 1 year ago

One thing missing is the command you ran. I assume it's cargo build --release, is that correct?

JangSchopenhauer commented 1 year ago

does it necessary? until now, I didn't use cargo build --release.

jyn514 commented 1 year ago

@Nilstrieb you can see it's the dev profile with ~default settings from the flags:

note: compiler flags: --crate-type bin -C embed-bitcode=no -C debuginfo=2 -C incremental=[REDACTED]
jyn514 commented 1 year ago

Relevant code: https://github.com/rust-lang/rust/blob/d0eed58a1e78eb1a25bb54076e4b0f7ea5ff7401/compiler/rustc_codegen_ssa/src/back/write.rs#L895