bors[bot] 11326a6847
Merge #10387
10387: Move `IdxRange` into la-arena r=Veykril a=arzg

Currently, `IdxRange` (named `IdRange`) is located in `hir_def::item_tree`, when really it isn’t specific to `hir_def` and could become part of la-arena. The rename from `IdRange` to `IdxRange` is to maintain consistency with the naming convention used throughout la-arena (`Idx` instead of `Id`, `RawIdx` instead of `RawId`). This PR also adds a few new APIs to la-arena on top of `IdxRange` for convenience, namely:

- indexing into an `Arena` by an `IdxRange` and getting a slice of values back
- creating an `IdxRange` from an inclusive range

Currently this PR also exposes a new `Arena::next_idx` method to make constructing inclusive`IdxRange`s using `IdxRange::new` easier; however, it would in my opinion be better to remove this as it allows for easy creation of out-of-bounds `Idx`s, when `IdxRange::new_inclusive` mostly covers the same use-case while being less error-prone.

I decided to bump the la-arena version to 0.3.0 from 0.2.0 because adding a new `Index` impl for `Arena` turned out to be a breaking change: I had to add a type hint in `crates/hir_def/src/body/scope.rs` when one wasn’t necessary before, since rustc couldn’t work out the type of a closure parameter now that there are multiple `Index` impls. I’m not sure whether this is the right decision, though. 

Co-authored-by: Aramis Razzaghipour <aramisnoah@gmail.com>
2021-10-20 20:54:36 +00:00
..
2021-10-15 13:03:28 +11:00
2021-10-20 20:54:36 +00:00
2021-09-27 12:54:24 +02:00
2021-09-27 12:54:24 +02:00
2021-09-27 12:54:24 +02:00
2021-06-03 18:09:21 +02:00
2021-10-07 17:06:24 +02:00
2021-10-10 10:50:51 +09:00
2021-06-11 00:10:09 +03:00
2021-05-25 00:50:19 +02:00
2021-10-15 13:03:28 +11:00
2021-10-09 13:42:32 +03:00
2021-09-05 19:22:34 +09:00
2021-06-21 16:40:21 +02:00
2021-06-10 23:43:46 +03:00
2021-07-27 18:31:21 -04:00
2021-07-05 17:06:16 +02:00