<feed xmlns='http://www.w3.org/2005/Atom'>
<title>rust/compiler/rustc_parse/src/parser, branch 1.85.0</title>
<subtitle>https://github.com/rust-lang/rust
</subtitle>
<id>http://git.dreamy.place/mirrors/rust/atom?h=1.85.0</id>
<link rel='self' href='http://git.dreamy.place/mirrors/rust/atom?h=1.85.0'/>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/'/>
<updated>2025-01-26T00:48:11+00:00</updated>
<entry>
<title>Only assert the `Parser` size on specific arches</title>
<updated>2025-01-26T00:48:11+00:00</updated>
<author>
<name>Josh Stone</name>
<email>jistone@redhat.com</email>
</author>
<published>2025-01-22T01:24:29+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=f05d305f5a009d4013eb9e334eb6e47c6b87f48e'/>
<id>urn:sha1:f05d305f5a009d4013eb9e334eb6e47c6b87f48e</id>
<content type='text'>
The size of this struct depends on the alignment of `u128`, for example
powerpc64le and s390x have align-8 and end up with only 280 bytes. Our
64-bit tier-1 arches are the same though, so let's just assert on those.

(cherry picked from commit aef640a6130ccb3edf9bc720881c3a9dde3c0ecd)
</content>
</entry>
<entry>
<title>Rollup merge of #134884 - calciumbe:patch1, r=jieyouxu</title>
<updated>2024-12-29T20:18:07+00:00</updated>
<author>
<name>Matthias Krüger</name>
<email>matthias.krueger@famsik.de</email>
</author>
<published>2024-12-29T20:18:07+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=344a61e69b6b06aa98b6ba21cac980929507d403'/>
<id>urn:sha1:344a61e69b6b06aa98b6ba21cac980929507d403</id>
<content type='text'>
Fix typos

Hello, I fix some typos in docs and comments. Thank you very much.
</content>
</entry>
<entry>
<title>fix: typos</title>
<updated>2024-12-29T13:35:02+00:00</updated>
<author>
<name>calciumbe</name>
<email>192480234+calciumbe@users.noreply.github.com</email>
</author>
<published>2024-12-29T10:03:37+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=4f8bebd6b55e0a2986be81e50e3851a3ba973edf'/>
<id>urn:sha1:4f8bebd6b55e0a2986be81e50e3851a3ba973edf</id>
<content type='text'>
Signed-off-by: calciumbe &lt;192480234+calciumbe@users.noreply.github.com&gt;
</content>
</entry>
<entry>
<title>Skip parenthesis around tuple struct field calls</title>
<updated>2024-12-27T22:33:56+00:00</updated>
<author>
<name>David Tolnay</name>
<email>dtolnay@gmail.com</email>
</author>
<published>2024-12-27T22:25:08+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=26bb4e64645d3f3e0ed0b2921738e56888f96fd1'/>
<id>urn:sha1:26bb4e64645d3f3e0ed0b2921738e56888f96fd1</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Rollup merge of #134600 - dtolnay:chainedcomparison, r=oli-obk</title>
<updated>2024-12-21T06:18:43+00:00</updated>
<author>
<name>Jacob Pratt</name>
<email>jacob@jhpratt.dev</email>
</author>
<published>2024-12-21T06:18:43+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=ea8bc3b4bee0e4ea2cdef8e24de0a531f2e785a7'/>
<id>urn:sha1:ea8bc3b4bee0e4ea2cdef8e24de0a531f2e785a7</id>
<content type='text'>
Fix parenthesization of chained comparisons by pretty-printer

Example:

```rust
macro_rules! repro {
    () =&gt; {
        1 &lt; 2
    };
}

fn main() {
    let _ = repro!() == false;
}
```

Previously `-Zunpretty=expanded` would pretty-print this syntactically invalid output: `fn main() { let _ = 1 &lt; 2 == false; }`

```console
error: comparison operators cannot be chained
 --&gt; &lt;anon&gt;:8:23
  |
8 | fn main() { let _ = 1 &lt; 2 == false; }
  |                       ^   ^^
  |
help: parenthesize the comparison
  |
8 | fn main() { let _ = (1 &lt; 2) == false; }
  |                     +     +
```

With the fix, it will print `fn main() { let _ = (1 &lt; 2) == false; }`.

Making `-Zunpretty=expanded` consistently produce syntactically valid Rust output is important because that is what makes it possible for `cargo expand` to format and perform filtering on the expanded code.

## Review notes

According to `rg '\.fixity\(\)' compiler/` the `fixity` function is called only 3 places:

- https://github.com/rust-lang/rust/blob/13170cd787cb733ed24842ee825bcbd98dc01476/compiler/rustc_ast_pretty/src/pprust/state/expr.rs#L283-L287

