Open
Description
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.