我在以前的台式机上运行了这段代码,效果很好:
use serde::Deserialize;
#[derive(Deserialize)]
struct Foo {
bar: i64,
}
fn main() {}
Cargo.toml:
[dependencies]
serde = "1.0"
但现在我看到了
error: cannot find derive macro `Deserialize` in this scope
--> src/main.rs:1:5
|
2 | #[derive(Deserialize)]
| ^^^^^^^^^^^
warning: unused import: `serde::Deserialize`
--> src/main.rs:2:10
|
1 | use serde::Deserialize;
| ^^^^^^^^^^^^^^^^^^
|
= note: #[warn(unused_imports)] on by default
什么原因可能导致此问题?我正在使用Rust 1.33.0。