This is tracking issue regarding potential topic to be discussed with Rust project. (Rust Safety Coding Guidelines meeting 4/3/2026)
Rust macro can generate a lot of code and it is straightforward to guarantee the correctness in safety critical application:
There are two main line of reasoning:
- Expand macro and apply the same guidelines and process for generated code (e.g. test coverage, delta review ...).
This is a accepted method for C macro and other code generator but it requires that expanded code can be compiled with same semantic.
- Apply strict macro guidelines and usage limitation.
This doesn't require any technical change in Rust tooling but there is not yet a wide agreement that by just coding guidelines is possible to guarantee code correctness.
Personally I prefer the first solution because it is the most convincing and easy to justify but it looks like that this requires a significant change in the Rust compiler.
This is tracking issue regarding potential topic to be discussed with
Rust project. (Rust Safety Coding Guidelines meeting 4/3/2026)Rust macro can generate a lot of code and it is straightforward to guarantee the correctness in safety critical application:
There are two main line of reasoning:
This is a accepted method for C macro and other code generator but it requires that expanded code can be compiled with same semantic.
This doesn't require any technical change in Rust tooling but there is not yet a wide agreement that by just coding guidelines is possible to guarantee code correctness.
Personally I prefer the first solution because it is the most convincing and easy to justify but it looks like that this requires a significant change in the Rust compiler.