León Orell Valerian Liehr fe420b05e3
Rollup merge of #143678 - Kivooeo:char-overflow, r=SparrowLii
Added error for invalid char cast

fixes rust-lang/rust#143597

not really sure if I did it right, but according to cast-char test -- it is right, also this code gave me false positive result

```
for _ in 0..(256 as u8) {}
```

so this is why I added this check `if lit_val <= 0xFF`

Also I believe that error message could be improved, but I'm not sure how exactly

cc ```@hkBst```

r? compiler
2025-07-17 03:58:31 +02:00
..
2025-07-10 15:44:36 +05:00