Skip to content

Commit

Permalink
Auto merge of #116623 - Nadrieril:validate-range-endpoints, r=oli-obk
Browse files Browse the repository at this point in the history
Fix overflow checking in range patterns

When a range pattern contains an overflowing literal, if we're not careful we might not notice the overflow and use the wrapped value. This makes for confusing error messages because linting against overflowing literals is only done in a later pass. So when a range is invalid we check for overflows to provide a better error.

This check didn't use to handle negative types; this PR fixes that. First commit adds tests, second cleans up without changing behavior, third does the fix.

EDIT: while I was at it, I fixed a small annoyance about the span of the overflow lint on negated literals.

Fixes rust-lang/rust#94239
  • Loading branch information
bors committed Oct 11, 2023
2 parents a7e7dd0 + 20b0bb5 commit 79bf49b
Showing 0 changed files with 0 additions and 0 deletions.

0 comments on commit 79bf49b

Please sign in to comment.