This is somewhat related to issue #1423, but for parent dirs, not subdirectories.
This is on macos in case it matters. The problem might be worse if say other users have write access to any parent directories.
$ cargo --version
cargo 0.24.0
$ rustc --version
rustc 1.23.0
$ cd /tmp
$ mkdir -p a/b/c/d/e
$ cd a/b/c/d/e
$ cargo new test-project
Created library `test-project` project
$ cd test-project/
$ ls
Cargo.toml src
$ cargo build
Compiling test-project v0.1.0 (file:///private/tmp/a/b/c/d/e/test-project)
Finished dev [unoptimized + debuginfo] target(s) in 0.67 secs
$ touch /tmp/Cargo.toml
$ cargo build
error: failed to parse manifest at `/private/tmp/Cargo.toml`
Caused by:
no `package` section found.`