You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Notify Users of cargo +nightly install when using cargo install +nightly #10362
When running cargo install +nightly ... there is no indication that it does not actually use the nightly toolchain, until the compilation runs into errors because e.g. features need nightly.
Proposed Solution
Either:
Let the user know that cargo install +nightly ... doesn't actually use nightly and instead they should use cargo +nightly install ....
Should be fairly easy to tackle for only cargo install. That being said, I personally want a solution for all cargo commands. People may also type cargo build +nightly and we should catch that. The difficult part is that rustup proxy name can be custom defined.
If we got #11702 or clap-rs/clap#4706 landed, I think it's sufficient that we target only a subset of most common ones like +stable, +beta, +nightly.
Hi, I would like to take on this issue. But, just to confirm, from what I understand in order to resolve this issue we only need to make cargo emits the above error message whenever the add and install command is run with a crate name that has + in it. Is it correct?
If the error is emitted any time the command is given a crate name that starts with + regardless if the rest of the crate name is actually the same as one of the three toolchain channels name (stable, beta, nightly), then the following part:
Use `cargo +<crate name> add` if you meant to use `<crate name>` toolchain.
of the error should only be printed if the rest of crate name after the + sign is actually the same as one of the three toolchain channels name.
Is that correct?
Toolchain name can be anything, such like cargo +stage1 build.
My best guess is, from the array of crates name strings (krates and crates in source code), if there is a string starting with +, give the user an error.
Activity
weihanglo commentedon May 24, 2023
Should be fairly easy to tackle for only
cargo install. That being said, I personally want a solution for all cargo commands. People may also typecargo build +nightlyand we should catch that. The difficult part is thatrustupproxy name can be custom defined.If we got #11702 or clap-rs/clap#4706 landed, I think it's sufficient that we target only a subset of most common ones like
+stable,+beta,+nightly.epage commentedon May 24, 2023
The problem is
+<channel>isn't a flag per se but a positional argument.cargo installandcargo addare some of the few commands that even accept a positional argument, so I can see doing this in a one-off way.(some others accept positional arguments but those are just meant to forward to an underlying command)
weihanglo commentedon Jun 1, 2023
Agree with that.
cargo runis a thing that we probably cannot fix at this moment.Here are some pointers where
cargo installandcargo addcollect their positional argumentscargo/src/bin/cargo/commands/add.rs
Lines 239 to 244 in 58b22f0
cargo/src/bin/cargo/commands/install.rs
Lines 105 to 109 in 58b22f0
I think Cargo can send an ad-hoc error message when detecting any crate starting with
+. Something like,(you could find a better message than mine)
danilhendrasr commentedon Jun 2, 2023
Hi, I would like to take on this issue. But, just to confirm, from what I understand in order to resolve this issue we only need to make cargo emits the above error message whenever the add and install command is run with a crate name that has
+in it. Is it correct?weihanglo commentedon Jun 2, 2023
That's exactly my plan so far!
You may want to tweak the message a bit. Mine is not as good as it looks.
danilhendrasr commentedon Jun 2, 2023
Got it, I'll see what I can come up with.
@rustbot claim
danilhendrasr commentedon Jun 2, 2023
I think I need more clarification.
If the error is emitted any time the command is given a crate name that starts with
+regardless if the rest of the crate name is actually the same as one of the three toolchain channels name (stable, beta, nightly), then the following part:of the error should only be printed if the rest of crate name after the
+sign is actually the same as one of the three toolchain channels name.Is that correct?
weihanglo commentedon Jun 2, 2023
Toolchain name can be anything, such like
cargo +stage1 build.My best guess is, from the array of crates name strings (
kratesandcratesin source code), if there is a string starting with+, give the user an error.Auto merge of #12226 - danilhendrasr:feat/emit-error-on-toolchain-add…