Sounds like what Rust needs is <i>compile macros</i> [1]. That way, printf can still be a function, but it would be optimized at compile time if the formatting string is constant.<p>[1] <a href="https:&#x2F;&#x2F;www.cs.cmu.edu&#x2F;Groups&#x2F;AI&#x2F;html&#x2F;cltl&#x2F;clm&#x2F;node101.html" rel="nofollow">https:&#x2F;&#x2F;www.cs.cmu.edu&#x2F;Groups&#x2F;AI&#x2F;html&#x2F;cltl&#x2F;clm&#x2F;node101.html</a>