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
8bb30f2d
Unverified
Commit
8bb30f2d
authored
Apr 24, 2026
by
Luke Sandberg
Committed by
GitHub
Apr 24, 2026
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[turbopack] drop TransientState (#92853)
It's dead
parent
9de87449
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
3 additions
and
111 deletions
+3
-111
lib.rs
turbopack/crates/turbo-tasks/src/lib.rs
+1
-1
manager.rs
turbopack/crates/turbo-tasks/src/manager.rs
+1
-1
marker_trait.rs
turbopack/crates/turbo-tasks/src/marker_trait.rs
+0
-1
state.rs
turbopack/crates/turbo-tasks/src/state.rs
+1
-108
No files found.
turbopack/crates/turbo-tasks/src/lib.rs
View file @
8bb30f2d
...
...
@@ -101,7 +101,7 @@ pub use crate::{
read_ref
::
ReadRef
,
serialization_invalidation
::
SerializationInvalidator
,
spawn
::{
JoinHandle
,
block_for_future
,
block_in_place
,
spawn
,
spawn_blocking
,
spawn_thread
},
state
::{
State
,
TransientState
,
parking_lot_mutex_bincode
},
state
::{
State
,
parking_lot_mutex_bincode
},
task
::{
SharedReference
,
TypedSharedReference
,
task_input
::{
EitherTaskInput
,
TaskInput
},
...
...
turbopack/crates/turbo-tasks/src/manager.rs
View file @
8bb30f2d
...
...
@@ -1949,7 +1949,7 @@ pub fn mark_invalidator() {
}
/// Marks the current task as stateful. This is used to indicate that the task
/// has interior mutability (e.g., via
State or TransientState
), which means
/// has interior mutability (e.g., via
[`State`][crate::State]
), which means
/// the task may produce different outputs even with the same inputs.
///
/// Only has an effect when the `verify_determinism` feature is enabled.
...
...
turbopack/crates/turbo-tasks/src/marker_trait.rs
View file @
8bb30f2d
...
...
@@ -82,7 +82,6 @@ macro_rules! impl_auto_marker_trait {
<<
T
as
$crate
::
VcValueType
>
::
Read
as
$crate
::
VcRead
<
T
>>
::
Target
:
$trait
{}
unsafe
impl
<
T
:
$trait
>
$trait
for
$crate
::
State
<
T
>
{}
unsafe
impl
<
T
:
$trait
>
$trait
for
$crate
::
TransientState
<
T
>
{}
unsafe
impl
<
T
:
$trait
>
$trait
for
$crate
::
TransientValue
<
T
>
{}
unsafe
impl
<
T
:
$trait
>
$trait
for
$crate
::
TransientInstance
<
T
>
{}
unsafe
impl
$trait
for
$crate
::
event
::
Event
{}
...
...
turbopack/crates/turbo-tasks/src/state.rs
View file @
8bb30f2d
...
...
@@ -12,8 +12,7 @@ use tracing::trace_span;
use
crate
::{
Invalidator
,
OperationValue
,
SerializationInvalidator
,
get_invalidator
,
get_serialization_invalidator
,
manager
::
with_turbo_tasks
,
mark_session_dependent
,
mark_stateful
,
trace
::
TraceRawVcs
,
get_serialization_invalidator
,
manager
::
with_turbo_tasks
,
trace
::
TraceRawVcs
,
};
#[derive(Encode,
Decode)]
...
...
@@ -291,109 +290,3 @@ impl<T: PartialEq> State<T> {
self
.serialization_invalidator
.invalidate
();
}
}
#[derive(Encode,
Decode)]
#[bincode(bounds
=
""
)]
pub
struct
TransientState
<
T
>
{
#[bincode(skip,
default
=
"default_transient_state_inner"
)]
inner
:
Mutex
<
StateInner
<
Option
<
T
>>>
,
}
fn
default_transient_state_inner
<
T
>
()
->
Mutex
<
StateInner
<
Option
<
T
>>>
{
Mutex
::
new
(
StateInner
::
new
(
None
))
}
impl
<
T
:
Debug
>
Debug
for
TransientState
<
T
>
{
fn
fmt
(
&
self
,
f
:
&
mut
std
::
fmt
::
Formatter
<
'_
>
)
->
std
::
fmt
::
Result
{
f
.debug_struct
(
"TransientState"
)
.field
(
"value"
,
&
self
.inner
.lock
()
.value
)
.finish
()
}
}
impl
<
T
:
TraceRawVcs
>
TraceRawVcs
for
TransientState
<
T
>
{
fn
trace_raw_vcs
(
&
self
,
trace_context
:
&
mut
crate
::
trace
::
TraceRawVcsContext
)
{
self
.inner
.lock
()
.value
.trace_raw_vcs
(
trace_context
);
}
}
impl
<
T
>
Default
for
TransientState
<
T
>
{
fn
default
()
->
Self
{
// Need to be explicit to ensure marking as stateful.
Self
::
new
()
}
}
impl
<
T
>
PartialEq
for
TransientState
<
T
>
{
fn
eq
(
&
self
,
_other
:
&
Self
)
->
bool
{
false
}
}
impl
<
T
>
Eq
for
TransientState
<
T
>
{}
impl
<
T
>
TransientState
<
T
>
{
pub
fn
new
()
->
Self
{
mark_stateful
();
Self
{
inner
:
Mutex
::
new
(
StateInner
::
new
(
None
)),
}
}
/// Gets the current value of the state. The current task will be registered
/// as dependency of the state and will be invalidated when the state
/// changes.
pub
fn
get
(
&
self
)
->
StateRef
<
'_
,
Option
<
T
>>
{
mark_session_dependent
();
let
invalidator
=
get_invalidator
();
let
mut
inner
=
self
.inner
.lock
();
if
let
Some
(
invalidator
)
=
invalidator
{
inner
.add_invalidator
(
invalidator
);
}
StateRef
{
serialization_invalidator
:
None
,
inner
,
mutated
:
false
,
}
}
/// Gets the current value of the state. Untracked.
pub
fn
get_untracked
(
&
self
)
->
StateRef
<
'_
,
Option
<
T
>>
{
let
inner
=
self
.inner
.lock
();
StateRef
{
serialization_invalidator
:
None
,
inner
,
mutated
:
false
,
}
}
/// Sets the current state without comparing it with the old value. This
/// should only be used if one is sure that the value has changed.
pub
fn
set_unconditionally
(
&
self
,
value
:
T
)
{
let
mut
inner
=
self
.inner
.lock
();
inner
.set_unconditionally
(
Some
(
value
));
}
/// Updates the current state with the `update` function. The `update`
/// function need to return `true` when the value was modified. Exposing
/// the current value from the `update` function is not allowed and will
/// result in incorrect cache invalidation.
pub
fn
update_conditionally
(
&
self
,
update
:
impl
FnOnce
(
&
mut
Option
<
T
>
)
->
bool
)
{
let
mut
inner
=
self
.inner
.lock
();
inner
.update_conditionally
(
update
);
}
}
impl
<
T
:
PartialEq
>
TransientState
<
T
>
{
/// Update the current state when the `value` is different from the current
/// value. `T` must implement [PartialEq] for this to work.
pub
fn
set
(
&
self
,
value
:
T
)
{
let
mut
inner
=
self
.inner
.lock
();
inner
.set
(
Some
(
value
));
}
/// Unset the current value.
pub
fn
unset
(
&
self
)
{
let
mut
inner
=
self
.inner
.lock
();
inner
.set
(
None
);
}
}
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