News for hackers. Stuff that matters.
Re:Rust 1.58.0 by DrMeepster on Thursday January 13, 2022 @02:34PM (#29925609)
This can never happen with regular string literals. String literals have the type `&'static str` but formatting returns a `String`.
Re:Rust 1.58.0 by pornel on Thursday January 13, 2022 @02:54PM (#29925902)
Perhaps something could be done with compile-time code execution, but the bigger problem is that it wouldn't be backwards-compatible. Currently "{foo}" is a perfectly valid string that doesn't evaluate anything.
Re:Rust 1.58.0 by hajile on Thursday January 13, 2022 @03:17PM (#29926216)
In truth, it probably requires something like `f"foo {bar}"`