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 force-linking resource using winres #98055

Closed
Super-Pizza opened this issue Jun 13, 2022 · 1 comment
Closed

ICE force-linking resource using winres #98055

Super-Pizza opened this issue Jun 13, 2022 · 1 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.

Comments

@Super-Pizza
Copy link

Super-Pizza commented Jun 13, 2022

Code

build.rs:

fn main() {
    if cfg!(target_os = "windows") {
        let mut res = winres::WindowsResource::new();
        res.set_icon_with_id("icon.ico", "1");
        res.compile().unwrap();
    }
}

cargo.toml:

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

[build-dependencies]
winres = "0.1"

Running cargo rustc -- -l static:+whole-archive=resource ICEs

Meta

rustc --version --verbose:

rustc 1.61.0 (fe5b13d68 2022-05-18)
binary: rustc
commit-hash: fe5b13d681f25ee6474be29d748c65adcd91f69e
commit-date: 2022-05-18
host: x86_64-pc-windows-gnu
release: 1.61.0
LLVM version: 14.0.0

Error output

thread 'rustc' panicked at 'called `Option::unwrap()` on a `None` value', compiler\rustc_metadata\src\native_libs.rs:386:74

//Backtrace

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.61.0 (fe5b13d68 2022-05-18) running on x86_64-pc-windows-gnu

note: compiler flags: --crate-type bin -C embed-bitcode=no -C debuginfo=2 -C incremental -C target-feature=+crt-static

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

query stack during panic:
#0 [native_libraries] looking up the native libraries of a linked crate
end of query stack
stack backtrace:
   0:         0x663cadd0 - std::backtrace_rs::backtrace::dbghelp::trace::h97ee1f5cd8c99222
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e\/library\std\src\..\..\backtrace\src\backtrace/dbghelp.rs:98:5
   1:         0x663cadd0 - std::backtrace_rs::backtrace::trace_unsynchronized::hca9514563d535d79
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e\/library\std\src\..\..\backtrace\src\backtrace/mod.rs:66:5
   2:         0x663cadd0 - std::sys_common::backtrace::_print_fmt::h5091a9ac0e137374
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e\/library\std\src\sys_common/backtrace.rs:66:5
   3:         0x663cadd0 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h595f8b1acf763f32
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e\/library\std\src\sys_common/backtrace.rs:45:22
   4:         0x6642bc2a - core::fmt::write::h5d420c3939530848
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e\/library\core\src\fmt/mod.rs:1194:17
   5:         0x663bd133 - std::io::Write::write_fmt::hea00669dfe5d94db
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e\/library\std\src\io/mod.rs:1655:15
   6:         0x663ce019 - std::sys_common::backtrace::_print::hd09887ca85ce7833
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e\/library\std\src\sys_common/backtrace.rs:48:5
   7:         0x663ce019 - std::sys_common::backtrace::print::h597452910002c5b1
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e\/library\std\src\sys_common/backtrace.rs:35:9
   8:         0x663ce019 - std::panicking::default_hook::{{closure}}::h7b626b282e7ce79b
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e\/library\std\src/panicking.rs:295:22
   9:         0x663cdc9d - std::panicking::default_hook::ha46aeb549e508cbe
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e\/library\std\src/panicking.rs:314:9
  10:         0x66d693d6 - rustc_driver[fc14363f33175fa1]::DEFAULT_HOOK::{closure#0}::{closure#0}
  11:         0x663ce8eb - std::panicking::rust_panic_with_hook::h7db84b8bdf224ccb
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e\/library\std\src/panicking.rs:702:17
  12:         0x663ce5f7 - std::panicking::begin_panic_handler::{{closure}}::hfd4a1776387728e4
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e\/library\std\src/panicking.rs:586:13
  13:         0x663cb7c7 - std::sys_common::backtrace::__rust_end_short_backtrace::hcad19b897b28265c
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e\/library\std\src\sys_common/backtrace.rs:138:18
  14:         0x663ce369 - rust_begin_unwind
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e\/library\std\src/panicking.rs:584:5
  15:         0x664286a5 - core::panicking::panic_fmt::h43a1cc0716104479
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e\/library\core\src/panicking.rs:143:14
  16:         0x664284ec - core::panicking::panic::h86995b8cb2e9cd4c
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e\/library\core\src/panicking.rs:48:5
  17:         0x68a2442e - <alloc[9cfaa136b693c194]::vec::drain_filter::DrainFilter<rustc_session[a711795dc12485c4]::cstore::NativeLib, <rustc_metadata[2cdaf7bbd713f9ed]::native_libs::Collector>::process_command_line::{closure#2}> as core[eb16051bbd0320a4]::iter::traits::iterator::Iterator>::next
  18:         0x68abc2eb - <alloc[9cfaa136b693c194]::vec::Vec<rustc_session[a711795dc12485c4]::cstore::NativeLib> as alloc[9cfaa136b693c194]::vec::spec_from_iter::SpecFromIter<rustc_session[a711795dc12485c4]::cstore::NativeLib, alloc[9cfaa136b693c194]::vec::drain_filter::DrainFilter<rustc_session[a711795dc12485c4]::cstore::NativeLib, <rustc_metadata[2cdaf7bbd713f9ed]::native_libs::Collector>::process_command_line::{closure#2}>>>::from_iter
  19:         0x68b1ae9b - rustc_metadata[2cdaf7bbd713f9ed]::native_libs::collect
  20:         0x68aeba77 - <rustc_metadata[2cdaf7bbd713f9ed]::rmeta::decoder::cstore_impl::provide::{closure#5} as core[eb16051bbd0320a4]::ops::function::FnOnce<(rustc_middle[46b0a49c46c3d6a2]::ty::context::TyCtxt, rustc_span[632d03c94baac3c8]::def_id::CrateNum)>>::call_once
  21:         0x6822c238 - <rustc_middle[46b0a49c46c3d6a2]::dep_graph::dep_node::DepKind as rustc_query_system[d99f6497f4048b88]::dep_graph::DepKind>::with_deps::<<rustc_query_system[d99f6497f4048b88]::dep_graph::graph::DepGraph<rustc_middle[46b0a49c46c3d6a2]::dep_graph::dep_node::DepKind>>::with_task_impl<rustc_middle[46b0a49c46c3d6a2]::ty::context::TyCtxt, rustc_span[632d03c94baac3c8]::def_id::CrateNum, alloc[9cfaa136b693c194]::vec::Vec<rustc_session[a711795dc12485c4]::cstore::NativeLib>>::{closure#0}, alloc[9cfaa136b693c194]::vec::Vec<rustc_session[a711795dc12485c4]::cstore::NativeLib>>
  22:         0x6830e658 - <rustc_query_system[d99f6497f4048b88]::dep_graph::graph::DepGraph<rustc_middle[46b0a49c46c3d6a2]::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle[46b0a49c46c3d6a2]::ty::context::TyCtxt, rustc_span[632d03c94baac3c8]::def_id::CrateNum, alloc[9cfaa136b693c194]::vec::Vec<rustc_session[a711795dc12485c4]::cstore::NativeLib>>
  23:         0x684319a4 - rustc_query_system[d99f6497f4048b88]::query::plumbing::try_execute_query::<rustc_query_impl[59c0d2090e897202]::plumbing::QueryCtxt, rustc_query_system[d99f6497f4048b88]::query::caches::ArenaCache<rustc_span[632d03c94baac3c8]::def_id::CrateNum, alloc[9cfaa136b693c194]::vec::Vec<rustc_session[a711795dc12485c4]::cstore::NativeLib>>>
  24:         0x685638b5 - rustc_query_system[d99f6497f4048b88]::query::plumbing::get_query::<rustc_query_impl[59c0d2090e897202]::queries::native_libraries, rustc_query_impl[59c0d2090e897202]::plumbing::QueryCtxt>
  25:         0x686d8d1d - <rustc_codegen_ssa[4b7e814ecebdea5d]::CrateInfo>::new
  26:         0x66f7bc6a - rustc_codegen_ssa[4b7e814ecebdea5d]::back::write::start_async_codegen::<rustc_codegen_llvm[68a6d46b04578190]::LlvmCodegenBackend>
  27:         0x66fcb105 - rustc_codegen_ssa[4b7e814ecebdea5d]::base::codegen_crate::<rustc_codegen_llvm[68a6d46b04578190]::LlvmCodegenBackend>
  28:         0x66f63196 - <rustc_codegen_llvm[68a6d46b04578190]::LlvmCodegenBackend as rustc_codegen_ssa[4b7e814ecebdea5d]::traits::backend::CodegenBackend>::codegen_crate
  29:         0x66ec203f - <rustc_session[a711795dc12485c4]::session::Session>::time::<alloc[9cfaa136b693c194]::boxed::Box<dyn core[eb16051bbd0320a4]::any::Any>, rustc_interface[f48a00f6c7f2617f]::passes::start_codegen::{closure#0}>
  30:         0x66e4a117 - <rustc_interface[f48a00f6c7f2617f]::passes::QueryContext>::enter::<<rustc_interface[f48a00f6c7f2617f]::queries::Queries>::ongoing_codegen::{closure#0}::{closure#0}, core[eb16051bbd0320a4]::result::Result<alloc[9cfaa136b693c194]::boxed::Box<dyn core[eb16051bbd0320a4]::any::Any>, rustc_errors[7cb1d332209ac389]::ErrorGuaranteed>>
  31:         0x66f050c1 - <rustc_interface[f48a00f6c7f2617f]::queries::Queries>::ongoing_codegen
  32:         0x66d85943 - <rustc_interface[f48a00f6c7f2617f]::interface::Compiler>::enter::<rustc_driver[fc14363f33175fa1]::run_compiler::{closure#1}::{closure#2}, core[eb16051bbd0320a4]::result::Result<core[eb16051bbd0320a4]::option::Option<rustc_interface[f48a00f6c7f2617f]::queries::Linker>, rustc_errors[7cb1d332209ac389]::ErrorGuaranteed>>
  33:         0x66d1c557 - rustc_span[632d03c94baac3c8]::with_source_map::<core[eb16051bbd0320a4]::result::Result<(), rustc_errors[7cb1d332209ac389]::ErrorGuaranteed>, rustc_interface[f48a00f6c7f2617f]::interface::create_compiler_and_run<core[eb16051bbd0320a4]::result::Result<(), rustc_errors[7cb1d332209ac389]::ErrorGuaranteed>, rustc_driver[fc14363f33175fa1]::run_compiler::{closure#1}>::{closure#1}>
  34:         0x66d87c80 - rustc_interface[f48a00f6c7f2617f]::interface::create_compiler_and_run::<core[eb16051bbd0320a4]::result::Result<(), rustc_errors[7cb1d332209ac389]::ErrorGuaranteed>, rustc_driver[fc14363f33175fa1]::run_compiler::{closure#1}>
  35:         0x66d1d740 - <scoped_tls[153e58dc6140e32b]::ScopedKey<rustc_span[632d03c94baac3c8]::SessionGlobals>>::set::<rustc_interface[f48a00f6c7f2617f]::interface::run_compiler<core[eb16051bbd0320a4]::result::Result<(), rustc_errors[7cb1d332209ac389]::ErrorGuaranteed>, rustc_driver[fc14363f33175fa1]::run_compiler::{closure#1}>::{closure#0}, core[eb16051bbd0320a4]::result::Result<(), rustc_errors[7cb1d332209ac389]::ErrorGuaranteed>>
  36:         0x66d81b06 - std[a4a597f22a3538e4]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[f48a00f6c7f2617f]::util::run_in_thread_pool_with_globals<rustc_interface[f48a00f6c7f2617f]::interface::run_compiler<core[eb16051bbd0320a4]::result::Result<(), rustc_errors[7cb1d332209ac389]::ErrorGuaranteed>, rustc_driver[fc14363f33175fa1]::run_compiler::{closure#1}>::{closure#0}, core[eb16051bbd0320a4]::result::Result<(), rustc_errors[7cb1d332209ac389]::ErrorGuaranteed>>::{closure#0}, core[eb16051bbd0320a4]::result::Result<(), rustc_errors[7cb1d332209ac389]::ErrorGuaranteed>>
  37:         0x66d28227 - <<std[a4a597f22a3538e4]::thread::Builder>::spawn_unchecked_<rustc_interface[f48a00f6c7f2617f]::util::run_in_thread_pool_with_globals<rustc_interface[f48a00f6c7f2617f]::interface::run_compiler<core[eb16051bbd0320a4]::result::Result<(), rustc_errors[7cb1d332209ac389]::ErrorGuaranteed>, rustc_driver[fc14363f33175fa1]::run_compiler::{closure#1}>::{closure#0}, core[eb16051bbd0320a4]::result::Result<(), rustc_errors[7cb1d332209ac389]::ErrorGuaranteed>>::{closure#0}, core[eb16051bbd0320a4]::result::Result<(), rustc_errors[7cb1d332209ac389]::ErrorGuaranteed>>::{closure#1} as core[eb16051bbd0320a4]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  38:         0x663dceb7 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hf0c0537c2e0c0a81
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e\library\alloc\src/boxed.rs:1861:9
  39:         0x663dceb7 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hf597d7d1811973f9
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e\library\alloc\src/boxed.rs:1861:9
  40:         0x663dceb7 - std::sys::windows::thread::Thread::new::thread_start::h70457789bc631105
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e\/library\std\src\sys\windows/thread.rs:57:17
  41:     0x7ffe239f54e0 - <unknown>
  42:     0x7ffe2412485b - <unknown>
@Super-Pizza Super-Pizza 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 Jun 13, 2022
@Super-Pizza Super-Pizza changed the title ICE force-linking icons using winres ICE force-linking resource using winres Jun 13, 2022
@petrochenkov
Copy link
Contributor

This ICE was fixed in #97328.

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

No branches or pull requests

2 participants