I have dozens of packages inside this one folder. I am trying to add criterion to the project so I add it per the command but cargo for whatever reason translates the package to "prodash" which is obviously nowhere similar to criterion. If I delete prodash, it translates it to something different. However, if I add criterion by using the specific version in the naming it works.
Why is that? I have scoured the internet and any documents I could find and there's no solution aside from specific version naming.
I've been using Rust since before Cargo existed, and I have no idea what you're talking about. I'm not aware of any sort of "translation" behaviour in Cargo.
I recommend that you give as much information as possible on exactly what you are doing. What does the folder structure look like? Exactly what commands are you running? Where are you running them? What is the output of Cargo? How does the manifest change?
Okay, let's establish some common ground. I just did this:
F:\Programming\Rust\sandbox\urlo\t102167>cargo init . --bin --name wtf
Created binary (application) package
F:\Programming\Rust\sandbox\urlo\t102167>type Cargo.toml
[package]
name = "wtf"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
F:\Programming\Rust\sandbox\urlo\t102167>cargo add criterion
Updating crates.io index
Adding criterion v0.5.1 to dependencies.
Features:
+ cargo_bench_support
+ plotters
+ rayon
- async
- async-std
- async_futures
- async_smol
- async_std
- async_tokio
- csv
- csv_output
- futures
- html_reports
- real_blackbox
- smol
- stable
- tokio
Updating crates.io index
F:\Programming\Rust\sandbox\urlo\t102167>type Cargo.toml
[package]
name = "wtf"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
criterion = "0.5.1"
F:\Programming\Rust\sandbox\urlo\t102167>
So this behaviour is not a thing that's supposed to happen.
You have both a .cargo and vendor. The only thing that comes to mind is that you have configured cargo to not use the public crates.io for resolving dependencies, that is preventing it from finding criterion and is instead substituting prodash (because prodash depends on criterion?).
My first instinct would be to (temporarily) ditch .cargo and vendor, along with anything to restrict cargo and see if it still happens. If it doesn't, then it's something about how you're restricting cargo, and you should probably post how you've configured cargo for scrutiny.
To be clear, I've never done anything with vendoring or restricting cargo, so I doubt I can be much direct help with this.
Edit: tiny bit of extra detail: this error message appears to occur in only two places in Cargo, with the likely culprit being a warning that the crate name you asked for doesn't match the selected crate's name. That itself is based on the result of select_package, so it does seem like for some reason Cargo is getting very confused as to what crate it's supposed to be finding.