You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
save-analysis: use a decoupled representation for dumped data #33348
Currently, the Dump trait exposes internal types of the compiler, which is undesirable. It also forces the trait's implementors to write lowering code (as can be seen in the current implementation of json_dumper).
Proposed solution
Create a new module in save-analysis called external_data where the new *Data structs will live (they can be moved from json_dumper, along with the lowering code).
Modify the Dump trait to operate on save_analysis::external_data::* instead of on save_analysis::data::*.
Some open problems
When getting a DefId from a NodeId, what should we do when tcx.map.opt_local_def_id(node_id) returns None? What does that mean? If we call the function with a NodeId provided by the compiler, should it always succeed? The current code doesn't make that assumption (see data.rs)
@aochagavia if the def id is from the local crate, then it should never return None. I think we can assume that and just unwrap. We do need to make sure we only call with local ids though, it is possible we could get a NodeId from an extern crate (via metadata or something?).
Activity
aochagavia commentedon May 2, 2016
cc @nrc
Do you know the answer to my questions in the open problems part?
nrc commentedon May 2, 2016
@aochagavia if the def id is from the local crate, then it should never return None. I think we can assume that and just unwrap. We do need to make sure we only call with local ids though, it is possible we could get a NodeId from an extern crate (via metadata or something?).
Rollup merge of rust-lang#33370 - aochagavia:dump, r=nrc
Rollup merge of rust-lang#33370 - aochagavia:dump, r=nrc
Rollup merge of rust-lang#33370 - aochagavia:dump, r=nrc