Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ReadRef<T>::cell when T != T::Read::Repr #8845

Merged
merged 2 commits into from
Jul 29, 2024
Merged

Conversation

bgw
Copy link
Member

@bgw bgw commented Jul 25, 2024

Description

Fixes the test case introduced in #8843.

The theory is that Vcs are supposed to be stored as <<T as VcValueType>::Read as VcRead<T>>::Repr. However, it looks like due to an oversight, ReadRef::cell is trying to store the value as T.

This introduces a way to perform

Testing Instructions

cargo nextest r -p turbo-tasks -p turbo-tasks-memory

Copy link

vercel bot commented Jul 25, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
examples-nonmonorepo ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 29, 2024 8:42pm
rust-docs 🔄 Building (Inspect) Visit Preview 💬 Add feedback Jul 29, 2024 8:42pm
8 Skipped Deployments
Name Status Preview Comments Updated (UTC)
examples-basic-web ⬜️ Ignored (Inspect) Visit Preview Jul 29, 2024 8:42pm
examples-designsystem-docs ⬜️ Ignored (Inspect) Visit Preview Jul 29, 2024 8:42pm
examples-gatsby-web ⬜️ Ignored (Inspect) Visit Preview Jul 29, 2024 8:42pm
examples-kitchensink-blog ⬜️ Ignored (Inspect) Visit Preview Jul 29, 2024 8:42pm
examples-native-web ⬜️ Ignored (Inspect) Visit Preview Jul 29, 2024 8:42pm
examples-svelte-web ⬜️ Ignored (Inspect) Visit Preview Jul 29, 2024 8:42pm
examples-tailwind-web ⬜️ Ignored (Inspect) Visit Preview Jul 29, 2024 8:42pm
examples-vite-web ⬜️ Ignored (Inspect) Visit Preview Jul 29, 2024 8:42pm

Copy link
Member Author

bgw commented Jul 25, 2024

This stack of pull requests is managed by Graphite. Learn more about stacking.

Join @bgw and the rest of your teammates on Graphite Graphite

Copy link
Contributor

github-actions bot commented Jul 25, 2024

🟢 Turbopack Benchmark CI successful 🟢

Thanks

Copy link
Contributor

✅ This change can build next-swc

Copy link
Contributor

github-actions bot commented Jul 25, 2024

⚠️ CI failed ⚠️

The following steps have failed in CI:

  • Turbopack Rust tests (mac/win, non-blocking)

See workflow summary for details

bgw added a commit that referenced this pull request Jul 29, 2024
## Description

- Move the tests out of `all_in_one` so that we can see exactly which
parts are failing more easily.
- Add a few more tests. **The newly added `test_read_ref_round_trip`
fails** (and is ignored), indicating a bug in the generics
implementation!!! This is fixed in #8845.

## Why does `test_read_ref_round_trip` fail?

The theory is that Vcs are supposed to be stored as `<<T as
VcValueType>::Read as VcRead<T>>::Repr`. However, it looks like due to
an oversight, `ReadRef::cell` is trying to store the value as `T`.

## Why add these tests at all?

The plan (as of yesterday) is to remove support for generics, but I'd
feel more confident if I can fix the casting issues in my local Vc PRs
before I do that.

These tests should help me understand what's happening and debug things.

## Testing Instructions

```
cargo nextest r -p turbo-tasks -p turbo-tasks-memory
```
Base automatically changed from bgw/vc-generics-tests to main July 29, 2024 20:41
@bgw bgw merged commit 0275dee into main Jul 29, 2024
53 of 55 checks passed
Copy link
Member Author

bgw commented Jul 29, 2024

Merge activity

  • Jul 29, 4:51 PM EDT: @bgw merged this pull request with Graphite.

@bgw bgw deleted the bgw/fix-read-ref-cell branch July 29, 2024 20:51
ForsakenHarmony pushed a commit to vercel/next.js that referenced this pull request Jul 30, 2024
…8845)

## Description

Fixes the test case introduced in #8843.

The theory is that Vcs are supposed to be stored as `<<T as
VcValueType>::Read as VcRead<T>>::Repr`. However, it looks like due to
an oversight, `ReadRef::cell` is trying to store the value as `T`.

This introduces a way to perform 

## Testing Instructions

```
cargo nextest r -p turbo-tasks -p turbo-tasks-memory
```
ForsakenHarmony pushed a commit to vercel/next.js that referenced this pull request Aug 1, 2024
…8845)

## Description

Fixes the test case introduced in #8843.

The theory is that Vcs are supposed to be stored as `<<T as
VcValueType>::Read as VcRead<T>>::Repr`. However, it looks like due to
an oversight, `ReadRef::cell` is trying to store the value as `T`.

This introduces a way to perform 

## Testing Instructions

