Stream: t-compiler/help

Topic: Newbie help

Kon / GolDDranks (May 28 2020 at 19:25, on Zulip):

Hi, sorry if this thread is in wrong place. Just hoping to get quick answers for newbish questions when hacking on the compiler

Kon / GolDDranks (May 28 2020 at 19:27, on Zulip):

I'm trying to improve a lint. Currently there's a span that could be narrower. So, I have a const definition like const A: bool = true; I also have a def_id of that definition. At the moment the span points to the whole definition. The thing I'm trying to get is the span of the item A itself. How can I do that?

Kon / GolDDranks (May 28 2020 at 19:28, on Zulip):

My speculation is that I'd try to get a HirId of A (I presume it is a kind of node that has an HirId), and then somehow get it's associated span. Does that sound correct? What are the APIs I need to call?

Jonas Schievink (May 28 2020 at 19:34, on Zulip):

Do you want the span of the identifier A?

Kon / GolDDranks (May 29 2020 at 07:27, on Zulip):

@Jonas Schievink yes, that's correct

Jonas Schievink (May 29 2020 at 12:14, on Zulip):

You should be able to use the HIR map to get the HIR node, which can give you the Ident, and that has a span you can use

Kon / GolDDranks (May 29 2020 at 17:46, on Zulip):

I'll see! Thanks.

pickfire (May 30 2020 at 02:36, on Zulip):

Hi, I heard that I can ping this channel to get help to try on rust-timer. Can anyone please help me on that?

Last update: Sep 28 2020 at 14:45UTC