this post was submitted on 23 Nov 2024
17 points (94.7% liked)

Rust Programming

8191 readers
2 users here now

founded 5 years ago
MODERATORS
 

In python, when you install stuff with pip, it is recommended to use a venv, to avoid breaking dependencies for a program when uninstalling another one, or when two programs need two different versions of the same dependence.

I was wondering if with Rust is the same, or if Cargo manages it all on its own (kind of like apt does), and I shouldn't care about it.

Also since I know Linux kernel is using some Rust, isn't there a risk of breaking my system if I uninstall a program that need some deps that the system itsel needs?

you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 5 points 4 days ago

No, you don’t need to do that.

All the source code of your dependencies are stored in ~/.cargo/registry^1. Which doesn’t lead to conflicts.

And the compiled versions are stored in the target/ directory in your project directory^2, so there’s no conflict there.

1: that is configurable with CARGO_HOME, I have that set to ~/.cache/cargo

2: That is configurable with the build.target-dir option. I have that set to ~/.cache/cargo/target so that build artifacts don’t end up in my backups :)