Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 0 additions & 74 deletions turbopack/crates/turbo-tasks-backend/tests/local_tasks.rs

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
error: unexpected token, expected one of: "fs", "network", "operation", "local"
error: unexpected token, expected one of: "fs", "network", or "operation"
--> tests/function/fail_attribute_invalid_args.rs:10:25
|
10 | #[turbo_tasks::function(invalid_argument)]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
error: unexpected token, expected one of: "fs", "network", "operation", "local"
error: unexpected token, expected one of: "fs", "network", or "operation"
--> tests/function/fail_attribute_invalid_args_inherent_impl.rs:15:29
|
15 | #[turbo_tasks::function(invalid_argument)]
Expand Down
51 changes: 6 additions & 45 deletions turbopack/crates/turbo-tasks-macros/src/func.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ pub struct TurboFn<'a> {
exposed_inputs: Vec<Input>,
/// Should we return `OperationVc` and require that all arguments are `NonLocalValue`s?
operation: bool,
/// Should this function use `TaskPersistence::LocalCells`?
local: bool,
}

#[derive(Debug)]
Expand Down Expand Up @@ -206,7 +204,6 @@ impl TurboFn<'_> {
this,
exposed_inputs,
operation: args.operation.is_some(),
local: args.local.is_some(),
inline_ident,
})
}
Expand Down Expand Up @@ -494,26 +491,14 @@ impl TurboFn<'_> {
}

pub fn persistence(&self) -> impl ToTokens {
if self.local {
quote! {
turbo_tasks::TaskPersistence::Local
}
} else {
quote! {
turbo_tasks::macro_helpers::get_non_local_persistence_from_inputs(&*inputs)
}
quote! {
turbo_tasks::macro_helpers::get_persistence_from_inputs(&*inputs)
}
}

pub fn persistence_with_this(&self) -> impl ToTokens {
if self.local {
quote! {
turbo_tasks::TaskPersistence::Local
}
} else {
quote! {
turbo_tasks::macro_helpers::get_non_local_persistence_from_inputs_and_this(this, &*inputs)
}
quote! {
turbo_tasks::macro_helpers::get_persistence_from_inputs_and_this(this, &*inputs)
}
}

Expand Down Expand Up @@ -748,10 +733,6 @@ pub struct FunctionArguments {
///
/// If there is an error due to this option being set, it should be reported to this span.
pub operation: Option<Span>,
/// Does not run the function as a real task, and instead runs it inside the parent task using
/// task-local state. The function call itself will not be cached, but cells will be created on
/// the parent task.
pub local: Option<Span>,
}

impl Parse for FunctionArguments {
Expand All @@ -776,24 +757,15 @@ impl Parse for FunctionArguments {
("operation", Meta::Path(_)) => {
parsed_args.operation = Some(meta.span());
}
("local", Meta::Path(_)) => {
parsed_args.local = Some(meta.span());
}
(_, meta) => {
return Err(syn::Error::new_spanned(
meta,
"unexpected token, expected one of: \"fs\", \"network\", \"operation\", \
\"local\"",
"unexpected token, expected one of: \"fs\", \"network\", or \"operation\"",
));
}
}
}
if let (Some(_), Some(span)) = (parsed_args.local, parsed_args.operation) {
return Err(syn::Error::new(
span,
"\"operation\" is mutually exclusive with the \"local\" option",
));
}

Ok(parsed_args)
}
}
Expand Down Expand Up @@ -1111,7 +1083,6 @@ pub struct NativeFn {
/// Used only if `is_method` is true.
pub is_self_used: bool,
pub filter_trait_call_args: Option<FilterTraitCallArgsTokens>,
pub local: bool,
}

