nrc / rust-dxr

Rust indexing in DXR
8 stars 0 forks source link

Missing references to fields #26

Open sanxiyn opened 9 years ago

sanxiyn commented 9 years ago

https://dxr.allizom.org/rust/search?q=+var-ref:rustc::middle::dataflow::DataFlowContext::gens seems to miss many references which can be found by searching self.gens in dataflow.rs.

nrc commented 9 years ago

All the missing references are either in for loops or assert! macros, both of which are generated code. Unfortunately DXR can't handle generated code yet. It looks like once it can, this issue should be solved.

sanxiyn commented 9 years ago

Thanks, that makes sense.

Trying Rust DXR demo, I could imagine it would be useful. On the other hand, missing all codes inside for loops makes it not useful, not yet. Where should I start (say, some rough place in the code) to help get that fixed? I am interested.

nrc commented 9 years ago

Its a problem with the Rust compiler, rather than DXR. The fix is to move expansion of for loops and similar things out of libsyntax into rustc. That is harder than it sounds, unfortunately. It is on my radar for the next quarter though.

Alternatively, it could be fixed by being able to handle expanded code, we'll need this for macros anyway. This should be possible by modifying src/librustc_trans/save/dump_csv.rs to not skip generated code and to use the right part of the expansion stack (rather than the top span). This is also a pretty big change, but would be super useful. If you want to give this a go, I'd have a poke around that code to familiarise yourself, then ping me on irc and we can make a plan.