metacollect icon indicating copy to clipboard operation
metacollect copied to clipboard

Look at the output of -Z save-analysis-json

Open llogiq opened this issue 9 years ago • 2 comments

The rust compiler currently implements something similar to this project, so in the name of reducing duplication, it would be good to find out and document what it does and where we can augment it with our own analysis.

llogiq avatar May 01 '16 20:05 llogiq

You should look at the save-analysis crate you can implement data dumpers to dump data in any format you like (currently we format JSON and CSV) and I'm very open to dumping more data if there is some missing. I would strongly recommend you use that. We intend to support the API long term (it will be used to power IDEs, etc.) and will be relatively stable. We can also customise to your needs. Any approach that uses the compiler internals or crate metadata is likely to break very often.

nrc avatar May 01 '16 21:05 nrc

For the intended purposes of metacollect, MIR seems way more relevant than save-analysis.

Since https://github.com/rust-lang/rust/pull/37400, all you need to do is tcx.item_mir(def_id) to get it, even from a lint. NB: cross-crate MIR exists only for constants, const fn or #[inline]/generic functions.

eddyb avatar Nov 04 '16 05:11 eddyb