Your Rust compiler now has an OpenAI API key
A proc macro that calls ChatGPT at compile time to fill in missing function bodies and generate tests.

What it does
gpt-macro is a Rust proc macro that stops compilation, sends your code and a natural-language prompt to the ChatGPT API, and pastes the response back into your source before the compiler continues. It provides two macros: auto_impl!{} for generating function bodies from descriptions, and #[auto_test(...)] for auto-generating test cases.
The interesting bit
The macro expansion phase becomes a network request. This is either a clever prototyping shortcut or a reproducible-build nightmare, depending on your mood. The README’s fizzbuzz example shows the full lifecycle: you write the signature and a prompt, the macro queries OpenAI, and the compiler proceeds with the returned implementation.
Key highlights
auto_impl!{}takes a string prompt plus incomplete code, sends it to ChatGPT, and substitutes the response#[auto_test(...)]generates test functions from a list of test names you provide- Requires
OPENAI_API_KEYenvironment variable set before building - Works at macro expansion time, so generated code is compiled normally afterward
- MIT licensed
Caveats
- Build reproducibility depends on an external API and a language model with no version pinning mentioned
- No caching or offline mode is documented; repeated builds re-query the API
- The README does not specify which ChatGPT model is used or how errors are handled when the API is unreachable
Verdict
Worth a look if you want to experiment with LLM-assisted prototyping in Rust, but probably not for production codebases where deterministic builds matter. The 668 stars suggest the novelty resonates; the architecture suggests caution.