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

Internal Compiler Error: Unexpected Panic #48650

Closed
DareDevelOps opened this issue Mar 2, 2018 · 25 comments
Closed

Internal Compiler Error: Unexpected Panic #48650

DareDevelOps opened this issue Mar 2, 2018 · 25 comments
Labels
A-incr-comp Area: Incremental compilation I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ O-windows Operating system: Windows

Comments

@DareDevelOps
Copy link

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

@ishitatsuyuki ishitatsuyuki added I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ A-incr-comp Area: Incremental compilation labels Mar 2, 2018
@steveklabnik
Copy link
Member

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?

@DareDevelOps
Copy link
Author

sure thing I'll run it again and upload this evening. thanks for the prompt response!

@DareDevelOps
Copy link
Author

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`.

@TropicSapling
Copy link

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.

@DareDevelOps
Copy link
Author

DareDevelOps commented Mar 4, 2018

Ok I can confirm my "local" Repo is also on a onedrive path. I'll move it off and see if it runs.

@DareDevelOps
Copy link
Author

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.

@kennytm
Copy link
Member

kennytm commented Mar 4, 2018

Could you check if this ICE is repro with a beta or nightly Rust?

@TropicSapling
Copy link

Might be related: running cargo clean prints this when inside OneDrive:

error: failed to remove build artifact

Caused by:
  Access denied. (os error 5)

@DareDevelOps
Copy link
Author

new to this so I assume you want Rustc --version which returns rustc 1.24.1 (d3ae9a9e0 2018-02-27)

@TropicSapling
Copy link

@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.

@DareDevelOps
Copy link
Author

DareDevelOps commented Mar 4, 2018

ok yeah makes sense... reading documentation now. you could probably install to a different path and not put it in your Path environment variable.

@kennytm
Copy link
Member

kennytm commented Mar 4, 2018

@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.

@DareDevelOps
Copy link
Author

So test Beta first then Nightly?

@TropicSapling
Copy link

@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.

@TropicSapling
Copy link

Just tried with nightly, works just fine in that version.

@kennytm
Copy link
Member

kennytm commented Mar 4, 2018

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 kennytm added the O-windows Operating system: Windows label Mar 4, 2018
@DareDevelOps
Copy link
Author

@kennytm I'll apply the fix in PR #47956 then close this as dupe.

@DareDevelOps
Copy link
Author

DareDevelOps commented Mar 4, 2018

@TropicSapling did the nightly install fail to clean temp files behind itself?

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.

@TropicSapling
Copy link

No, there were no errors more than those my own program had.

@DareDevelOps
Copy link
Author

DareDevelOps commented Mar 4, 2018

could be the same issue with my .rustup being on onedrive. nope it's local users.

@TropicSapling
Copy link

Possibly, I have my Rust installations located outside of OneDrive.

@DareDevelOps
Copy link
Author

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:\Users\burtd\OneDrive\Documents\Repo\Rust .. 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.

@glazzerino
Copy link

For some reason it works perfectly fine when the guessing_game is cargo-ed outside of my onedrive directory

@TropicSapling
Copy link

@glazzerino Yes, it's because it's related to OneDrive in some way.

@mandliya
Copy link

Thanks! @TropicSapling and @glazzerino Onedrive seems to be culprit. I tried outside onedrive and everything worked fine!

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 I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ O-windows Operating system: Windows
Projects
None yet
Development

No branches or pull requests

7 participants