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

Error when using image crate #132240

Open
OkGameStudios opened this issue Oct 27, 2024 · 2 comments
Open

Error when using image crate #132240

OkGameStudios opened this issue Oct 27, 2024 · 2 comments
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

@OkGameStudios
Copy link

use std::{
    fs::{self, File},
    io::Write,
};

use image::ImageReader;

fn main() {
    println!("Hello, world!");

    image_from("planet.png")
}

fn image_from(path: &str) {
    let image_data = ImageReader::open(path)
        .expect("Cann't open image file")
        .decode()
        .expect("Can't decode image file");

    let mut image_log = File::create("image.txt").unwrap();

    let _ = image_log.write(image_data.as_bytes()).unwrap();
    // fs::write(imageLog, image_data)
}

OS: Windows 11
Rustup: 1.27.1
Cargo: 1.81.0

thread 'coordinator' panicked at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c\compiler\rustc_codegen_ssa\src\back\write.rs:1676:29:
/rustc/eeb90cda1969383f56a2637cbd3037bdf598841c\compiler\rustc_codegen_ssa\src\back\write.rs:1676:29: worker thread panicked
stack backtrace:
   0:     0x7ffd9151408d - std::backtrace_rs::backtrace::dbghelp64::trace
                               at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library\std\src\..\..\backtrace\src\backtrace\dbghelp64.rs:91
   1:     0x7ffd9151408d - std::backtrace_rs::backtrace::trace_unsynchronized
                               at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library\std\src\..\..\backtrace\src\backtrace\mod.rs:66
   2:     0x7ffd9151408d - std::sys::backtrace::_print_fmt
                               at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library\std\src\sys\backtrace.rs:65
   3:     0x7ffd9151408d - std::sys::backtrace::impl$0::print::impl$0::fmt
                               at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library\std\src\sys\backtrace.rs:40
   4:     0x7ffd91544bb9 - core::fmt::rt::Argument::fmt
                               at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library\core\src\fmt\rt.rs:173
   5:     0x7ffd91544bb9 - core::fmt::write
                               at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library\core\src\fmt\mod.rs:1182
   6:     0x7ffd9150ab71 - std::io::Write::write_fmt<std::sys::pal::windows::stdio::Stderr>
                               at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library\std\src\io\mod.rs:1827
   7:     0x7ffd91517127 - std::panicking::default_hook::closure$1
                               at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library\std\src\panicking.rs:269
   8:     0x7ffd91516d19 - std::panicking::default_hook
                               at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library\std\src\panicking.rs:296
   9:     0x7ffd6e2c2ed5 - memchr
  10:     0x7ffd9151796b - alloc::boxed::impl$50::call
                               at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library\alloc\src\boxed.rs:2084
  11:     0x7ffd9151796b - std::panicking::rust_panic_with_hook
                               at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library\std\src\panicking.rs:808
  12:     0x7ffd6f73a6ff - object[443503632d93082a]::elf::gnu_hash
  13:     0x7ffd6f7329f9 - object[443503632d93082a]::elf::gnu_hash
  14:     0x7ffd6f7217f3 - object[443503632d93082a]::elf::gnu_hash
  15:     0x7ffd6f7ce66d - rustc_middle[1ecd3c849d31efbc]::util::bug::bug_fmt
  16:     0x7ffd6f7aea6d - rustc_middle[1ecd3c849d31efbc]::ty::consts::const_param_default
  17:     0x7ffd6f7ae8ad - rustc_middle[1ecd3c849d31efbc]::ty::consts::const_param_default
  18:     0x7ffd6f7ce5a2 - rustc_middle[1ecd3c849d31efbc]::util::bug::bug_fmt
  19:     0x7ffd6cecf858 - rustc_interface[ce19ee65e5c643b1]::proc_macro_decls::proc_macro_decls_static
  20:     0x7ffd6a150ddd - llvm::DenseMap<llvm::StructType * __ptr64,llvm::detail::DenseSetEmpty,llvm::IRMover::StructTypeKeyInfo,llvm::detail::DenseSetPair<llvm::StructType * __ptr64> >::~DenseMap<llvm::StructType * __ptr64,llvm::detail::DenseSetEmpty,llvm::IRMover::StructTypeKeyIn
  21:     0x7ffd6a164c4f - llvm::DenseMap<llvm::StructType * __ptr64,llvm::detail::DenseSetEmpty,llvm::IRMover::StructTypeKeyInfo,llvm::detail::DenseSetPair<llvm::StructType * __ptr64> >::~DenseMap<llvm::StructType * __ptr64,llvm::detail::DenseSetEmpty,llvm::IRMover::StructTypeKeyIn
  22:     0x7ffd91528f0d - alloc::boxed::impl$48::call_once
                               at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library\alloc\src\boxed.rs:2070
  23:     0x7ffd91528f0d - alloc::boxed::impl$48::call_once
                               at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library\alloc\src\boxed.rs:2070
  24:     0x7ffd91528f0d - std::sys::pal::windows::thread::impl$0::new::thread_start
                               at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library\std\src\sys\pal\windows\thread.rs:58
  25:     0x7ffe4b5e259d - BaseThreadInitThunk
  26:     0x7ffe4be0af38 - RtlUserThreadStart

error: 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.81.0 (eeb90cda1 2024-09-04) 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: cached cgu be5oc9yxgopg7ilp0e3j30unl should have an object file, but doesn't

Error told me to report t so here I am

@OkGameStudios OkGameStudios 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 Oct 27, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Oct 27, 2024
@saethlin
Copy link
Member

Very strange. Are you sure there wasn't another error message above this?

@saethlin saethlin removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Oct 28, 2024
@saethlin saethlin self-assigned this Oct 28, 2024
@saethlin
Copy link
Member

Oh I think this ICEs because in #120865 I didn't realize that rustc emits fatal errors by unwinding, which the coordinator thread thinks is a panic. Oof.

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

3 participants