dtolnay / dtolnay/syn

RangeLimits variant naming

Open
#1,373 0 comments 0 reactions 0 assignees View on GitHub
help wanted
Dominant language
Rust
Stars
3.4k
Forks
374
Avg merge
1d 5h
Merged PRs (30d)
2

Description

Here is syn's current RangeLimits enum:

https://github.com/dtolnay/syn/blob/391c9c6d1667be37cd5ad4de5fa305ec62296bb8/src/expr.rs#L904-L909

Rustc has the exact same thing: https://github.com/rust-lang/rust/blob/1.67.0/compiler/rustc_ast/src/ast.rs#L1323-L1328

```rust
pub enum RangeLimits {
/// Inclusive at the beginning, exclusive at the end
HalfOpen,
/// Inclusive at the beginning and end
Closed,
}
```

However it's ambiguous whether "half open" means "exclusive of upper bound" vs "bounded only on one side".

The opposite approach is taken by the current Rust Reference: https://doc.rust-lang.org/1.67.0/reference/patterns.html#range-patterns

```abnf
RangePattern :
InclusiveRangePattern | HalfOpenRangePattern

InclusiveRangePattern :
RangePatternBound `..=` RangePatternBound

HalfOpenRangePattern :
RangePatternBound `..` | `..=` RangePatternBound
```

Notice how it has a `..=` pattern which it refers to as half open, even though `..=` is never considered half open in syn or rustc.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.