Skip to content

rustc won't compile after error #135456

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

Open
benjaminkaplan opened this issue Jan 13, 2025 · 5 comments
Open

rustc won't compile after error #135456

benjaminkaplan opened this issue Jan 13, 2025 · 5 comments
Labels
A-incr-comp Area: Incremental compilation C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ S-needs-repro Status: This issue has no reproduction and needs a reproduction to make progress. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@benjaminkaplan
Copy link

benjaminkaplan commented Jan 13, 2025

I was going through the online Rust book and I was modifying the provided code examples to see the types of error messages I could receive.

I tried to compile with this code

std::io::stdin()
    .read_line(&mut guess)

and I received this error:

warning: unused `Result` that must be used
  --> src\main.rs:9:5
   |
9  | /     std::io::stdin()
10 | |         .read_line(&mut guess);
   | |______________________________^
   |
   = note: this `Result` may be an `Err` variant, which should be handled
   = note: `#[warn(unused_must_use)]` on by default
help: use `let _ = ...` to ignore the resulting value
   |
9  |     let _ = std::io::stdin()
   |     +++++++

warning: error copying object file `C:\Binyamin\projects\guessing_game\target\debug\deps\guessing_game.06ft8sozyh5gkeuqf47wn33fq
.rcgu.o` to incremental directory as `\\?\C:\Binyamin\projects\guessing_game\target\debug\incremental\guessing_game-2np01ccfpwk3
q\s-h3n858d5d7-0bhp2xt-working\06ft8sozyh5gkeuqf47wn33fq.o`: Access is denied. (os error 5)

warning: error copying object file `C:\Binyamin\projects\guessing_game\target\debug\deps\guessing_game.0bacoeif7vu57vzgx0itycv8y
.rcgu.o` to incremental directory as `\\?\C:\Binyamin\projects\guessing_game\target\debug\incremental\guessing_game-2np01ccfpwk3
q\s-h3n858d5d7-0bhp2xt-working\0bacoeif7vu57vzgx0itycv8y.o`: Access is denied. (os error 5)

warning: `guessing_game` (bin "guessing_game") generated 3 warnings
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 1.03s
     Running `target\debug\guessing_game.exe`

Based on the error hint, I changed the code to:

let _ = std::io::stdin()
    .read_line(&mut guess);

and I got this error:

 Compiling guessing_game v0.1.0 (C:\Binyamin\projects\guessing_game)
thread 'coordinator' panicked at /rustc/9fc6b43126469e3858e2fe86cafb4f0fd5068869\compiler\rustc_codegen_ssa\src\back\write.rs:16
62:29:
/rustc/9fc6b43126469e3858e2fe86cafb4f0fd5068869\compiler\rustc_codegen_ssa\src\back\write.rs:1662:29: worker thread panicked
stack backtrace:
   0:     0x7ffe61b6ba41 - std::backtrace_rs::backtrace::dbghelp64::trace
                               at /rustc/9fc6b43126469e3858e2fe86cafb4f0fd5068869\library/std\src\..\..\backtrace\src\backtrace\
dbghelp64.rs:91
   1:     0x7ffe61b6ba41 - std::backtrace_rs::backtrace::trace_unsynchronized
                               at /rustc/9fc6b43126469e3858e2fe86cafb4f0fd5068869\library/std\src\..\..\backtrace\src\backtrace\
