Code
playground
(assuming serde_json is passed via --extern or in Cargo.toml, and edition is 2015)
pub use serde_json::to_string;
Current output
error[E0432]: unresolved import `serde_json`
--> src/lib.rs:1:5
|
1 | use serde_json::to_string;
| ^^^^^^^^^^ use of unresolved module or unlinked crate `serde_json`
|
help: if you wanted to use a crate named `serde_json`, use `cargo add serde_json` to add it to your `Cargo.toml` and import it in your code
|
1 + extern crate serde_json;
|
For more information about this error, try `rustc --explain E0432`.
error: could not compile `playground` (lib) due to 1 previous error
Desired output
error[E0432]: unresolved import `serde_json`
--> src/lib.rs:1:5
|
1 | use serde_json::to_string;
| ^^^^^^^^^^ use of unresolved module or unlinked crate `serde_json`
|
help: `extern crate` is required on Rust 2015
|
1 + extern crate serde_json;
|
help: consider upgrading to a newer edition (latest is 2024) to avoid needing `extern crate`
For more information about this error, try `rustc --explain E0432`.
error: could not compile `playground` (lib) due to 1 previous error
Rationale and extra context
No response
Other cases
Rust Version
Anything else?
Suggested by @workingjubilee: #t-compiler/major changes > Emit `note` when calling `rustc` without… compiler-team#1019 @ 💬
cc rust-lang/compiler-team#1019
Code
playground
(assuming
serde_jsonis passed via--externor in Cargo.toml, and edition is 2015)Current output
Desired output
Rationale and extra context
No response
Other cases
Rust Version
Anything else?
Suggested by @workingjubilee: #t-compiler/major changes > Emit `note` when calling `rustc` without… compiler-team#1019 @ 💬
cc rust-lang/compiler-team#1019