- https://github.com/rust-lang/rust/blob/13170cd787cb733ed24842ee825bcbd98dc01476/compiler/rustc_hir_pretty/src/lib.rs#L1295-L1299

- https://github.com/rust-lang/rust/blob/13170cd787cb733ed24842ee825bcbd98dc01476/compiler/rustc_parse/src/parser/expr.rs#L282-L289

The 2 pretty printers definitely want to treat comparisons using `Fixity::None`. That's the whole bug being fixed. Meanwhile, the parser's `Fixity::None` codepath is previously unreachable as indicated by the comment, so as long as `Fixity::None` here behaves exactly the way that `Fixity::Left` used to behave, you can tell that this PR definitely does not constitute any behavior change for the parser.

My guess for why comparison operators were set to `Fixity::Left` instead of `Fixity::None` is that it's a very old workaround for giving a good chained comparisons diagnostic (like what I pasted above). Nowadays that is handled by a different dedicated codepath.
</content>
</entry>
<entry>
<title>Rollup merge of #133087 - estebank:stmt-misparse, r=chenyukang</title>
<updated>2024-12-21T06:18:40+00:00</updated>
<author>
<name>Jacob Pratt</name>
<email>jacob@jhpratt.dev</email>
</author>
<published>2024-12-21T06:18:40+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=36485acdac216c45fcdf8cacd5b762ffe2d58af7'/>
<id>urn:sha1:36485acdac216c45fcdf8cacd5b762ffe2d58af7</id>
<content type='text'>
Detect missing `.` in method chain in `let` bindings and statements

On parse errors where an ident is found where one wasn't expected, see if the next elements might have been meant as method call or field access.

```
error: expected one of `.`, `;`, `?`, `else`, or an operator, found `map`
  --&gt; $DIR/missing-dot-on-statement-expression.rs:7:29
   |
LL |     let _ = [1, 2, 3].iter()map(|x| x);
   |                             ^^^ expected one of `.`, `;`, `?`, `else`, or an operator
   |
help: you might have meant to write a method call
   |
LL |     let _ = [1, 2, 3].iter().map(|x| x);
   |                             +
```
</content>
</entry>
<entry>
<title>Change comparison operators to have Fixity::None</title>
<updated>2024-12-21T04:12:22+00:00</updated>
<author>
<name>David Tolnay</name>
<email>dtolnay@gmail.com</email>
</author>
<published>2024-12-21T03:50:42+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=fe65e886f30ab4e045e8e492e08f7c5e3a73129a'/>
<id>urn:sha1:fe65e886f30ab4e045e8e492e08f7c5e3a73129a</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Do not suggest `foo.Bar`</title>
<updated>2024-12-21T03:02:07+00:00</updated>
<author>
<name>Esteban Küber</name>
<email>esteban@kuber.com.ar</email>
</author>
<published>2024-12-21T03:02:07+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=1549af29c3fea4c9afde42712b5092d8cc98e140'/>
<id>urn:sha1:1549af29c3fea4c9afde42712b5092d8cc98e140</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Account for missing `.` in macros to avoid incorrect suggestion</title>
<updated>2024-12-21T02:46:33+00:00</updated>
<author>
<name>Esteban Küber</name>
<email>esteban@kuber.com.ar</email>
</author>
<published>2024-11-16T00:10:48+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=cbbc7becc820e05f64d8a23d1a63a27e51b8ff7a'/>
<id>urn:sha1:cbbc7becc820e05f64d8a23d1a63a27e51b8ff7a</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Detect missing `.` in method chain in let bindings and statements</title>
<updated>2024-12-21T02:46:33+00:00</updated>
<author>
<name>Esteban Küber</name>
<email>esteban@kuber.com.ar</email>
</author>
<published>2024-11-16T00:07:58+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=1ce0fa98c7766dc9e168b92ff9bc4e0df4fcaaef'/>
<id>urn:sha1:1ce0fa98c7766dc9e168b92ff9bc4e0df4fcaaef</id>
<content type='text'>
On parse errors where an ident is found where one wasn't expected, see if the next elements might have been meant as method call or field access.

```
error: expected one of `.`, `;`, `?`, `else`, or an operator, found `map`
  --&gt; $DIR/missing-dot-on-statement-expression.rs:7:29
   |
LL |     let _ = [1, 2, 3].iter()map(|x| x);
   |                             ^^^ expected one of `.`, `;`, `?`, `else`, or an operator
   |
help: you might have meant to write a method call
   |
LL |     let _ = [1, 2, 3].iter().map(|x| x);
   |                             +
```
</content>
</entry>
</feed>
