Requires N:M multi-map.

This mapping is unfinished: 263 of 18162 nodes are still unmarked.

This mapping has 1 multi-map group: several pairings are equally correct there. The code view shows one arbitrary valid pairing, not the only one.

Before

…lines 1–1099 unchanged (1099 lines)
1100 function_path,
1101 is_method,
1102 is_self_used,
1103 filter_trait_call_args,
1104 is_root,
1105 } = self;
1106
1107 if *is_method {
1108 let arg_filter = if let Some(filter) = filter_trait_call_args {
1109 let FilterTraitCallArgsTokens {
1110 filter_owned,
1111 filter_and_resolve,
1112 } = filter;
1113 quote! {
1114 ::std::option::Option::Some((
1115 #filter_owned,
1116 #filter_and_resolve,
1117 ))
1118 }
1119 } else {
1120 quote! { ::std::option::Option::None }
1121 };
1122
1123 if *is_self_used {
1124 quote! {
1125 {
1126 #[allow(deprecated)]
1127 turbo_tasks::macro_helpers::NativeFunction::new_method(
1128 #function_path_string,
1129 #function_global_name,
…lines 1130–1221 unchanged (92 lines)

After

…lines 1–1099 unchanged (1099 lines)
1100 function_path,
1101 is_method,
1102 is_self_used,
1103 filter_trait_call_args,
1104 is_root,
1105 } = self;
1106
1107 let task_fn = if *is_method && *is_self_used {
1108 quote! { turbo_tasks::macro_helpers::into_task_fn_with_this(#function_path) }
1109 } else {
1110 quote! { turbo_tasks::macro_helpers::into_task_fn(#function_path) }
1111 };
1112
1113 let arg_meta = if let Some(filter) = filter_trait_call_args {
1114 let FilterTraitCallArgsTokens {
1115 filter_owned,
1116 filter_and_resolve,
1117 } = filter;
1118 quote! {
1119 turbo_tasks::macro_helpers::ArgMeta::with_filter_trait_call_from(
1120 &#task_fn,
1121 #filter_owned,
1122 #filter_and_resolve,
1123 )
1124 }
1125 } else {
1126 quote! {
1127 turbo_tasks::macro_helpers::ArgMeta::new_from(&#task_fn)
1128 }
1129 };
1130
1131 quote! {
1132 {
1133 #[allow(deprecated)]
1134 const IMPL: &dyn turbo_tasks::task::TaskFn =
1135 const { &#task_fn as &dyn turbo_tasks::task::TaskFn };
…lines 1136–1204 unchanged (69 lines)

Before

source_file
use_declaration
use "use"
scoped_identifier
scoped_identifier
identifier "std"
:: "::"
identifier "borrow"
:: "::"
identifier "Cow"
; ";"
use_declaration
use "use"
scoped_use_list
identifier "proc_macro2"
:: "::"
use_list
{ "{"
identifier "Group"
, ","
identifier "Ident"
, ","
identifier "Span"
, ","
identifier "TokenStream"
, ","
identifier "TokenTree"
} "}"
; ";"
use_declaration
use "use"
scoped_use_list
identifier "quote"
:: "::"
use_list
{ "{"
identifier "ToTokens"
, ","
identifier "quote"
, ","
identifier "quote_spanned"
} "}"
; ";"
use_declaration
use "use"
scoped_identifier
identifier "rustc_hash"
:: "::"
identifier "FxHashSet"
; ";"
use_declaration (+95 nodes collapsed)
attribute_item
# "#"
[ "["
attribute
identifier "derive"
token_tree
( "("
identifier "Debug"
) ")"
] "]"
struct_item (+90 nodes collapsed)
attribute_item
# "#"
[ "["
attribute
identifier "derive"
token_tree
( "("
identifier "Debug"
) ")"
] "]"
struct_item (+22 nodes collapsed)
impl_item (+4437 nodes collapsed)
attribute_item
# "#"
[ "["
attribute
identifier "derive"
token_tree
( "("
identifier "PartialEq"
, ","
identifier "Eq"
) ")"
] "]"
enum_item (+21 nodes collapsed)
function_item (+323 nodes collapsed)
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment " An indication of what kind of IO this function does. Curren"...
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment " static analysis, and ignored within this macro.\n"
attribute_item
# "#"
[ "["
attribute
identifier "derive"
token_tree
( "("
identifier "Hash"
, ","
identifier "PartialEq"
, ","
identifier "Eq"
) ")"
] "]"
enum_item
enum "enum"
type_identifier "IoMarker"
enum_variant_list
{ "{"
enum_variant
identifier "Filesystem"
, ","
enum_variant
identifier "Network"
, ","
} "}"
line_comment
// "//"
function_item (+139 nodes collapsed)
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment " Arguments to the `#[turbo_tasks::function]` macro.\n"
attribute_item
# "#"
[ "["
attribute
identifier "derive"
token_tree
( "("
identifier "Default"
) ")"
] "]"
struct_item (+102 nodes collapsed)
impl_item (+361 nodes collapsed)
function_item (+101 nodes collapsed)
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment " Approximates the conversion of type `T` to `<T as FromTaskI"...
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment " with the `AutoFromTaskInput` specialization hack).\n"
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment "\n"
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment " This expansion happens manually here for a couple reasons:\n"
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment " - While it's possible to simulate specialization of methods"...
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment " autoderef) there's currently no way to simulate specializ"...
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment " - Replacing arguments with types like `<T as FromTaskInput>"...
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment " signatures illegible in the resulting rustdocs.\n"
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment "\n"
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment " Returns `Cow::Owned` when a transformation was applied, and"...
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment " made to the input type.\n"
function_item (+847 nodes collapsed)
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment " Performs [external signature rewriting][mdbook].\n"
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment "\n"
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment " The expanded return type is normally a `turbo_tasks::Vc`, b"...
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment " replaced with a custom type using `replace_vc`. Type parame"...
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment " replacement. This is used for operation functions.\n"
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment "\n"
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment " This is a hack! It approximates the expansion that we'd oth"...
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment " `<T as TaskOutput>::Return`, so that the return type shown "...
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment " possible. Break out as soon as we see something we don't re"...
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment "\n"
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment " [mdbook]: https://turbopack-rust-docs.vercel.sh/turbo-engin"...
function_item (+742 nodes collapsed)
struct_item
struct "struct"
type_identifier "RewriteSelfVisitMut"
field_declaration_list
{ "{"
field_declaration
field_identifier "self_ident"
: ":"
type_identifier "Ident"
, ","
} "}"
impl_item (+209 nodes collapsed)
function_item (+57 nodes collapsed)
function_item (+145 nodes collapsed)
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment " The context in which the function is being defined.\n"
attribute_item
# "#"
[ "["
attribute
identifier "derive"
token_tree
( "("
identifier "Debug"
, ","
identifier "Clone"
, ","
identifier "Eq"
, ","
identifier "PartialEq"
) ")"
] "]"
enum_item (+28 nodes collapsed)
impl_item (+82 nodes collapsed)
attribute_item
# "#"
[ "["
attribute
identifier "derive"
token_tree
( "("
identifier "Debug"
) ")"
] "]"
struct_item
visibility_modifier
pub "pub"
struct "struct"
type_identifier "FilterTraitCallArgsTokens"
field_declaration_list
{ "{"
field_declaration
field_identifier "filter_owned"
: ":"
type_identifier "TokenStream"
, ","
field_declaration
field_identifier "filter_and_resolve"
: ":"
type_identifier "TokenStream"
, ","
} "}"
attribute_item
# "#"
[ "["
attribute
identifier "derive"
token_tree
( "("
identifier "Debug"
) ")"
] "]"
struct_item (+67 nodes collapsed)
impl_item
impl "impl"
type_identifier "NativeFn"
declaration_list
{ "{"
function_item (+27 nodes collapsed)
function_item
visibility_modifier
pub "pub"
fn "fn"
identifier "definition"
parameters
( "("
self_parameter
& "&"
self "self"
) ")"
-> "->"
type_identifier "TokenStream"
block
{ "{"
let_declaration (+30 nodes collapsed)
expression_statement
if_expression
if "if"
unary_expression
* "*"
identifier "is_method"
block
{ "{"
let_declaration
let "let"
identifier "arg_filter"
= "="
if_expression
if "if"
let_condition
let "let"
tuple_struct_pattern
identifier "Some"
( "("
identifier "filter"
) ")"
= "="
identifier "filter_trait_call_args"
block
{ "{"
let_declaration
let "let"
struct_pattern
type_identifier "FilterTraitCallArgsTokens"
{ "{"
field_pattern
shorthand_field_identifier "filter_owned"
, ","
field_pattern
shorthand_field_identifier "filter_and_resolve"
, ","
} "}"
= "="
identifier "filter"
; ";"
macro_invocation
identifier "quote"
! "!"
token_tree
{ "{"
:: "::"
identifier "std"
:: "::"
identifier "option"
:: "::"
identifier "Option"
:: "::"
identifier "Some"
token_tree any 2:1
( "("
token_tree any 2:1
( "("
# "#"
identifier "filter_owned"
, ","
# "#"
identifier "filter_and_resolve"
, ","
) ")"
) ")"
} "}"
} "}"
else_clause
else "else"
block
{ "{"
macro_invocation
identifier "quote"
! "!"
token_tree
{ "{"
:: "::"
identifier "std"
:: "::"
identifier "option"
:: "::"
identifier "Option"
:: "::"
identifier "None"
} "}"
} "}"
; ";"
expression_statement
if_expression
if "if"
unary_expression
* "*"
identifier "is_self_used"
block (+46 nodes collapsed)
else_clause (+48 nodes collapsed)
} "}"
else_clause (+45 nodes collapsed)
} "}"
} "}"
function_item (+113 nodes collapsed)
function_item (+39 nodes collapsed)
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment " Returns true if this attribute is a turbo_tasks attribute w"...
function_item (+198 nodes collapsed)
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment " Parses a `turbo_tasks::function` attribute out of the given"...
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment " remaining attributes.\n"
function_item (+229 nodes collapsed)

After

source_file
use_declaration
use "use"
scoped_identifier
scoped_identifier
identifier "std"
:: "::"
identifier "borrow"
:: "::"
identifier "Cow"
; ";"
use_declaration
use "use"
scoped_use_list
identifier "proc_macro2"
:: "::"
use_list
{ "{"
identifier "Group"
, ","
identifier "Ident"
, ","
identifier "Span"
, ","
identifier "TokenStream"
, ","
identifier "TokenTree"
} "}"
; ";"
use_declaration
use "use"
scoped_use_list
identifier "quote"
:: "::"
use_list
{ "{"
identifier "ToTokens"
, ","
identifier "quote"
, ","
identifier "quote_spanned"
} "}"
; ";"
use_declaration
use "use"
scoped_identifier
identifier "rustc_hash"
:: "::"
identifier "FxHashSet"
; ";"
use_declaration (+95 nodes collapsed)
attribute_item
# "#"
[ "["
attribute
identifier "derive"
token_tree
( "("
identifier "Debug"
) ")"
] "]"
struct_item (+90 nodes collapsed)
attribute_item
# "#"
[ "["
attribute
identifier "derive"
token_tree
( "("
identifier "Debug"
) ")"
] "]"
struct_item (+22 nodes collapsed)
impl_item (+4437 nodes collapsed)
attribute_item
# "#"
[ "["
attribute
identifier "derive"
token_tree
( "("
identifier "PartialEq"
, ","
identifier "Eq"
) ")"
] "]"
enum_item (+21 nodes collapsed)
function_item (+323 nodes collapsed)
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment " An indication of what kind of IO this function does. Curren"...
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment " static analysis, and ignored within this macro.\n"
attribute_item
# "#"
[ "["
attribute
identifier "derive"
token_tree
( "("
identifier "Hash"
, ","
identifier "PartialEq"
, ","
identifier "Eq"
) ")"
] "]"
enum_item
enum "enum"
type_identifier "IoMarker"
enum_variant_list
{ "{"
enum_variant
identifier "Filesystem"
, ","
enum_variant
identifier "Network"
, ","
} "}"
line_comment
// "//"
function_item (+139 nodes collapsed)
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment " Arguments to the `#[turbo_tasks::function]` macro.\n"
attribute_item
# "#"
[ "["
attribute
identifier "derive"
token_tree
( "("
identifier "Default"
) ")"
] "]"
struct_item (+102 nodes collapsed)
impl_item (+361 nodes collapsed)
function_item (+101 nodes collapsed)
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment " Approximates the conversion of type `T` to `<T as FromTaskI"...
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment " with the `AutoFromTaskInput` specialization hack).\n"
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment "\n"
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment " This expansion happens manually here for a couple reasons:\n"
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment " - While it's possible to simulate specialization of methods"...
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment " autoderef) there's currently no way to simulate specializ"...
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment " - Replacing arguments with types like `<T as FromTaskInput>"...
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment " signatures illegible in the resulting rustdocs.\n"
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment "\n"
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment " Returns `Cow::Owned` when a transformation was applied, and"...
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment " made to the input type.\n"
function_item (+847 nodes collapsed)
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment " Performs [external signature rewriting][mdbook].\n"
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment "\n"
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment " The expanded return type is normally a `turbo_tasks::Vc`, b"...
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment " replaced with a custom type using `replace_vc`. Type parame"...
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment " replacement. This is used for operation functions.\n"
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment "\n"
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment " This is a hack! It approximates the expansion that we'd oth"...
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment " `<T as TaskOutput>::Return`, so that the return type shown "...
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment " possible. Break out as soon as we see something we don't re"...
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment "\n"
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment " [mdbook]: https://turbopack-rust-docs.vercel.sh/turbo-engin"...
function_item (+742 nodes collapsed)
struct_item
struct "struct"
type_identifier "RewriteSelfVisitMut"
field_declaration_list
{ "{"
field_declaration
field_identifier "self_ident"
: ":"
type_identifier "Ident"
, ","
} "}"
impl_item (+209 nodes collapsed)
function_item (+57 nodes collapsed)
function_item (+145 nodes collapsed)
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment " The context in which the function is being defined.\n"
attribute_item
# "#"
[ "["
attribute
identifier "derive"
token_tree
( "("
identifier "Debug"
, ","
identifier "Clone"
, ","
identifier "Eq"
, ","
identifier "PartialEq"
) ")"
] "]"
enum_item (+28 nodes collapsed)
impl_item (+82 nodes collapsed)
attribute_item
# "#"
[ "["
attribute
identifier "derive"
token_tree
( "("
identifier "Debug"
) ")"
] "]"
struct_item
visibility_modifier
pub "pub"
struct "struct"
type_identifier "FilterTraitCallArgsTokens"
field_declaration_list
{ "{"
field_declaration
field_identifier "filter_owned"
: ":"
type_identifier "TokenStream"
, ","
field_declaration
field_identifier "filter_and_resolve"
: ":"
type_identifier "TokenStream"
, ","
} "}"
attribute_item
# "#"
[ "["
attribute
identifier "derive"
token_tree
( "("
identifier "Debug"
) ")"
] "]"
struct_item (+67 nodes collapsed)
impl_item
impl "impl"
type_identifier "NativeFn"
declaration_list
{ "{"
function_item (+27 nodes collapsed)
function_item
visibility_modifier
pub "pub"
fn "fn"
identifier "definition"
parameters
( "("
self_parameter
& "&"
self "self"
) ")"
-> "->"
type_identifier "TokenStream"
block
{ "{"
let_declaration (+30 nodes collapsed)
let_declaration
let "let"
identifier "task_fn"
= "="
if_expression
if "if"
binary_expression
unary_expression
* "*"
identifier "is_method"
&& "&&"
unary_expression
* "*"
identifier "is_self_used"
block
{ "{"
macro_invocation
identifier "quote"
! "!"
token_tree
{ "{"
identifier "turbo_tasks"
:: "::"
identifier "macro_helpers"
:: "::"
identifier "into_task_fn_with_this"
token_tree
( "("
# "#"
identifier "function_path"
) ")"
} "}"
} "}"
else_clause (+21 nodes collapsed)
; ";"
let_declaration
let "let"
identifier "arg_meta"
= "="
if_expression
if "if"
let_condition
let "let"
tuple_struct_pattern
identifier "Some"
( "("
identifier "filter"
) ")"
= "="
identifier "filter_trait_call_args"
block
{ "{"
let_declaration
let "let"
struct_pattern
type_identifier "FilterTraitCallArgsTokens"
{ "{"
field_pattern
shorthand_field_identifier "filter_owned"
, ","
field_pattern
shorthand_field_identifier "filter_and_resolve"
, ","
} "}"
= "="
identifier "filter"
; ";"
macro_invocation
identifier "quote"
! "!"
token_tree
{ "{"
identifier "turbo_tasks"
:: "::"
identifier "macro_helpers"
:: "::"
identifier "ArgMeta"
:: "::"
identifier "with_filter_trait_call_from"
token_tree any 2:1
( "("
& "&"
# "#"
identifier "task_fn"
, ","
# "#"
identifier "filter_owned"
, ","
# "#"
identifier "filter_and_resolve"
, ","
) ")"
} "}"
} "}"
else_clause
else "else"
block
{ "{"
macro_invocation
identifier "quote"
! "!"
token_tree
{ "{"
identifier "turbo_tasks"
:: "::"
identifier "macro_helpers"
:: "::"
identifier "ArgMeta"
:: "::"
identifier "new_from"
token_tree
( "("
& "&"
# "#"
identifier "task_fn"
) ")"
} "}"
} "}"
; ";"
macro_invocation (+78 nodes collapsed)
} "}"
} "}"
function_item (+113 nodes collapsed)
function_item (+39 nodes collapsed)
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment " Returns true if this attribute is a turbo_tasks attribute w"...
function_item (+198 nodes collapsed)
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment " Parses a `turbo_tasks::function` attribute out of the given"...
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment " remaining attributes.\n"
function_item (+229 nodes collapsed)