PyO3 / pyo3

Rust bindings for the Python interpreter
https://pyo3.rs
Other
11.44k stars 693 forks source link

emit c-string literals on Rust 1.77 or later #4269

Closed Icxolu closed 1 week ago

Icxolu commented 1 week ago

This emits c-string literals where possible when on Rust 1.77 or later.

Since we are not allowed to emit these literals on earlier Rust versions, we need to have the conditional compilation on the macro code itself, so I added a build.rs to emit the required cfgs.

We also have the case for doc attributes including macro invocations, since there is currently no way to concat! c-string literals, this case falls back to the c_str! macro

Closes #4261