Stream: t-compiler/wg-rls-2.0

Topic: FunctionId from ExprId


Paul Faria (May 23 2020 at 17:34, on Zulip):

Hi, I'm trying to tackle https://github.com/rust-analyzer/rust-analyzer/issues/190 . (track unsafe calls within exprs) I've already modified FunctionData to keep track of whether it's unsafe or not. I'm stuck at trying to get a FunctionId given that I've narrowed down my Expr to the Expr::Call variant.

Paul Faria (May 23 2020 at 17:51, on Zulip):

Just figured it out (using infer)

Paul Faria (May 23 2020 at 19:29, on Zulip):

So I think I have part 2 of https://github.com/rust-analyzer/rust-analyzer/issues/190#issuecomment-565817234 figured out, but I'm not sure how to approach part 1 or how to connect the two. I also think I've hacked in the diagnostics for part two so that it can be called from https://github.com/rust-analyzer/rust-analyzer/blob/f4f5fca10175b8d5fdfa36563c103f81b2b0acd3/crates/ra_hir/src/code_model.rs#L640. Does anyone have a recommended way of approaching part 1, or would someone have time between now and Monday night to go over the best way to organize some of this code?

Paul Faria (May 23 2020 at 23:16, on Zulip):

Have a PR up but I forgot to account for actual unsafe ops. I only tracked calls to unsafe fns

Paul Faria (May 24 2020 at 06:13, on Zulip):

Got pretty far with this today. Stuck at this section at the moment: https://github.com/rust-analyzer/rust-analyzer/pull/4587/files#r429603035 Not really sure how to go from Expr::Call or Expr::MethodCall to FunctionData. Overall PR is here: https://github.com/rust-analyzer/rust-analyzer/pull/4587

Last update: May 29 2020 at 17:30UTC