rust-lang / rust-lang/rust

`RangeBounds::is_empty` has a nonsensical implementation

Open
#149,625 5 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

C-bug T-libs
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

Essentially per https://github.com/rust-lang/libs-team/issues/277#issuecomment-3036913432

pingback https://github.com/rust-lang/libs-team/issues/539 and https://github.com/rust-lang/rust/issues/137300

"The range is non-empty, but there's no values that fulfill it in the type" is a goofy statement.

Filing this issue on behalf of @judnich seeing as @quaternic mentioned he didn't file an issue after being asked to participate in our bureaucratic nonsense. I agree with the objection: the values of interest are the values in the type, not some hypothetical value line which includes all possible inbetween gradients like the reals. That's not even a coherent notion for types which don't themselves represent a subset of some notional superset. To wit: not everything is an integer.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the current RangeBounds::is_empty implementation and the linked libs-team discussions. Resolve whether emptiness is defined over values representable by the type, then update the implementation and associated wording once maintainers agree. Done means the semantics are explicitly settled and applied consistently.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
backend-api-design
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.