<feed xmlns='http://www.w3.org/2005/Atom'>
<title>rust/tests/ui/const-generics/generic_const_exprs/abstract-const-as-cast-2.fixed, branch master</title>
<subtitle>https://github.com/rust-lang/rust
</subtitle>
<id>http://git.dreamy.place/mirrors/rust/atom?h=master</id>
<link rel='self' href='http://git.dreamy.place/mirrors/rust/atom?h=master'/>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/'/>
<updated>2024-03-21T00:03:59+00:00</updated>
<entry>
<title>Provide structured suggestion for unconstrained generic constant</title>
<updated>2024-03-21T00:03:59+00:00</updated>
<author>
<name>Esteban Küber</name>
<email>esteban@kuber.com.ar</email>
</author>
<published>2024-03-21T00:03:59+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=6b24fdf8113d5f422bfaeff7071d8251a13468b1'/>
<id>urn:sha1:6b24fdf8113d5f422bfaeff7071d8251a13468b1</id>
<content type='text'>
```
error: unconstrained generic constant
  --&gt; $DIR/const-argument-if-length.rs:18:10
   |
LL |     pad: [u8; is_zst::&lt;T&gt;()],
   |          ^^^^^^^^^^^^^^^^^^^
   |
help: try adding a `where` bound
   |
LL | pub struct AtLeastByte&lt;T: ?Sized&gt; where [(); is_zst::&lt;T&gt;()]: {
   |                                   ++++++++++++++++++++++++++
```

Detect when the constant expression isn't `usize` and suggest casting:

```
error: unconstrained generic constant
 --&gt; f300.rs:6:10
  |
6 |     bb::&lt;{!N}&gt;();
  |          ^^^^
-Ztrack-diagnostics: created at compiler/rustc_trait_selection/src/traits/error_reporting/type_err_ctxt_ext.rs:3539:36
  |
help: try adding a `where` bound
  |
5 | fn b&lt;const N: bool&gt;() where [(); {!N} as usize]: {
  |                       ++++++++++++++++++++++++++
```

Fix #122395.
</content>
</entry>
</feed>
