about summary refs log tree commit diff
path: root/compiler/rustc_mir_transform/src/coverage/query.rs
diff options
context:
space:
mode:
author许杰友 Jieyou Xu (Joe) <39484203+jieyouxu@users.noreply.github.com>2025-02-05 19:09:34 +0800
committerGitHub <noreply@github.com>2025-02-05 19:09:34 +0800
commitf9f667f8b915856b0dc8e601464b415e44702a3b (patch)
treea5598e899b1bab89130c571ac6ce286787d21e90 /compiler/rustc_mir_transform/src/coverage/query.rs
parent25f7db31af3fc3476b09cb3803ecd59aeee90d3d (diff)
parentf44794f45506df2499083e66e5d225c7437ed158 (diff)
downloadrust-f9f667f8b915856b0dc8e601464b415e44702a3b.tar.gz
rust-f9f667f8b915856b0dc8e601464b415e44702a3b.zip
Rollup merge of #136304 - oli-obk:push-ymxoklvzrpvx, r=Nadrieril
Reject negative literals for unsigned or char types in pattern ranges and literals

It sucks a bit that we have to duplicate the work here (normal expressions just get this for free from the `ExprKind::UnOp(UnOp::Neg, ...)` typeck logic.

In https://github.com/rust-lang/rust/pull/134228 I caused

```rust
fn main() {
    match 42_u8 {
        -10..255 => {},
        _ => {}
    }
}
```

to just compile without even a lint.

I can't believe we didn't have tests for this

Amusingly https://github.com/rust-lang/rust/pull/136302 will also register a delayed bug in `lit_to_const` for this, so we'll have a redundancy if something like this fails again.
Diffstat (limited to 'compiler/rustc_mir_transform/src/coverage/query.rs')
0 files changed, 0 insertions, 0 deletions