bors
dda2372cf3
Auto merge of #122802 - estebank:unconstrained-generic-const, r=Nadrieril
Provide structured suggestion for unconstrained generic constant
```
error: unconstrained generic constant
--> $DIR/const-argument-if-length.rs:18:10
|
LL | pad: [u8; is_zst::<T>()],
| ^^^^^^^^^^^^^^^^^^^
|
help: try adding a `where` bound
|
LL | pub struct AtLeastByte<T: ?Sized> where [(); is_zst::<T>()]: {
| ++++++++++++++++++++++++++
```
Detect when the constant expression isn't `usize` and suggest casting:
```
error: unconstrained generic constant
--> f300.rs:6:10
|
6 | bb::<{!N}>();
| ^^^^
-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<const N: bool>() where [(); {!N} as usize]: {
| ++++++++++++++++++++++++++
```
Fix #122395.
2024-03-25 09:59:37 +00:00
..
2024-03-22 12:29:42 +00:00
2024-03-22 20:48:36 +01:00
2024-03-22 11:36:58 +01:00
2024-03-22 11:36:58 +01:00
2024-03-23 22:59:43 -07:00
2024-03-23 00:37:05 +00:00
2024-03-23 18:44:17 +01:00
2024-03-24 17:08:16 +01:00
2024-03-24 17:08:16 +01:00
2024-03-24 17:08:16 +01:00
2024-03-24 17:08:16 +01:00
2024-03-21 09:01:18 +00:00
2024-03-22 11:37:02 +01:00
2024-03-24 17:08:15 +01:00
2024-03-22 11:36:58 +01:00
2024-03-22 11:36:58 +01:00
2024-03-22 20:48:36 +01:00
2024-03-23 22:59:40 -07:00
2024-03-22 20:48:36 +01:00
2024-03-23 15:00:18 +01:00
2024-03-25 01:33:46 +00:00
2024-03-24 01:05:51 +01:00
2024-03-24 17:08:15 +01:00
2024-03-23 15:00:18 +01:00
2024-03-24 17:08:15 +01:00
2024-03-25 01:33:46 +00:00
2024-03-25 01:33:46 +00:00
2024-03-23 18:45:05 +01:00
2024-03-25 01:33:46 +00:00
2024-03-22 20:34:14 +00:00
2024-03-24 01:05:53 +01:00
2024-03-24 01:05:51 +01:00
2024-03-23 15:00:18 +01:00
2024-03-22 11:13:29 -04:00
2024-03-22 20:36:21 +01:00
2024-03-21 11:42:49 -04:00
2024-03-24 17:08:15 +01:00
2024-03-23 18:45:05 +01:00
2024-03-23 18:45:05 +01:00
2024-03-23 22:59:42 -07:00
2024-03-23 22:59:40 -07:00
2024-03-25 09:59:37 +00:00
2024-03-22 20:31:29 +01:00
2024-03-22 18:07:15 -07:00
2024-03-22 11:13:29 -04:00
2024-03-23 22:59:41 -07:00