<feed xmlns='http://www.w3.org/2005/Atom'>
<title>rust/tests/ui/pattern/rfc-3637-guard-patterns, branch try</title>
<subtitle>https://github.com/rust-lang/rust
</subtitle>
<id>http://git.dreamy.place/mirrors/rust/atom?h=try</id>
<link rel='self' href='http://git.dreamy.place/mirrors/rust/atom?h=try'/>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/'/>
<updated>2025-05-21T13:38:08+00:00</updated>
<entry>
<title>Rollup merge of #141267 - dianne:fix-141265, r=oli-obk</title>
<updated>2025-05-21T13:38:08+00:00</updated>
<author>
<name>Matthias Krüger</name>
<email>476013+matthiaskrgr@users.noreply.github.com</email>
</author>
<published>2025-05-21T13:38:08+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=af081a42473979d094f71460e3b3f5bd18c0bb08'/>
<id>urn:sha1:af081a42473979d094f71460e3b3f5bd18c0bb08</id>
<content type='text'>
only resolve top-level guard patterns' guards once

We resolve guard patterns' guards in `resolve_pattern_inner`, so to avoid resolving them multiple times, we must avoid doing so earlier. To accomplish this, `LateResolutionVisitor::visit_pat` contains a case for guard patterns that avoids visiting their guards while walking patterns.

This PR fixes #141265, which was due to `visit::walk_pat` being used instead; this meant guards at the top level of a pattern would be visited twice. e.g. it would ICE on `for x if x in [] {}`, but not `for (x if x) in [] {}`. `visit_pat` was already used for the guard pattern in the second example, on account of the top-level pattern being parens.
</content>
</entry>
<entry>
<title>`gather_locals`: only visit guard pattern guards when checking the guard</title>
<updated>2025-05-20T06:18:08+00:00</updated>
<author>
<name>dianne</name>
<email>diannes.gm@gmail.com</email>
</author>
<published>2025-05-20T06:18:08+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=c343b2a47c29bdfe4c611ba74f9c9e455f12539b'/>
<id>urn:sha1:c343b2a47c29bdfe4c611ba74f9c9e455f12539b</id>
<content type='text'>
When checking a pattern with guards in it, `GatherLocalsVisitor` will
visit both the pattern (when type-checking the let, arm, or param
containing it) and the guard expression (when checking the guard
itself). This keeps it from visiting the guard when visiting the
pattern, since otherwise it would gather locals from the guard twice,
which would lead to a delayed bug: "evaluated expression more than
once".
</content>
</entry>
<entry>
<title>only resolve top-level guard patterns' guards once</title>
<updated>2025-05-20T01:02:54+00:00</updated>
<author>
<name>dianne</name>
<email>diannes.gm@gmail.com</email>
</author>
<published>2025-05-20T01:02:54+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=ed983c21842be5e84f11b745c0c04ea23baa5509'/>
<id>urn:sha1:ed983c21842be5e84f11b745c0c04ea23baa5509</id>
<content type='text'>
We resolve guard patterns' guards in `resolve_pattern_inner`, so to
avoid resolving them multiple times, we must avoid doing so earlier. To
accomplish this, `LateResolutionVisitor::visit_pat` contains a case for
guard patterns that avoids visiting their guards while walking patterns.
This fixes an ICE due to `visit::walk_pat` being used instead, which
meant guards at the top level of a pattern would be visited twice.
</content>
</entry>
<entry>
<title>name resolution for guard patterns</title>
<updated>2025-05-18T11:21:57+00:00</updated>
<author>
<name>dianne</name>
<email>diannes.gm@gmail.com</email>
</author>
<published>2025-05-07T13:59:30+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=f0b8ec1d71f055cbdb741565eaddabc93bf1ae75'/>
<id>urn:sha1:f0b8ec1d71f055cbdb741565eaddabc93bf1ae75</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Address review comments</title>
<updated>2024-12-07T12:37:35+00:00</updated>
<author>
<name>Nadrieril</name>
<email>nadrieril+git@gmail.com</email>
</author>
<published>2024-12-07T11:49:08+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=2459dbb4bad87c38284b0a2ba4f2d6d37db99627'/>
<id>urn:sha1:2459dbb4bad87c38284b0a2ba4f2d6d37db99627</id>
<content type='text'>
</content>
</entry>
</feed>
