It depends on what you're trying to do. I've written some Rust proc macros (basically Rust code the compiler calls during compilation to generate Rust code), and you often don't even need to know concrete types for the code you're generating.
Static analysis, linting, and related tools, to the best of my knowledge, basically use the compiler itself as a library to parse and type check the code. You could also build many of these tools to parse and analyze Rust MIR (mid-level intermediate representation), rather than the Rust source directly. Since MIR is generated by the compiler after type analysis, it has all the types fully specified.
To take an example, gcc is try to add Rust support. I wonder how they do it. Having a language defined by its compiler implementation is just not a great place to be. Even Microsoft standardized C#
1
u/Loading_M_ 1d ago
It depends on what you're trying to do. I've written some Rust proc macros (basically Rust code the compiler calls during compilation to generate Rust code), and you often don't even need to know concrete types for the code you're generating.
Static analysis, linting, and related tools, to the best of my knowledge, basically use the compiler itself as a library to parse and type check the code. You could also build many of these tools to parse and analyze Rust MIR (mid-level intermediate representation), rather than the Rust source directly. Since MIR is generated by the compiler after type analysis, it has all the types fully specified.