OUT_DIR behavior seems to be different
Hello, I have this pre-commit-hooks crate that reads the OUT_DIR environment variable and then traverses up to the root crate to find the root Cargo.toml. Works well on regular cargo build and cargo test operations, but fails to find the root Cargo.toml when building or testing using cross. Our project is a workspace-based. ~Haven't tried it on a regular single-package crate.~
Single package
Workspace-based
My guess is that cross will build the package independently and put all the crates in the same directory level.
Any pointers?
There is no guarantee that Cargo.toml is in a parent directory of OUT_DIR since you can set any arbitrary target directory with --target-dir.
You likely want to use CARGO_MANIFEST_DIR instead.
I believe I tried that one before. I'll try it again.