Unverified Commit 00161ce1 authored by Tobias Koppers's avatar Tobias Koppers Committed by GitHub

fix(turbopack): fix canary build after chunk_groups became a Vec (#100949)

### What?

Fixes the canary build. `turbopack-core` doesn't compile since #100928
merged:

```
error[E0599]: no method named `get_index` found for struct `Vec<ChunkGroup>` in the current scope
```

### Why?

This is a semantic merge conflict:

- #100935 changed `ChunkGroupInfo::chunk_groups` from an
`FxIndexSet<ChunkGroup>` to a `Vec<ChunkGroup>`.
- #100928's `ChunkGroupInfo::chunk_group_at` was tested on a base
without that change. It still calls `get_index`, which exists only on
`IndexSet`.

### How?

Use `Vec::get`. It returns the same `Option<&ChunkGroup>`, so the error
context and behavior stay the same. No other code has `IndexSet`-only
calls on `chunk_groups`.

Verified locally with `cargo fmt --check` and with `cargo check -p
turbopack-core --all-targets` under `-D warnings`.

<!-- NEXT_JS_LLM -->


<!-- fleet 4f67c6f7-bbe2-454b-9a17-822a60ef8f7e -->
Co-authored-by: 's avatarvercel-fleet-prod[bot] <318278635+vercel-fleet-prod[bot]@users.noreply.github.com>
Co-authored-by: 's avatarTobias Koppers <1365881+sokra@users.noreply.github.com>
Co-authored-by: 's avatarLuke Sandberg <210140+lukesandberg@users.noreply.github.com>
parent 801b7f1d
......@@ -268,7 +268,7 @@ impl ChunkGroupInfo {
/// range. The reader depends on both and is recomputed once both are updated, so an error here
/// is transient, but indexing would panic.
fn chunk_group_at(&self, index: usize) -> Result<&ChunkGroup> {
self.chunk_groups.get_index(index).with_context(|| {
self.chunk_groups.get(index).with_context(|| {
format!(
"chunk group index {index} is out of range ({} chunk groups)",
self.chunk_groups.len()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment