@@ -13,9 +13,12 @@ use turbo_tasks_macros_shared::{
13
13
get_trait_impl_function_ident, get_type_ident, is_self_used,
14
14
};
15
15
16
- use crate::func::{
17
- DefinitionContext, FunctionArguments, NativeFn, TurboFn, filter_inline_attributes,
18
- split_function_attributes,
16
+ use crate::{
17
+ func::{
18
+ DefinitionContext, FunctionArguments, NativeFn, TurboFn, filter_inline_attributes,
19
+ split_function_attributes,
20
+ },
21
+ global_name::global_name,
19
22
};
20
23
21
24
struct ValueImplArguments {
@@ -110,7 +113,7 @@ pub fn value_impl(args: TokenStream, input: TokenStream) -> TokenStream {
110
113
let inline_attrs = filter_inline_attributes(attrs.iter().copied());
111
114
let function_path_string = format!("{ty}::{ident}", ty = ty.to_token_stream());
112
115
let native_fn = NativeFn {
113
- function_global_name: quote! { concat!(module_path!(), "::", # function_path_string)} ,
116
+ function_global_name: global_name(& function_path_string),
114
117
function_path_string,
115
118
function_path: parse_quote! { <#ty>::#inline_function_ident },
116
119
is_method: turbo_fn.is_method(),
@@ -224,10 +227,13 @@ pub fn value_impl(args: TokenStream, input: TokenStream) -> TokenStream {
224
227
let (inline_signature, inline_block) =
225
228
turbo_fn.inline_signature_and_block(block, is_self_used);
226
229
let inline_attrs = filter_inline_attributes(attrs.iter().copied());
227
-
228
230
let native_fn = NativeFn {
229
231
// This global name breaks the pattern. It isn't clear if it is intentional
230
- function_global_name: quote! { concat!(module_path!(), "::", stringify!(#ty), "::", stringify!(#trait_path), "::", stringify!(#ident))},
232
+ function_global_name: global_name(format!(
233
+ "{ty}::{trait_path}::{ident}",
234
+ ty = ty.to_token_stream(),
235
+ trait_path = trait_path.to_token_stream()
236
+ )),
231
237
function_path_string: format!(
232
238
"<{ty} as {trait_path}>::{ident}",
233
239
ty = ty.to_token_stream(),
@@ -287,7 +293,7 @@ pub fn value_impl(args: TokenStream, input: TokenStream) -> TokenStream {
287
293
});
288
294
}
289
295
}
290
-
296
+ let value_name = global_name(quote! {stringify!(#ty_ident)});
291
297
quote! {
292
298
// Register all the function impls so the ValueType can find them
293
299
// This means objects resolve as
@@ -297,13 +303,13 @@ pub fn value_impl(args: TokenStream, input: TokenStream) -> TokenStream {
297
303
// 4.VTableRegistries (requires ValueTypeIds)
298
304
turbo_tasks::macro_helpers::inventory_submit!{
299
305
turbo_tasks::macro_helpers::CollectableTraitMethods(
300
- concat!(module_path!(), "::", stringify!(#ty_ident)) ,
306
+ #value_name ,
301
307
|| (<::std::boxed::Box<dyn #trait_path> as turbo_tasks::VcValueTrait>::get_trait_type_id(),
302
308
vec![#(#trait_methods)*])
303
309
)
304
310
}
305
311
306
- // These can execute later so they can reference value_types during registration
312
+ // These can execute later so they can reference trait_types during registration
307
313
308
314
turbo_tasks::macro_helpers::inventory_submit!{
309
315
turbo_tasks::macro_helpers::CollectableTraitCastFunctions(
0 commit comments