Skip to content

ICE on #[link(..., kind = "raw-dylib")] #93842

Closed
@ricobbe

Description

@ricobbe

Code

#![feature(raw_dylib)]
#[link(name = "kernel32", kind = "raw-dylib")]
extern "system" {
    fn WaitForSingleObject(handle: isize, dwmilliseconds: u32) -> u32;
}
fn main() {
    unsafe { WaitForSingleObject(0, 0); }
    println!("ok");
}

Cargo.toml:

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

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]

Compile with cargo +nightly run. ICE reproducible on {x86_64,i686}-pc-windows-{msvc,gnu}. Non-windows platforms are irrelevant, as the problem involves the raw_dylib feature, which is only implemented on Windows.

Meta

rustc --version --verbose:

rustc 1.60.0-nightly (e7aca8959 2022-02-09)
binary: rustc
commit-hash: e7aca895980f25f6d2d3c48e10fd04656764d1e4
commit-date: 2022-02-09
host: x86_64-pc-windows-msvc
release: 1.60.0-nightly
LLVM version: 13.0.0

Error output

thread 'rustc' panicked at 'compiler\rustc_codegen_ssa\src\back\link.rs:2066:17: raw_dylib feature not yet implemented', compiler\rustc_middle\src\util\bug.rs:35:26
Backtrace

stack backtrace:
   0:     0x7ffcb3527d30 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hd9a1cc8c1ba9a6ad
   1:     0x7ffcb355779a - core::fmt::write::h346f1639821b09ca
   2:     0x7ffcb3519119 - <std::io::IoSlice as core::fmt::Debug>::fmt::h6ed49041e1bde020
   3:     0x7ffcb352b4a2 - std::panicking::default_hook::hb86a255b5ae1a1b5
   4:     0x7ffcb352b063 - std::panicking::default_hook::hb86a255b5ae1a1b5
   5:     0x7ffca5e4ca76 - <rustc_driver[62efd2c0abe8586f]::args::Error as core[22e88df2c075810]::fmt::Debug>::fmt
   6:     0x7ffcb352bdd2 - std::panicking::rust_panic_with_hook::h0b2277542f9fb56f
   7:     0x7ffcaa28444d - <rustc_middle[69d22b9b016ab07c]::ty::vtable::VtblEntry as core[22e88df2c075810]::fmt::Debug>::fmt
   8:     0x7ffcaa282abf - <rustc_middle[69d22b9b016ab07c]::traits::select::EvaluationResult>::is_stack_dependent
   9:     0x7ffcaa89ba86 - rustc_middle[69d22b9b016ab07c]::ty::context::invalid_hir_id_for_typeck_results
  10:     0x7ffcaa2825f6 - <rustc_middle[69d22b9b016ab07c]::traits::select::EvaluationResult>::is_stack_dependent
  11:     0x7ffcaa28459a - <rustc_middle[69d22b9b016ab07c]::ty::vtable::VtblEntry as core[22e88df2c075810]::fmt::Debug>::fmt
  12:     0x7ffcaa285049 - <rustc_middle[69d22b9b016ab07c]::ty::vtable::VtblEntry as core[22e88df2c075810]::fmt::Debug>::fmt
  13:     0x7ffcaa89af90 - rustc_middle[69d22b9b016ab07c]::util::bug::bug_fmt
  14:     0x7ffca977984d - rustc_codegen_ssa[2943325f22fd461c]::back::link::add_local_native_libraries
  15:     0x7ffca60d3b14 - <rustc_codegen_llvm[ed7fa6d6e12b934]::back::archive::LlvmArchiveBuilder as rustc_codegen_ssa[2943325f22fd461c]::back::archive::ArchiveBuilder>::inject_dll_import_lib
  16:     0x7ffca60d0c9a - <rustc_codegen_llvm[ed7fa6d6e12b934]::back::archive::LlvmArchiveBuilder as rustc_codegen_ssa[2943325f22fd461c]::back::archive::ArchiveBuilder>::inject_dll_import_lib
  17:     0x7ffca60b6185 - <rustc_codegen_llvm[ed7fa6d6e12b934]::LlvmCodegenBackend as rustc_codegen_ssa[2943325f22fd461c]::traits::backend::CodegenBackend>::link
  18:     0x7ffca5f797e8 - <rustc_interface[f518e6e170a46fb9]::queries::Linker>::link
  19:     0x7ffca5de9cb0 - <rustc_driver[62efd2c0abe8586f]::args::Error as core[22e88df2c075810]::fmt::Debug>::fmt
  20:     0x7ffca5ddef0a - <tracing_log[8e7bf0df484a8cae]::InfoCallsite as tracing_core[e4007ebade0f9e88]::callsite::Callsite>::set_interest
  21:     0x7ffca5dbf7c3 - <tracing_log[8e7bf0df484a8cae]::InfoCallsite as tracing_core[e4007ebade0f9e88]::callsite::Callsite>::set_interest
  22:     0x7ffca5e62fa8 - rustc_driver[62efd2c0abe8586f]::pretty::print_after_hir_lowering
  23:     0x7ffcb353c73c - std::sys::windows::thread::Thread::new::h1745d7e554009389
  24:     0x7ffd53661474 - BaseThreadInitThunk
  25:     0x7ffd549b26d8 - RtlUserThreadStart

Metadata

Metadata

Assignees

Labels

C-bugCategory: This is a bug.F-raw_dylib`#![feature(raw_dylib)]`I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️O-windowsOperating system: WindowsT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.glacierICE tracked in rust-lang/glacier.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions