cargo build tries to download packages
When issuing
cargo build
It will install packages from the internet. From my very slow internet connection, that is no good.
If you have dependencies, this is expected behavior, yes. Otherwise, how would you get them?
If you've already downloaded said dependencies, though, it should not.
Yeah as @steveklabnik mentioned this is expected behavior because the dependencies need to come from somewhere, so I'm going to close this as working as intended.
Perhaps I wasn't clear? I asked cargo to build not to download. If it needs to download, I expect that to be another command. If the command auto-downloads, it should be reflected in the command. Even better would be if there was some kind of configuration saying "I don't want to download automatically". If download is needed, it will instead error, saying something like:
cargo needs to download package xxxx-0.3, if this was intended pass --allow-download to cargo build
Ah yeah there are a number of other issues in the repo about intentionally telling Cargo to not touch the network, such as https://github.com/rust-lang/cargo/issues/2111
I think the way that git does it is quite good. There is an explicit command to download (and sync) anything. I feel that cargo does too much with the commands. For instance, I might not care that the up-streams have released new versions - why then should cargo check for it?
For instance, I might not care that the up-streams have released new versions - why then should cargo check for it?
It doesn't. I think you may be conflating a few different behaviors here.
If you don't have the requirements to build, cargo build will go get them. Yes, in theory, we could make it two commands, but that introduces friction for the majority case at the expense of the minority case.
If you do have the requirements, then it shouldn't check the network. There may be bugs, and they should be fixed.
Yes, I may have been bitten by previous bugs. I just remember the network being off-line, I had all the files in the registry already, yet still I couldn't build because cargo tried to sync to the latest. I'll check it again.