just downloaded Rust to try it out working through intro docs ran
Running cargo run on Guessing game tutorial produces compiler error panic
I tried this Code
use std::io;
fn main() {
println!("Guess the number!");
println!("Please input your guess.",);
let mut guess = String::new();
io::stdin().read_line(&mut guess).expect("Failed to read line");
println!("You guessed:{}", guess );
}
I expected it to output
Guess the number!
Please input your guess.
6
You guessed: 6
Instead recieved this output
Compiling guessing_game v0.1.0 (file:///C:/Users/burtd/OneDrive/Documents/Repo/Rust/guessing_game)
error: Could not create incremental compilation crate directory `C:\Users\burtd\OneDrive\Documents\Repo\Rust\guessing_game\target\debug\incremental\guessing_game-4fw14ci2okbr`: Cannot create a
file when that file already exists. (os error 183)
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/blob/master/CONTRIBUTING.md#bug-reports
note: rustc 1.24.1 (d3ae9a9e0 2018-02-27) running on x86_64-pc-windows-msvc
thread 'rustc' panicked at 'src\librustc\session\mod.rs:665: Trying to get session directory from IncrCompSession `NotInitialized`', src\librustc\session\mod.rs:1141:26
note: Run with `RUST_BACKTRACE=1` for a backtrace.
error: Could not compile `guessing_game`.
Rust version
rustc 1.24.1 (d3ae9a9e0 2018-02-27)
binary: rustc
commit-hash: d3ae9a9e08edf12de0ed82af57ba2a56c26496ea
commit-date: 2018-02-27
host: x86_64-pc-windows-msvc
release: 1.24.1
LLVM version: 4.0
Thanks for filing! I can't seem to reproduce this; I'm on Windows 10, but all of my rustc -Vv stuff is the same as yours. Hm.
Any chance you could provide the backtrace?
sure thing I'll run it again and upload this evening. thanks for the prompt response!
Stack Backtrace output
thread 'rustc' panicked at 'src\librustc\session\mod.rs:665: Trying to get session directory from IncrCompSession `NotInitialized`', src\librustc\session\mod.rs:1141:26stack backtrace:
0: <std::sync::condvar::WaitTimeoutResult as core::fmt::Debug>::fmt
1: <std::time::SystemTimeError as core::fmt::Display>::fmt
2: std::panicking::Location::column
3: std::panicking::Location::column
4: std::panicking::rust_panic_with_hook
5: <alloc::vec::Vec<(alloc::string::String, u64)> as rustc::session::config::dep_tracking::DepTrackingHash>::hash
6: rustc::ty::context::tls::span_debug
7: rustc::session::bug_fmt
8: rustc::session::bug_fmt
9: rustc::session::Session::incr_comp_session_dir
10: rustc_incremental::persist::load::load_dep_graph
11: rustc_driver::driver::compile_input
12: rustc_driver::run_compiler
13: rustc_driver::profile::dump
14: _rust_maybe_catch_panic
15: <rustc_driver::pretty::UserIdentifiedItem as core::fmt::Debug>::fmt
16: <std::sync::condvar::Condvar as core::fmt::Debug>::fmt
17: std::sys::windows::thread::Thread::new
18: BaseThreadInitThunk
error: Could not compile `guessing_game`.
I'm having the same problem. I'm not entirely sure but it seems it might have something to do with OneDrive since when I move the code outside of OneDrive everything works fine.
Ok I can confirm my "local" Repo is also on a onedrive path. I'll move it off and see if it runs.
recreated the guessing game tutorial at C:Rust works fine. The only weird thing is when you do the``
cargo new guessing_game --bin and it creates the default structure the "Hello, World" on the onedrive path it works fine, until you modify it to the guessing game code. I tested this on my work machine as well I'll confirm where the path on my repo is there and document as well.
Could you check if this ICE is repro with a beta or nightly Rust?
Might be related: running cargo clean prints this when inside OneDrive:
error: failed to remove build artifact
Caused by:
Access denied. (os error 5)
new to this so I assume you want Rustc --version which returns rustc 1.24.1 (d3ae9a9e0 2018-02-27)
@DareDevelOps I think he wants you to check if it's reproducable with newer non-stable versions of Rust, but I am also pretty new to Rust so I don't know how to install beta or nightly Rust while still keeping stable.
ok yeah makes sense... reading documentation now. you could probably install to a different path and not put it in your Path environment variable.
@DareDevelOps If you installed rust via rustup, you could install and run beta and nightly simply through:
rustup install beta
cargo +beta run
# ^ This executes the program using the beta Rust
rustup install nightly
cargo +nightly run
# ^ Similar, execute using nightly Rust.
So test Beta first then Nightly?
@kennytm When I ran cargo +beta run at first it reported different errors, but after running it a second time it once again reported the same os error 183.
Just tried with nightly, works just fine in that version.
Thanks @TropicSapling. Because it works on nightly, I assume this bug is the same as issue #46484 which has been fixed by PR #47956?
@kennytm I'll apply the fix in PR #47956 then close this as dupe.
@TropicSapling did the nightly install fail to clean temp files behind itself?
warning: could not delete temp file: C:\Users\burtd\.rustup\tmp\xidhk4wkgb6ipg1j_file
warning: could not delete temp file: C:\Users\burtd\.rustup\tmp\l7ygfdsq2ahokj5s_file
warning: could not delete temp file: C:\Users\burtd\.rustup\tmp\p4anr930syjhavu7_file
warning: could not delete temp file: C:\Users\burtd\.rustup\tmp\h396aadq61lgtz1w_file
warning: could not delete temp file: C:\Users\burtd\.rustup\tmp\2_5r3rgro0rujxbk_file
warning: could not delete temp file: C:\Users\burtd\.rustup\tmp\ijd8pyhvwtwdylj8_file
warning: could not delete temp file: C:\Users\burtd\.rustup\tmp\qzd6c8i0khyhmnl0_file
warning: could not delete temp file: C:\Users\burtd\.rustup\tmp\rdpkqr7urr7neqh2_file
warning: could not delete temp file: C:\Users\burtd\.rustup\tmp\7wrz80llfxpd87up_file
warning: could not delete temp file: C:\Users\burtd\.rustup\tmp\0emrlead82ii3gi__file
warning: could not delete temp file: C:\Users\burtd\.rustup\tmp\_1h2o61ij5p9kzar_file
warning: could not delete temp file: C:\Users\burtd\.rustup\tmp\1er02ceun3c8ro9n_file
Assuming a permissions thing.
No, there were no errors more than those my own program had.
could be the same issue with my .rustup being on onedrive. nope it's local users.
Possibly, I have my Rust installations located outside of OneDrive.
OK last comment on this and I'll close it as dupe. After installing the beta and nightly I went and regenerated the guessing game at C:UsersburtdOneDriveDocumentsRepoRust .. works fine no matter how I call cargo to run it cargo run = good; cargo = +beta run = good; cargo +nightly = good.
Please refer to issue #46484 and PR #47956 for further information related to OneDrive symlink issues.
For some reason it works perfectly fine when the guessing_game is cargo-ed outside of my onedrive directory
@Glazzerino Yes, it's because it's related to OneDrive in some way.
Thanks! @TropicSapling and @Glazzerino Onedrive seems to be culprit. I tried outside onedrive and everything worked fine!
Most helpful comment
@DareDevelOps If you installed rust via rustup, you could install and run beta and nightly simply through: