rust-lang / rust

Empowering everyone to build reliable and efficient software.
https://www.rust-lang.org
Other
96.77k stars 12.5k forks source link

Copying build files to a different drive and then building them #79062

Open 13ros27 opened 3 years ago

13ros27 commented 3 years ago

I took all the build files so, src, target, Cargo.lock and Cargo.toml from one drive and moved them over to another drive and then ran cargo run. This resulted in a compiler error and it almost certainly shouldn't be supported and can be fixed simply by clearing the target directory and compiling again but it should possibly give a readable error to the user maybe suggesting they clear their target directory?

Code

Unfortunately I'm not really sure of a minimum example as this was a basic bevy build but I don't think this depends on the code, if it does I can share the code I used.

Meta

rustc --version --verbose:

rustc 1.47.0 (18bf6b4f0 2020-10-07)                                                                                     
binary: rustc                                                                                                           
commit-hash: 18bf6b4f01a6feaf7259ba7cdae58031af1b7b39                                                                   
commit-date: 2020-10-07                                                                                                 
host: x86_64-pc-windows-msvc                                                                                            
release: 1.47.0                                                                                                         
LLVM version: 11.0

Error output

warning: Hard linking files in the incremental compilation cache failed. Copying files instead. Consider moving the cache directory to a file system which supports hard linking in session dir `\\?\D:\Programming\my_project\my_project\target\debug\incremental\my_project-3ke2er1e5ymyw\s-ft2dwv8bhb-19eyne6-working`
thread 'rustc' panicked at 'called `Result::unwrap()` on an `Err` value: Utf8Error { valid_up_to: 1, error_len: Some(1) 
}', /rustc/18bf6b4f01a6feaf7259ba7cdae58031af1b7b39\src\librustc_serialize\opaque.rs:309:87                             
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
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/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md
note: rustc 1.47.0 (18bf6b4f0 2020-10-07) running on x86_64-pc-windows-msvc
note: compiler flags: -C embed-bitcode=no -C debuginfo=2 -C incremental --crate-type bin

note: some of the compiler flags provided by cargo are hidden
jyn514 commented 3 years ago

This looks like a Cargo issue.

DawnMagnet commented 3 years ago

It's a cargo issue, and I found that only happens on Windows, Linux seems more stable

jvhuaiying commented 1 year ago

warning: Hard linking files in the incremental compilation cache failed. Copying files instead. Consider moving the cache directory to a file system which supports hard linking in session dir \\?\F:\Codehub\ rust0\guessing_game\target\debug\incremental\guessing_game-2r2d7mvc5tb4y\s-gh7rm9tuo5-th8ngn-working

I'm having the same issue too.

jvhuaiying commented 1 year ago

这是一个货物问题,我发现只发生在Windows上,Linux似乎更稳定。

大神您好~在两年后的今天,我又遇到了这个问题

ed3899 commented 1 year ago

Having the same issue on a Vagrant VM running on Windows 11 Host.

Here are the specs. This includes the repo with my Vagrant Image for local development as well as Ansible playbooks to install Rust and other components.