This is so unsettling.

#rust

@dpom Is this valid code???

@rog_nineteen I wish it weren't! But in the parallel universe of Rust Analyzer macros…it compiles just fine:

https://github.com/rust-lang/rust-analyzer/blob/master/crates/rust-analyzer/src/config.rs

rust-analyzer/crates/rust-analyzer/src/config.rs at master · rust-lang/rust-analyzer

A Rust compiler front-end for IDEs. Contribute to rust-lang/rust-analyzer development by creating an account on GitHub.

GitHub

@dpom @rog_nineteen

So basically this is a macro for generating a deserializable struct with default values, and the default values are provided in their serialized JSON form?

@guenther @rog_nineteen I can only guess at the motivation, but it seems that the default JSON value is used in a lot of the generated functions, so it was easier to provide it like that.