Rust Anlyzer looking for cargo.toml in parent dir, fix?

I am not sure why but rust-analyzer is looking for cargo.toml in the directory above where all my files are located, so it is giving me an error every time I save, but if I just cargo build from the correct directory, it compiles just fine.

How to I tell rust analyzer in vscode which directory is the correct root of the project?

Nevermind. Somehow I had opened the folder in vscode from the parent directory. Just reopening vscode from the correct folder seems to have fixed it. File->Open Folder-> then select the correct root folder.

This seems like odd behavior. It seems like I should be able to tell rust-analyzer where the root is in some config file or something.

Is that possible?

Rust Analyzer will only scan the folders that have been opened in VS Code for Cargo.toml files when it tries to figure out which crates are available and how they're detected.

I prefer that behaviour because it's less "magical". Imagine if Rust Analyzer detected a Cargo.toml file several folders up (that you can't see in the VS Code explorer) and gave you error messages or completions that didn't seem to make sense in the current context.