Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
N
next.js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alex
next.js
Commits
3596c033
Unverified
Commit
3596c033
authored
Aug 25, 2025
by
Tobias Koppers
Committed by
GitHub
Aug 25, 2025
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Turbopack: fix race condition in unit test (#82989)
parent
1029d059
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
5 deletions
+5
-5
trait_ref_cell.rs
turbopack/crates/turbo-tasks-backend/tests/trait_ref_cell.rs
+5
-5
No files found.
turbopack/crates/turbo-tasks-backend/tests/trait_ref_cell.rs
View file @
3596c033
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
#
!
[
feature
(
arbitrary_self_types_pointers
)]
#
!
[
feature
(
arbitrary_self_types_pointers
)]
#
!
[
allow
(
clippy
::
needless_return
)]
// tokio macro-generated code doesn't respect this
#
!
[
allow
(
clippy
::
needless_return
)]
// tokio macro-generated code doesn't respect this
use
std
::
sync
::
Mutex
;
use
std
::
{
collections
::
HashSet
,
mem
::
take
,
sync
::
Mutex
}
;
use
anyhow
::
Result
;
use
anyhow
::
Result
;
use
turbo_tasks
::{
IntoTraitRef
,
Invalidator
,
TraitRef
,
Vc
,
get_invalidator
};
use
turbo_tasks
::{
IntoTraitRef
,
Invalidator
,
TraitRef
,
Vc
,
get_invalidator
};
...
@@ -14,7 +14,7 @@ static REGISTRATION: Registration = register!();
...
@@ -14,7 +14,7 @@ static REGISTRATION: Registration = register!();
async
fn
trait_ref
()
{
async
fn
trait_ref
()
{
run
(
&
REGISTRATION
,
||
async
{
run
(
&
REGISTRATION
,
||
async
{
let
counter
=
Counter
::
cell
(
Counter
{
let
counter
=
Counter
::
cell
(
Counter
{
value
:
Mutex
::
new
((
0
,
None
)),
value
:
Mutex
::
new
((
0
,
Default
::
default
()
)),
});
});
let
counter_value
=
counter
.get_value
();
let
counter_value
=
counter
.get_value
();
...
@@ -64,14 +64,14 @@ struct CounterValue(usize);
...
@@ -64,14 +64,14 @@ struct CounterValue(usize);
#[turbo_tasks
::
value(serialization
=
"none"
,
cell
=
"new"
,
eq
=
"manual"
)]
#[turbo_tasks
::
value(serialization
=
"none"
,
cell
=
"new"
,
eq
=
"manual"
)]
struct
Counter
{
struct
Counter
{
#[turbo_tasks(debug_ignore,
trace_ignore)]
#[turbo_tasks(debug_ignore,
trace_ignore)]
value
:
Mutex
<
(
usize
,
Option
<
Invalidator
>
)
>
,
value
:
Mutex
<
(
usize
,
HashSet
<
Invalidator
>
)
>
,
}
}
impl
Counter
{
impl
Counter
{
fn
incr
(
&
self
)
{
fn
incr
(
&
self
)
{
let
mut
lock
=
self
.value
.lock
()
.unwrap
();
let
mut
lock
=
self
.value
.lock
()
.unwrap
();
lock
.
0
+=
1
;
lock
.
0
+=
1
;
if
let
Some
(
i
)
=
lock
.
1
.take
(
)
{
for
i
in
take
(
&
mut
lock
.
1
)
{
i
.invalidate
();
i
.invalidate
();
}
}
}
}
...
@@ -90,7 +90,7 @@ impl CounterTrait for Counter {
...
@@ -90,7 +90,7 @@ impl CounterTrait for Counter {
#[turbo_tasks
::
function]
#[turbo_tasks
::
function]
fn
get_value
(
&
self
)
->
Result
<
Vc
<
CounterValue
>>
{
fn
get_value
(
&
self
)
->
Result
<
Vc
<
CounterValue
>>
{
let
mut
lock
=
self
.value
.lock
()
.unwrap
();
let
mut
lock
=
self
.value
.lock
()
.unwrap
();
lock
.
1
=
Some
(
get_invalidator
());
lock
.
1
.insert
(
get_invalidator
());
Ok
(
Vc
::
cell
(
lock
.
0
))
Ok
(
Vc
::
cell
(
lock
.
0
))
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment