Stream: t-compiler/rust-analyzer

Topic: cfg declarations and implicit returns


Daniel Mcnab (Apr 07 2021 at 11:07, on Zulip):

I've been looking into solving rust-analyzer#8378.

I think the solution would look like modifying https://github.com/rust-analyzer/rust-analyzer/blob/a8f1e41f0f15fee02a73850db559752a9124d014/crates/hir_def/src/body/lower.rs#L697 to fallback to the last not cfged out statement, if and only if that statement is an expression statement without a semicolon. However, I can't inerate backwards through AstChildren, because that is not implemented (in rowan), although the impl should be cheap. I could just allocate a temporary vector, but I don't feel like that's the best solution.

Daniel Mcnab (Apr 07 2021 at 11:47, on Zulip):

https://github.com/rust-analyzer/rust-analyzer/pull/8398

Wasn't too bad, if people think this design makes sense.

Last update: Jul 28 2021 at 03:45UTC