argotorg / argotorg/fe

Allow tuples to be compared with == operator

Closed
#748 3 comments 0 reactions 0 assignees View on GitHub
type: feature
Dominant language
Rust
Stars
1.7k
Forks
218
Avg merge
1d 4h
Merged PRs (30d)
8

Description

### What is wrong?

We currently can't easily compare tuples with the `==` operator. E.g. the following doesn't work.

```
if get_tuple() == (1, 2) {
...
}
```

Instead what we have to do is:

```
if get_tuple() == (1, 2) {
...
}
let (val1, val2): (u8, u8) = get_tuple()
if val1 == 1 and val2 == 2 {
}
```

### How can it be fixed

~~We can probably tackle that at MIR lowering~~

Make `PartialEq` and `Eq` traits possible and use them for this.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by tracing tuple equality through the compiler and the MIR-lowering area mentioned in the issue, then inspect how the PartialEq and Eq traits are represented. The issue considers trait support the intended direction; done means tuple values can be compared with == as shown and the behavior is covered by relevant tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.