enlightware / enlightware/ferlium

Support per-trait-method generics and constraints

Open
#56 1 comment 0 reactions 0 assignees View on GitHub
trait
Dominant language
Rust
Stars
14
Forks
2
PR merge metrics
No merged PRs in 30d

Description

Currently Ferlium does not support per-trait-method constraints, preventing writing something like this:
```
trait Coll {
type Item;
type Iter;
fn len(self: &Self) -> Int;
fn iter(self: &Self) -> Iter where Iter: Iterator;
fn from_iter(iter: Iter) -> Self where Iter: Iterator;
}
```

In that example, the constraint `Iter: Iterator` cannot be stored at the trait level because the associated types couldn't be retrieved for the `len()` method. And while they are not necessary for the `len()` method, they are for the `iter`-related ones.

This requires a review of the part of the `emit_functions` function in `emit_ir`, in particular how the constraints are processed and in which order. Most likely this requires also addressing #44.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.