<feed xmlns='http://www.w3.org/2005/Atom'>
<title>rust/tests/ui/or-patterns, branch try-perf</title>
<subtitle>https://github.com/rust-lang/rust
</subtitle>
<id>http://git.dreamy.place/mirrors/rust/atom?h=try-perf</id>
<link rel='self' href='http://git.dreamy.place/mirrors/rust/atom?h=try-perf'/>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/'/>
<updated>2025-08-30T17:44:23+00:00</updated>
<entry>
<title>Avoid unnecessary suggestion in or-pattern</title>
<updated>2025-08-30T17:44:23+00:00</updated>
<author>
<name>Esteban Küber</name>
<email>esteban@kuber.com.ar</email>
</author>
<published>2025-08-30T17:44:23+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=86085b4f65fae0ebc456202584e7e04b58a871f3'/>
<id>urn:sha1:86085b4f65fae0ebc456202584e7e04b58a871f3</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Suggest constant on unused binding in a pattern</title>
<updated>2025-08-30T17:02:44+00:00</updated>
<author>
<name>Esteban Küber</name>
<email>esteban@kuber.com.ar</email>
</author>
<published>2025-08-30T17:02:44+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=3355f4bced511aba46c5a92ea82241b6713331ba'/>
<id>urn:sha1:3355f4bced511aba46c5a92ea82241b6713331ba</id>
<content type='text'>
```
error: unused variable: `Batery`
  --&gt; $DIR/binding-typo-2.rs:110:9
   |
LL |         Batery =&gt; {}
   |         ^^^^^^
   |
help: if this is intentional, prefix it with an underscore
   |
LL |         _Batery =&gt; {}
   |         +
help: you might have meant to pattern match on the similarly named constant `Battery`
   |
LL |         Battery =&gt; {}
   |            +
```
</content>
</entry>
<entry>
<title>On unused binding in pattern, suggest unit struct/variant with similar name</title>
<updated>2025-08-30T16:24:26+00:00</updated>
<author>
<name>Esteban Küber</name>
<email>esteban@kuber.com.ar</email>
</author>
<published>2025-08-30T16:24:26+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=00f6fe1b6cbb211c4396b306566816f91a4ed371'/>
<id>urn:sha1:00f6fe1b6cbb211c4396b306566816f91a4ed371</id>
<content type='text'>
When encountering a typo in a pattern that gets interpreted as an unused binding, look for unit struct/variant of the same type as the binding:

```
error: unused variable: `Non`
  --&gt; $DIR/binding-typo-2.rs:36:9
   |
LL |         Non =&gt; {}
   |         ^^^
   |
help: if this is intentional, prefix it with an underscore
   |
LL |         _Non =&gt; {}
   |         +
help: you might have meant to pattern match on the similarly named variant `None`
   |
LL -         Non =&gt; {}
LL +         std::prelude::v1::None =&gt; {}
   |
```
</content>
</entry>
<entry>
<title>On binding not present in all patterns, look at consts and unit structs/variants for suggestions</title>
<updated>2025-08-30T02:54:46+00:00</updated>
<author>
<name>Esteban Küber</name>
<email>esteban@kuber.com.ar</email>
</author>
<published>2025-08-30T01:44:40+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=cb9cd8f8306e6e1b16661704aed8d6f09aa5db73'/>
<id>urn:sha1:cb9cd8f8306e6e1b16661704aed8d6f09aa5db73</id>
<content type='text'>
When encountering an or-pattern with a binding not available in all patterns, look for consts and unit struct/variants that have similar names as the binding to detect typos.

```
error[E0408]: variable `Ban` is not bound in all patterns
  --&gt; $DIR/binding-typo.rs:22:9
   |
LL |         (Foo, _) | (Ban, Foo) =&gt; {}
   |         ^^^^^^^^    --- variable not in all patterns
   |         |
   |         pattern doesn't bind `Ban`
   |
help: you might have meant to use the similarly named unit variant `Bar`
   |
LL -         (Foo, _) | (Ban, Foo) =&gt; {}
LL +         (Foo, _) | (Bar, Foo) =&gt; {}
   |
```

For items that are not in the immedate scope, suggest the full path for them:

```
error[E0408]: variable `Non` is not bound in all patterns
  --&gt; $DIR/binding-typo-2.rs:51:16
   |
LL |         (Non | Some(_))=&gt; {}
   |          ---   ^^^^^^^ pattern doesn't bind `Non`
   |          |
   |          variable not in all patterns
   |
help: you might have meant to use the similarly named unit variant `None`
   |
LL -         (Non | Some(_))=&gt; {}
LL +         (core::option::Option::None | Some(_))=&gt; {}
   |
```
</content>
</entry>
<entry>
<title>Add test for typo in or-pattern binding</title>
<updated>2025-08-29T20:39:36+00:00</updated>
<author>
<name>Esteban Küber</name>
<email>esteban@kuber.com.ar</email>
</author>
<published>2025-08-29T20:39:36+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=bd0ea615f73e433c43457374e76a16793b73bc9c'/>
<id>urn:sha1:bd0ea615f73e433c43457374e76a16793b73bc9c</id>
<content type='text'>
</content>
</entry>
<entry>
<title>On binding not present in all patterns, suggest potential typo</title>
<updated>2025-08-25T15:16:25+00:00</updated>
<author>
<name>Esteban Küber</name>
<email>esteban@kuber.com.ar</email>
</author>
<published>2025-08-24T19:22:51+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=8dbdb1760b23112f87aedad37e4dad97559bc750'/>
<id>urn:sha1:8dbdb1760b23112f87aedad37e4dad97559bc750</id>
<content type='text'>
```
error[E0408]: variable `Ban` is not bound in all patterns
 --&gt; f12.rs:9:9
  |
9 |         (Foo,Bar)|(Ban,Foo) =&gt; {}
  |         ^^^^^^^^^  --- variable not in all patterns
  |         |
  |         pattern doesn't bind `Ban`
  |
help: you might have meant to use the similarly named previously used binding `Bar`
  |
9 -         (Foo,Bar)|(Ban,Foo) =&gt; {}
9 +         (Foo,Bar)|(Bar,Foo) =&gt; {}
  |
```
</content>
</entry>
<entry>
<title>Rollup merge of #145234 - dianne:1-tuple-witnesses, r=jackh726</title>
<updated>2025-08-23T20:22:15+00:00</updated>
<author>
<name>Samuel Tardieu</name>
<email>sam@rfc1149.net</email>
</author>
<published>2025-08-23T20:22:15+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=5a14685a63b8306367c3fdd49717113e9ba0ba59'/>
<id>urn:sha1:5a14685a63b8306367c3fdd49717113e9ba0ba59</id>
<content type='text'>
match exhaustiveness diagnostics: show a trailing comma on singleton tuple consructors in witness patterns (and clean up a little)

Constructor patterns of type `(T,)` are written `(pat,)`, not `(pat)`. However, exhaustiveness/usefulness diagnostics would print them as `(pat)` when e.g. providing a witness of non-exhaustiveness and suggesting adding arms to make matches exhaustive; this would result in an error when applied.
rust-analyzer already prints the trailing comma, so it doesn't need changing.

This also includes some cleanup in the second commit, with justification in the commit message.
</content>
</entry>
<entry>
<title>show a trailing comma on singleton tuple constructors in witness pats</title>
<updated>2025-08-10T22:32:14+00:00</updated>
<author>
<name>dianne</name>
<email>diannes.gm@gmail.com</email>
</author>
<published>2025-08-10T22:32:14+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=9449b786218d5c5b66222a774f445e1ccf3e3666'/>
<id>urn:sha1:9449b786218d5c5b66222a774f445e1ccf3e3666</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Include whitespace in "remove `|`" suggestion and make it hidden</title>
<updated>2025-08-04T18:06:18+00:00</updated>
<author>
<name>Esteban Küber</name>
<email>esteban@kuber.com.ar</email>
</author>
<published>2025-03-01T22:27:16+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=2db126d651b6803c9b37fd021376ce6e5dd5a09e'/>
<id>urn:sha1:2db126d651b6803c9b37fd021376ce6e5dd5a09e</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Error message for top-level or-patterns suggesting a solution</title>
<updated>2025-05-09T13:16:34+00:00</updated>
<author>
<name>Kornel</name>
<email>kornel@geekhood.net</email>
</author>
<published>2025-05-09T09:57:07+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=fc20650c6a9aedbea9155b04fb1a4bcc29220480'/>
<id>urn:sha1:fc20650c6a9aedbea9155b04fb1a4bcc29220480</id>
<content type='text'>
</content>
</entry>
</feed>