impl NativeFn {
Expand All @@ -1127,7 +1098,6 @@ impl NativeFn {
is_method,
is_self_used,
filter_trait_call_args,
local,
} = self;

if *is_method {
Expand All @@ -1153,9 +1123,6 @@ impl NativeFn {
turbo_tasks::macro_helpers::NativeFunction::new_method(
#function_path_string,
#function_global_name,
turbo_tasks::macro_helpers::FunctionMeta {
local: #local,
},
#arg_filter,
#function_path,
)
Expand All @@ -1168,9 +1135,6 @@ impl NativeFn {
turbo_tasks::macro_helpers::NativeFunction::new_method_without_this(
#function_path_string,
#function_global_name,
turbo_tasks::macro_helpers::FunctionMeta {
local: #local,
},
#arg_filter,
#function_path,
)
Expand All @@ -1184,9 +1148,6 @@ impl NativeFn {
turbo_tasks::macro_helpers::NativeFunction::new_function(
#function_path_string,
#function_global_name,
turbo_tasks::macro_helpers::FunctionMeta {
local: #local,
},
#function_path,
)
}
Expand Down
2 changes: 0 additions & 2 deletions turbopack/crates/turbo-tasks-macros/src/function_macro.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ pub fn function(args: TokenStream, input: TokenStream) -> TokenStream {
let args = syn::parse::<FunctionArguments>(args)
.inspect_err(|err| errors.push(err.to_compile_error()))
.unwrap_or_default();
let local = args.local.is_some();
let is_self_used = args.operation.is_some() || is_self_used(&block);

let Some(turbo_fn) = TurboFn::new(&sig, DefinitionContext::NakedFn, args) else {
Expand All @@ -65,7 +64,6 @@ pub fn function(args: TokenStream, input: TokenStream) -> TokenStream {
is_method: turbo_fn.is_method(),
is_self_used,
filter_trait_call_args: None, // not a trait method
local,
};
let native_function_ident = get_native_function_ident(ident);
let native_function_ty = native_fn.ty();
Expand Down
4 changes: 0 additions & 4 deletions turbopack/crates/turbo-tasks-macros/src/value_impl_macro.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ pub fn value_impl(args: TokenStream, input: TokenStream) -> TokenStream {
FunctionArguments::default()
}
};
let local = func_args.local.is_some();
let is_self_used = func_args.operation.is_some() || is_self_used(block);

let Some(turbo_fn) =
Expand All @@ -119,7 +118,6 @@ pub fn value_impl(args: TokenStream, input: TokenStream) -> TokenStream {
is_method: turbo_fn.is_method(),
is_self_used,
filter_trait_call_args: None, // not a trait method
local,
};

let native_function_ident = get_inherent_impl_function_ident(ty_ident, ident);
Expand Down Expand Up @@ -208,7 +206,6 @@ pub fn value_impl(args: TokenStream, input: TokenStream) -> TokenStream {
continue;
}
};
let local = func_args.local.is_some();
let is_self_used = func_args.operation.is_some() || is_self_used(block);

let Some(turbo_fn) =
Expand Down Expand Up @@ -245,7 +242,6 @@ pub fn value_impl(args: TokenStream, input: TokenStream) -> TokenStream {
is_method: turbo_fn.is_method(),
is_self_used,
filter_trait_call_args: turbo_fn.filter_trait_call_args(),
local,
};

let native_function_ident =
Expand Down
5 changes: 0 additions & 5 deletions turbopack/crates/turbo-tasks-macros/src/value_trait_macro.rs
Original file line number Diff line number Diff line change
Expand Up @@ -212,11 +212,6 @@ pub fn value_trait(args: TokenStream, input: TokenStream) -> TokenStream {
is_method: turbo_fn.is_method(),
is_self_used,
filter_trait_call_args: turbo_fn.filter_trait_call_args(),
// `local` is currently unsupported here because:
// - The `#[turbo_tasks::function]` macro needs to be present for us to read this
// argument. (This could be fixed)
// - This only makes sense when a default implementation is present.
local: false,
};

let native_function_ident = get_trait_default_impl_function_ident(trait_ident, ident);
Expand Down
6 changes: 3 additions & 3 deletions turbopack/crates/turbo-tasks/src/macro_helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ pub use crate::{
magic_any::MagicAny,
manager::{find_cell_by_type, spawn_detached_for_testing},
native_function::{
CollectableFunction, FunctionMeta, NativeFunction, downcast_args_owned, downcast_args_ref,
CollectableFunction, NativeFunction, downcast_args_owned, downcast_args_ref,
},
value_type::{CollectableTrait, CollectableValueType},
};
Expand All @@ -32,15 +32,15 @@ pub async fn value_debug_format_field(value: ValueDebugFormatString<'_>) -> Stri
}
}

pub fn get_non_local_persistence_from_inputs(inputs: &impl TaskInput) -> TaskPersistence {
pub fn get_persistence_from_inputs(inputs: &impl TaskInput) -> TaskPersistence {
if inputs.is_transient() {
TaskPersistence::Transient
} else {
TaskPersistence::Persistent
}
}

pub fn get_non_local_persistence_from_inputs_and_this(
pub fn get_persistence_from_inputs_and_this(
this: RawVc,
inputs: &impl TaskInput,
) -> TaskPersistence {
Expand Down
Loading
Loading