rust-lang / rust

Empowering everyone to build reliable and efficient software.
https://www.rust-lang.org
Other
98.32k stars 12.72k forks source link

rustc_save_analysis: get_expr_data returns None #58614

Closed chifflier closed 1 year ago

chifflier commented 5 years ago

I am currently trying to port https://github.com/nrc/callgraph.rs/ to the current nightly and updated it for the changes on rustc_private and rustc_save_analysis. The goal is to parse the saved analysis to extract a call graph.

The saved anaysis seems to work, function calls are detected correctly. However, my code does not work on method calls (like Foo::m1() or foo.m2(), because neither SaveContext::get_expr_data nor SaveContext::get_path_data returns some data on the nodes when iterating the AST and requesting analysis data.

What is the correct way of getting analysis data for method calls ? Did I miss something on the analysis ?

The code is here https://github.com/chifflier/callgraph.rs (the visitor code is here: https://github.com/chifflier/callgraph.rs/blob/master/src/visitor.rs) and I am testing using cargo run examples/methods.rs

jyn514 commented 1 year ago

Save-analysis has been removed from the compiler.