mod.rs:66
   2:     0x7ffe61b6ba41 - std::sys::backtrace::_print_fmt
                               at /rustc/9fc6b43126469e3858e2fe86cafb4f0fd5068869\library/std\src\sys\backtrace.rs:66
   3:     0x7ffe61b6ba41 - std::sys::backtrace::impl$0::print::impl$0::fmt
                               at /rustc/9fc6b43126469e3858e2fe86cafb4f0fd5068869\library/std\src\sys\backtrace.rs:39
   4:     0x7ffe61b9dd1a - core::fmt::rt::Argument::fmt
                               at /rustc/9fc6b43126469e3858e2fe86cafb4f0fd5068869\library/core\src\fmt\rt.rs:177
   5:     0x7ffe61b9dd1a - core::fmt::write
                               at /rustc/9fc6b43126469e3858e2fe86cafb4f0fd5068869\library/core\src\fmt\mod.rs:1189
   6:     0x7ffe61b61de7 - std::io::Write::write_fmt<std::sys::pal::windows::stdio::Stderr>
                               at /rustc/9fc6b43126469e3858e2fe86cafb4f0fd5068869\library/std\src\io\mod.rs:1884
   7:     0x7ffe61b6b885 - std::sys::backtrace::BacktraceLock::print
                               at /rustc/9fc6b43126469e3858e2fe86cafb4f0fd5068869\library/std\src\sys\backtrace.rs:42
   8:     0x7ffe61b6e7a3 - std::panicking::default_hook::closure$1
                               at /rustc/9fc6b43126469e3858e2fe86cafb4f0fd5068869\library/std\src\panicking.rs:268
   9:     0x7ffe61b6e582 - std::panicking::default_hook
                               at /rustc/9fc6b43126469e3858e2fe86cafb4f0fd5068869\library/std\src\panicking.rs:295
  10:     0x7ffe6314ab1e - strncpy
  11:     0x7ffe61b6eee2 - alloc::boxed::impl$30::call
                               at /rustc/9fc6b43126469e3858e2fe86cafb4f0fd5068869\library/alloc\src\boxed.rs:1986
  12:     0x7ffe61b6eee2 - std::panicking::rust_panic_with_hook
                               at /rustc/9fc6b43126469e3858e2fe86cafb4f0fd5068869\library/std\src\panicking.rs:809
  13:     0x7ffe647bbfdf - ar_archive_writer[5ad4fe434effa9d8]::object_reader::get_member_alignment
  14:     0x7ffe647b6b29 - ar_archive_writer[5ad4fe434effa9d8]::object_reader::get_member_alignment
  15:     0x7ffe647b516c - ar_archive_writer[5ad4fe434effa9d8]::object_reader::get_member_alignment
  16:     0x7ffe64850eed - rustc_middle[87d6ac0499a2eaf7]::util::bug::bug_fmt
  17:     0x7ffe648318bd - <rustc_middle[87d6ac0499a2eaf7]::ty::consts::Const>::to_valtree
  18:     0x7ffe648316d6 - <rustc_middle[87d6ac0499a2eaf7]::ty::consts::Const>::to_valtree
  19:     0x7ffe64850e22 - rustc_middle[87d6ac0499a2eaf7]::util::bug::bug_fmt
  20:     0x7ffe61c3822a - rustc_interface[c014954558e9d384]::proc_macro_decls::proc_macro_decls_static
  21:     0x7ffe5ebf33ad - llvm::DenseMap<llvm::StructType * __ptr64,llvm::detail::DenseSetEmpty,llvm::IRMover::StructTypeKeyInf
o,llvm::detail::DenseSetPair<llvm::StructType * __ptr64> >::~DenseMap<llvm::StructType * __ptr64,llvm::detail::DenseSetEmpty,llv
m::IRMover::StructTypeKeyIn
  22:     0x7ffe5ec04d8a - llvm::DenseMap<llvm::StructType * __ptr64,llvm::detail::DenseSetEmpty,llvm::IRMover::StructTypeKeyInf
o,llvm::detail::DenseSetPair<llvm::StructType * __ptr64> >::~DenseMap<llvm::StructType * __ptr64,llvm::detail::DenseSetEmpty,llv
m::IRMover::StructTypeKeyIn
  23:     0x7ffe61b80bad - alloc::boxed::impl$28::call_once
                               at /rustc/9fc6b43126469e3858e2fe86cafb4f0fd5068869\library/alloc\src\boxed.rs:1972
  24:     0x7ffe61b80bad - alloc::boxed::impl$28::call_once
                               at /rustc/9fc6b43126469e3858e2fe86cafb4f0fd5068869\library/alloc\src\boxed.rs:1972
  25:     0x7ffe61b80bad - std::sys::pal::windows::thread::impl$0::new::thread_start
                               at /rustc/9fc6b43126469e3858e2fe86cafb4f0fd5068869\library/std\src\sys\pal\windows\thread.rs:55
  26:     0x7ffec3f081f4 - BaseThreadInitThunk
  27:     0x7ffec676a251 - 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&templat
e=ice.md

note: rustc 1.84.0 (9fc6b4312 2025-01-07) 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 0bacoeif7vu57vzgx0itycv8y should have an object file, but doesn't

error: could not compile `guessing_game` (bin "guessing_game") due to 1 previous error

Not sure what's going on here. I just created a new project with cargo and moved on, but I would like to know how to fix this in the future.

@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Jan 13, 2025
@jieyouxu
Copy link
Member

jieyouxu commented Jan 13, 2025

This is possibly a duplicate of #135075.

@benjaminkaplan how much disk space do you have left?

@jieyouxu jieyouxu added S-needs-info Status: The issue lacks details necessary to triage or act on it. 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. C-bug Category: This is a bug. A-incr-comp Area: Incremental compilation labels Jan 13, 2025
@benjaminkaplan
Copy link
Author

I have 159 GB of disk space available. I dont think that is the issue here.

@jieyouxu
Copy link
Member

If you cargo clean and try building again, does this repro?

@jieyouxu
Copy link
Member

Are you able to manually remove the target directory C:\Binyamin\projects\guessing_game\target\ without elevating the terminal as admin?

@benjaminkaplan
Copy link
Author

I was able to remove the target and that fixed the issue

@jieyouxu jieyouxu added S-needs-repro Status: This issue has no reproduction and needs a reproduction to make progress. and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. S-needs-info Status: The issue lacks details necessary to triage or act on it. labels Jan 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-incr-comp Area: Incremental compilation C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ S-needs-repro Status: This issue has no reproduction and needs a reproduction to make progress. 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