Move alloc tests to rmake by abhay-51 · Pull Request #121918 · rust-lang/rust (original) (raw)
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can avoid path separators (PathBuf::from
does not attempt to validate its string source, nor does it convert path separators AFAIK) via:
let lib_path = ["..", "..", "..", "library", "alloc", "src", "lib.rs"].iter().collect();
This would internally use the platform separator for the target the test is running on, and when you do path.to_str().unwrap()
you would get back a path string with the correct platform separator, for any executable (including the ones that don't try to normalize paths).
We probably want to add some arg_path
convenience API that does this, but I'm not sure of the exact API / semantics and potential footguns.