My use case is calling a Rust macro in my test which expects to find generated code relative to the OUT_DIR compilation-time environment variable. It's likely that rust_binary() doesn't set this either; I haven't checked because I use a genrule to create the output files.