-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Migrate rustc from rustc-serialize to serde #40177
Comments
cc @rust-lang/compiler This is possible, in theory, but it would only work for decoding/encoding JSON, not our cross-crate metadata (which have much crazier requirements than serde is willing, or should handle by default). We also need to figure out plugin staging, and one proposal at the rustc dev sprint was to go full IPC. |
cc @dtolnay Rust wants to be cool, too |
@eddyb Would it not make sense to implement a metadata-specific backend for Serde? What sort of requirements are we talking here? |
@bstrie It just doesn't add up. Serde excels in turning arbitrary "tokens" into Rust types, whereas our metadata requires both specializing over the decoder (so it can be seeked in the binary blob), and a lifetime-parametric context to allocate/intern certain resources into. The metadata format is ours, and we want to experiment with a mode where the format actually matches the in-memory type layouts of the host architecture, for memory-mapping. Serde can't deal with the fact that your deserialization process is actually a relocating GC now. |
This isn't the main point here, but do I understand this correctly: Rust metadata will only ever have a single (de-)serialization backend, so there's no use in the generic way serde handles backend agnostic (de-)serialization? |
@oli-obk Correct, if there's any flexibility, it wouldn't be anywhere near Serde's level or direction. |
@eddyb Fair enough. I admit that most of my concern is in deprecating rustc-serialize as a crate that's "intended" for community consumption (Crates.io's fourth-most downloaded crate of all time nooooooooooooo). Ideally I'd like to see it reduced to the level of all of the other thousand "librustc_foo" crates in src. Or hey, could we just fold it into librustc_metadata entirely? But I'm getting offtopic here... |
Triage update: not only has this not been done, but we're also not using the one from crates.io. |
Blocked on #49219. |
OK - the json part for target specs looks simple enough, at least. |
@eddyb I'd love to offload you and help support serde in the compiler at least for JSON workloads, if you could help with mentoring me on this. I'd love to get |
Cargo is doing it ( rust-lang/cargo#3682 ). Crates.io is doing it ( rust-lang/crates.io#583 ). We want them to think we're cool, so we need to do it too.
The text was updated successfully, but these errors were encountered: