Comments (5)
Serialize is a macro with the same name as a trait.
I think this is not something that users of procedural macros necessarily know. That it is not mentioned in the docs does not help.
from edition-guide.
This works:
use serde_derive::{Serialize, Deserialize};
#[derive(Serialize, Deserialize)]
...
from edition-guide.
hi @vks, this seems to be covered in the "Macro changes" section of the guide: https://rust-lang-nursery.github.io/edition-guide/2018/transitioning/modules/macros.html
Was there anything in particular about this section that was confusing, or that you think could be improved? I guess one of the problems is that in Rust 2015, you didn't have to explicitly name the macro (or derive) you want to use, but in Rust 2018 you have to name them.
from edition-guide.
from edition-guide.
The transition guide states you have to name the macro, which seems
inaccurate in this case. It should mention that in the case of procedural
macros, you have to mention the trait you want to derive.
Serialize
is a macro with the same name as a trait.
The docs mentioning derive_Serialize
are wrong in this case, derive_Serialize
is some naming scheme used only for unstable legacy syntax extensions, it doesn't apply to stable "modern" proc macros.
from edition-guide.
Related Issues (20)
- should this now say "edition 2021" rather than "the next edition"? HOT 1
- Is `std::process::exit` really something that needs to be taught in the book?
- Rust 2021 documentation for: prelude changes
- Rust 2021 documentation for: Warnings promoted to errors
- Rust 2021 documentation for: Panic macro consistency HOT 1
- Rust 2021 documentation for: IntoIterator for arrays
- Rust 2021 documentation for: Default Cargo feature resolver
- Rust 2021 documentation for: Or patterns in macro-rules
- Rust 2021 documentation for: Disjoint capture in closures (RFC 2229) HOT 4
- Rust 2021 documentation for: Reserving prefix syntax HOT 1
- Create a consistent set of sections for Edition migrations HOT 2
- Update guide to reference Rust 2021 when giving examples of editions in general HOT 4
- Spelling mistake? HOT 1
- A bunch of useful information about Rust 2018 is gone... HOT 2
- Updates for when 2021 is stabilized
- When should I update to the latest edition? HOT 3
- "Creating a new project" uses `+nightly`
- doc: consider mentioning when rust 1.0 was released
- Ambiguity rules for `use` have changed in Rust 1.72 HOT 1
- Rust 2024 Edition missing from Edition Guide HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from edition-guide.