-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
maybe a missing crate
with workspace
when edition
is not declared
#14108
Comments
The rust compiler already gave a help message, so people do get a hint for fixing that compile error. Note that if a package was created by a newer cargo, the
You'll get a warning if |
Is that output complete? In #13505 (1.78), we warn on unset edition. |
Also, this explicitly calls out that a workspace was used but this should behave the same without it. Can you confirm if there is something different with workspaces? |
Rustc giving a hint to specify a new edition would be worth considering but that would be for their repo, and their decision to make. |
I saw what went wrong. cargo/src/cargo/util/toml/mod.rs Line 1133 in ac8c6ab
There are some ways to fix this:
@epage which do you like? |
$ cargo build
Compiling package2 v0.1.0 (C:\Users\buk\RustroverProjects\rustrover-compilebug\package2)
error[E0432]: unresolved import `serde`
--> package2\src\lib.rs:1:5
|
1 | use serde::Serialize;
| ^^^^^ maybe a missing crate `serde`?
|
= help: consider adding `extern crate serde` to use the `serde` crate
For more information about this error, try `rustc --explain E0432`.
error: could not compile `package2` (lib) due to 1 previous error $ cargo version
cargo 1.79.0 (ffa9cf99a 2024-06-03) |
Probably the first one? People only get the warning on 1.78 or later, so it is sufficent for Cargo to know that they are already on a newer toolchain. They can alwasy set the |
As a new user playing around with rust and workspaces, not understanding how everything fits together, I would expect a message that allows me to track down why this issue arises. |
This came up in rust-lang#14108. This got overlooked when we added the MSRV limits to the warning. Users can silience this by setting a very old MSRV. I didn't bother finding a way to word a specialized message for this. Wording for this case seemed hard and I figure someone in this situation knows how to resolve it. Instead, we are targeting the majority of users who aren't setting a `package.rust-version` in the first place.
This came up in rust-lang#14108. This got overlooked when we added the MSRV limits to the warning. Users can silience this by setting a very old MSRV. I didn't bother finding a way to word a specialized message for this. Wording for this case seemed hard and I figure someone in this situation knows how to resolve it. Instead, we are targeting the majority of users who aren't setting a `package.rust-version` in the first place.
fix(toml): Warn when edition is unuset, even when MSRV is unset ### What does this PR try to resolve? This came up in #14108. This got overlooked when we added the MSRV limits to the warning. Users can silence this by setting a very old MSRV. I didn't bother finding a way to word a specialized message for this. Wording for this case seemed hard and I figure someone in this situation knows how to resolve it. Instead, we are targeting the majority of users who aren't setting a `package.rust-version` in the first place. ### How should we test and review this PR? ### Additional information
fix(toml): Warn when edition is unuset, even when MSRV is unset ### What does this PR try to resolve? This came up in #14108. This got overlooked when we added the MSRV limits to the warning. Users can silence this by setting a very old MSRV. I didn't bother finding a way to word a specialized message for this. Wording for this case seemed hard and I figure someone in this situation knows how to resolve it. Instead, we are targeting the majority of users who aren't setting a `package.rust-version` in the first place. ### How should we test and review this PR? ### Additional information
Thank you by looking at the PR this is much more helpful. |
Problem
Steps
Working Solution(s)
Add
edition = "2021"
Notes
Better information would be helpful.
Version
The text was updated successfully, but these errors were encountered: