diff options
| author | Matthias Krüger <476013+matthiaskrgr@users.noreply.github.com> | 2025-09-28 09:15:23 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-09-28 09:15:23 +0200 |
| commit | 4eddf645bf4d19fe52d1cf607ae3dc0e13787809 (patch) | |
| tree | cad30493cdff29c4e7dddda9efaed1c4f0e35351 /compiler/rustc_mir_build | |
| parent | 4e9cfc726c885adae6b2f7f06f3d0c2784c3c38c (diff) | |
| parent | 7e58c9110521d960cb97e730dfe700b3ec64c9ab (diff) | |
| download | rust-4eddf645bf4d19fe52d1cf607ae3dc0e13787809.tar.gz rust-4eddf645bf4d19fe52d1cf607ae3dc0e13787809.zip | |
Rollup merge of #146745 - helldawg:master, r=workingjubilee
Clarified error note for usize range matching Fixes rust-lang/rust#146476 This is kinda rough, but it gets the point across a little better and stays short.
Diffstat (limited to 'compiler/rustc_mir_build')
| -rw-r--r-- | compiler/rustc_mir_build/src/thir/pattern/check_match.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/compiler/rustc_mir_build/src/thir/pattern/check_match.rs b/compiler/rustc_mir_build/src/thir/pattern/check_match.rs index ae67bb5075e..3929a97eed8 100644 --- a/compiler/rustc_mir_build/src/thir/pattern/check_match.rs +++ b/compiler/rustc_mir_build/src/thir/pattern/check_match.rs @@ -1275,13 +1275,13 @@ fn report_non_exhaustive_match<'p, 'tcx>( if ty.is_ptr_sized_integral() { if ty.inner() == cx.tcx.types.usize { err.note(format!( - "`{ty}` does not have a fixed maximum value, so half-open ranges are \ - necessary to match exhaustively", + "`{ty}::MAX` is not treated as exhaustive, \ + so half-open ranges are necessary to match exhaustively", )); } else if ty.inner() == cx.tcx.types.isize { err.note(format!( - "`{ty}` does not have fixed minimum and maximum values, so half-open \ - ranges are necessary to match exhaustively", + "`{ty}::MIN` and `{ty}::MAX` are not treated as exhaustive, \ + so half-open ranges are necessary to match exhaustively", )); } } else if ty.inner() == cx.tcx.types.str_ { |
