Stream: t-compiler/rust-analyzer

Topic: Attributes on function parameters


Jonas Schievink [he/him] (Mar 17 2021 at 16:59, on Zulip):

I'm debugging a parser bug where #[attrs] on the first function parameter get attached to the PARAM_LIST instead of the PARAM node.

This is because this branch calls Marker::abandon, which puts the attributes on the PARAM_LIST parent node.

What would be the best way to fix this?

Lukas Wirth (Mar 17 2021 at 17:05, on Zulip):

Probably returning the marker on failure instead and then continue with it in the loop?

Lukas Wirth (Mar 17 2021 at 17:07, on Zulip):

Ye looks like this is whats done in other places as well https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/parser/src/grammar/items.rs#L87

Jonas Schievink [he/him] (Mar 17 2021 at 17:08, on Zulip):

looks good, I'll try that

Jonas Schievink [he/him] (Mar 17 2021 at 17:16, on Zulip):

looks like it worked, thanks!

matklad (Mar 17 2021 at 18:44, on Zulip):

might make sense to compaer this with other attr lists (like fields and such)

Last update: Jul 26 2021 at 14:00UTC