LWN: Comments on "Rust 1.58.0 released" https://lwn.net/Articles/881377/ This is a special feed containing comments posted to the individual LWN article titled "Rust 1.58.0 released". en-us Thu, 25 Sep 2025 18:38:51 +0000 Thu, 25 Sep 2025 18:38:51 +0000 https://www.rssboard.org/rss-specification lwn@lwn.net Rust 1.58.0 released https://lwn.net/Articles/881502/ https://lwn.net/Articles/881502/ mathstuf <div class="FormattedComment"> There&#x27;s a thread on IRLO[1] about this. The thing is that Python has the concept of a &quot;simple&quot; expression (basically what lambdas allow) to limit how crazy these expressions can get. Rust has no such restraint and if it is just &quot;any expression&quot;, you end up allowing things like custom derive and macro expansion inside of these things. See my reply[2] with an example which does this. Is this allowed in a format string?<br> <p> {<br> #[derive(Serialize)]<br> struct JsonWrapper { field1: bool, field2: u32 };<br> let wrap = JsonWrapper { field1: some_local_bool, field2: some_local_int };<br> serde_json::to_string(wrap)<br> }<br> <p> because it is an expression. FWIW, even &quot;simple&quot; things end up needing a full expression parser because of raw string literals like `r##&quot;{(string.add(r#&quot;))}&quot;#))}&quot;##` so &quot;just count quotes and braces&quot; needs to have an active string literal parser to figure things out.<br> <p> [1] <a href="https://internals.rust-lang.org/t/how-to-allow-arbitrary-expressions-in-format-strings/15812">https://internals.rust-lang.org/t/how-to-allow-arbitrary-...</a><br> [2] <a href="https://internals.rust-lang.org/t/how-to-allow-arbitrary-expressions-in-format-strings/15812/25">https://internals.rust-lang.org/t/how-to-allow-arbitrary-...</a><br> </div> Mon, 17 Jan 2022 12:09:20 +0000 Rust 1.58.0 released https://lwn.net/Articles/881492/ https://lwn.net/Articles/881492/ suckfish <div class="FormattedComment"> Yes, as of today only a bare identifier is supported.<br> <p> I don&#x27;t see any fundamental reason why more complex expressions can&#x27;t be supported, I guess it is a matter of taking time, thinking about the corner cases, and making sure it gets done properly.<br> </div> Mon, 17 Jan 2022 04:39:22 +0000 Rust 1.58.0 released https://lwn.net/Articles/881482/ https://lwn.net/Articles/881482/ darmengod <div class="FormattedComment"> I remember being rather happy when Python3 introduced f-strings in 3.6.<br> <p> <font class="QuotedText">&gt;Format strings can only capture plain identifiers, not arbitrary paths or expressions.</font><br> <p> I guess struct members are out of the question, then?<br> </div> Sun, 16 Jan 2022 23:19:55 +0000