```
cargo nextest r -p turbo-tasks -p turbo-tasks-memory
```
bgw added a commit to vercel/next.js that referenced this pull request Aug 5, 2024
…e::raw_cell` API (#68467)

*This is a migrated PR. This was in the turbo repository before the
next.js merge.*
**Migrated From:** vercel/turborepo#8847

## Description

More fixes to `ReadRef` on top of
vercel/turborepo#8845. There's a bit of a cascade of
changes that needed to happen here:

- `ReadRef::cell` should actually use `VcCellMode` so that it supports
new/shared semantics correctly.
- ... however, `VcCellMode` needs to expose an API (`raw_cell`) for
working with `SharedReference` so that we can reuse the
`SharedReference`/`Arc` inside of `ReadRef` instead of cloning the data
inside of it.
- ... however, `CurrentCellRef` needs to expose a `compare_and_update`
method that works for `SharedReference`
(`compare_and_update_with_shared_reference`).
- ... however, the naming conventions for the `CurrentCellRef` methods
are a bit confusing at this point, so rename them.

## Bigger Picture

This my sneaky way of introducing the `raw_cell` API as part of a
smaller PR, since that API will be needed for converting a local `Vc` to
a resolved `Vc`. That's a similar problem of needing to reuse a
`SharedReference` along with `VcCellMode` semantics.

## Testing Instructions

```
cargo nextest r -p turbo-tasks -p turbo-tasks-memory
```
ForsakenHarmony pushed a commit to vercel/next.js that referenced this pull request Aug 14, 2024
…e::raw_cell` API (#68467)

*This is a migrated PR. This was in the turbo repository before the
next.js merge.*
**Migrated From:** vercel/turborepo#8847

## Description

More fixes to `ReadRef` on top of
vercel/turborepo#8845. There's a bit of a cascade of
changes that needed to happen here:

- `ReadRef::cell` should actually use `VcCellMode` so that it supports
new/shared semantics correctly.
- ... however, `VcCellMode` needs to expose an API (`raw_cell`) for
working with `SharedReference` so that we can reuse the
`SharedReference`/`Arc` inside of `ReadRef` instead of cloning the data
inside of it.
- ... however, `CurrentCellRef` needs to expose a `compare_and_update`
method that works for `SharedReference`
(`compare_and_update_with_shared_reference`).
- ... however, the naming conventions for the `CurrentCellRef` methods
are a bit confusing at this point, so rename them.

## Bigger Picture

This my sneaky way of introducing the `raw_cell` API as part of a
smaller PR, since that API will be needed for converting a local `Vc` to
a resolved `Vc`. That's a similar problem of needing to reuse a
`SharedReference` along with `VcCellMode` semantics.

## Testing Instructions

```
cargo nextest r -p turbo-tasks -p turbo-tasks-memory
```
ForsakenHarmony pushed a commit to vercel/next.js that referenced this pull request Aug 15, 2024
…e::raw_cell` API (#68467)

*This is a migrated PR. This was in the turbo repository before the
next.js merge.*
**Migrated From:** vercel/turborepo#8847

## Description

More fixes to `ReadRef` on top of
vercel/turborepo#8845. There's a bit of a cascade of
changes that needed to happen here:

- `ReadRef::cell` should actually use `VcCellMode` so that it supports
new/shared semantics correctly.
- ... however, `VcCellMode` needs to expose an API (`raw_cell`) for
working with `SharedReference` so that we can reuse the
`SharedReference`/`Arc` inside of `ReadRef` instead of cloning the data
inside of it.
- ... however, `CurrentCellRef` needs to expose a `compare_and_update`
method that works for `SharedReference`
(`compare_and_update_with_shared_reference`).
- ... however, the naming conventions for the `CurrentCellRef` methods
are a bit confusing at this point, so rename them.

## Bigger Picture

This my sneaky way of introducing the `raw_cell` API as part of a
smaller PR, since that API will be needed for converting a local `Vc` to
a resolved `Vc`. That's a similar problem of needing to reuse a
`SharedReference` along with `VcCellMode` semantics.

## Testing Instructions

```
cargo nextest r -p turbo-tasks -p turbo-tasks-memory
```
ForsakenHarmony pushed a commit to vercel/next.js that referenced this pull request Aug 16, 2024
…e::raw_cell` API (#68467)

*This is a migrated PR. This was in the turbo repository before the
next.js merge.*
**Migrated From:** vercel/turborepo#8847

## Description

More fixes to `ReadRef` on top of
vercel/turborepo#8845. There's a bit of a cascade of
changes that needed to happen here:

- `ReadRef::cell` should actually use `VcCellMode` so that it supports
new/shared semantics correctly.
- ... however, `VcCellMode` needs to expose an API (`raw_cell`) for
working with `SharedReference` so that we can reuse the
`SharedReference`/`Arc` inside of `ReadRef` instead of cloning the data
inside of it.
- ... however, `CurrentCellRef` needs to expose a `compare_and_update`
method that works for `SharedReference`
(`compare_and_update_with_shared_reference`).
- ... however, the naming conventions for the `CurrentCellRef` methods
are a bit confusing at this point, so rename them.

## Bigger Picture

This my sneaky way of introducing the `raw_cell` API as part of a
smaller PR, since that API will be needed for converting a local `Vc` to
a resolved `Vc`. That's a similar problem of needing to reuse a
`SharedReference` along with `VcCellMode` semantics.

## Testing Instructions

```
cargo nextest r -p turbo-tasks -p turbo-tasks-memory
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants