rules_rust sets one -Ldependency statement per transitive dependency, leading to potentially a very long library search path.
The issue is, on Windows, in rustc the search paths get added to the PATH environment variable, but on Windows environment variables have a limit of 32,767 characters.
The probability of that bug happening in rules_rust is quite high.
Could we try to workaround it until it is fixed at rustc's side?
See rust-lang/rust#110889
Steps to reproduce
- Create a
rust_library somecrate, it does not need to have sources
- Craete a
rust_binary somebinary, with the following sources:
// main.rs
use somecrate::*;
pub fn main() {}
- Add
somecrate to deps of somebinary, alongside many other (unused) dependencies
- Try to build
somebinary
It should lead to:
error[E0463]: can't find crate for `somecrate`
--> main.rs:1:5
|
1 | use somecrate::*;
| ^^^^ can't find crate