@@ -9,9 +9,9 @@ use turbo_tasks_testing::{Registration, register, run_once};
99static REGISTRATION : Registration = register ! ( ) ;
1010
1111#[ tokio:: test( flavor = "multi_thread" , worker_threads = 2 ) ]
12- async fn filtered_trait_method_args ( ) -> Result < ( ) > {
12+ async fn filtered_impl_method_args ( ) -> Result < ( ) > {
1313 run_once ( & REGISTRATION , || async {
14- let uses_arg = UsesArg . cell ( ) ;
14+ let uses_arg = UsesArg ( 0 ) . cell ( ) ;
1515 assert_eq ! (
1616 uses_arg. method_with_arg( 0 ) . to_resolved( ) . await ?,
1717 uses_arg. method_with_arg( 0 ) . to_resolved( ) . await ?,
@@ -21,7 +21,7 @@ async fn filtered_trait_method_args() -> Result<()> {
2121 uses_arg. method_with_arg( 1 ) . to_resolved( ) . await ?,
2222 ) ;
2323
24- let ignores_arg = IgnoresArg . cell ( ) ;
24+ let ignores_arg = IgnoresArg ( 0 ) . cell ( ) ;
2525 assert_eq ! (
2626 ignores_arg. method_with_arg( 0 ) . to_resolved( ) . await ?,
2727 ignores_arg. method_with_arg( 0 ) . to_resolved( ) . await ?,
@@ -30,6 +30,128 @@ async fn filtered_trait_method_args() -> Result<()> {
3030 ignores_arg. method_with_arg( 0 ) . to_resolved( ) . await ?,
3131 ignores_arg. method_with_arg( 1 ) . to_resolved( ) . await ?,
3232 ) ;
33+
34+ Ok ( ( ) )
35+ } )
36+ . await
37+ }
38+
39+ #[ tokio:: test( flavor = "multi_thread" , worker_threads = 2 ) ]
40+ async fn filtered_trait_method_args ( ) -> Result < ( ) > {
41+ run_once ( & REGISTRATION , || async {
42+ let uses_arg = UsesArg ( 0 ) . cell ( ) ;
43+ assert_eq ! (
44+ uses_arg. trait_method_with_arg( 0 ) . to_resolved( ) . await ?,
45+ uses_arg. trait_method_with_arg( 0 ) . to_resolved( ) . await ?,
46+ ) ;
47+ assert_ne ! (
48+ uses_arg. trait_method_with_arg( 0 ) . to_resolved( ) . await ?,
49+ uses_arg. trait_method_with_arg( 1 ) . to_resolved( ) . await ?,
50+ ) ;
51+
52+ let ignores_arg = IgnoresArg ( 0 ) . cell ( ) ;
53+ assert_eq ! (
54+ ignores_arg. trait_method_with_arg( 0 ) . to_resolved( ) . await ?,
55+ ignores_arg. trait_method_with_arg( 0 ) . to_resolved( ) . await ?,
56+ ) ;
57+ assert_eq ! (
58+ ignores_arg. trait_method_with_arg( 0 ) . to_resolved( ) . await ?,
59+ ignores_arg. trait_method_with_arg( 1 ) . to_resolved( ) . await ?,
60+ ) ;
61+
62+ Ok ( ( ) )
63+ } )
64+ . await
65+ }
66+
67+ #[ tokio:: test( flavor = "multi_thread" , worker_threads = 2 ) ]
68+ async fn filtered_impl_method_self ( ) -> Result < ( ) > {
69+ run_once ( & REGISTRATION , || async {
70+ let uses_arg = UsesArg ( 0 ) . cell ( ) ;
71+ let uses_arg2 = UsesArg ( 1 ) . cell ( ) ;
72+ assert_eq ! (
73+ uses_arg. method_with_arg( 0 ) . to_resolved( ) . await ?,
74+ uses_arg2. method_with_arg( 0 ) . to_resolved( ) . await ?,
75+ ) ;
76+ assert_eq ! (
77+ uses_arg. method_with_arg( 1 ) . to_resolved( ) . await ?,
78+ uses_arg2. method_with_arg( 1 ) . to_resolved( ) . await ?,
79+ ) ;
80+
81+ let ignores_arg = IgnoresArg ( 0 ) . cell ( ) ;
82+ let ignores_arg2 = IgnoresArg ( 1 ) . cell ( ) ;
83+ assert_eq ! (
84+ ignores_arg. method_with_arg( 0 ) . to_resolved( ) . await ?,
85+ ignores_arg2. method_with_arg( 0 ) . to_resolved( ) . await ?,
86+ ) ;
87+ assert_eq ! (
88+ ignores_arg. method_with_arg( 1 ) . to_resolved( ) . await ?,
89+ ignores_arg2. method_with_arg( 1 ) . to_resolved( ) . await ?,
90+ ) ;
91+ assert_eq ! (
92+ ignores_arg. method_with_arg( 0 ) . to_resolved( ) . await ?,
93+ ignores_arg2. method_with_arg( 1 ) . to_resolved( ) . await ?,
94+ ) ;
95+
96+ Ok ( ( ) )
97+ } )
98+ . await
99+ }
100+
101+ #[ tokio:: test( flavor = "multi_thread" , worker_threads = 2 ) ]
102+ async fn filtered_trait_method_self ( ) -> Result < ( ) > {
103+ run_once ( & REGISTRATION , || async {
104+ let uses_arg = UsesArg ( 0 ) . cell ( ) ;
105+ let uses_arg2 = UsesArg ( 1 ) . cell ( ) ;
106+ assert_eq ! (
107+ uses_arg. trait_method_with_arg( 0 ) . to_resolved( ) . await ?,
108+ uses_arg2. trait_method_with_arg( 0 ) . to_resolved( ) . await ?,
109+ ) ;
110+ assert_eq ! (
111+ uses_arg. trait_method_with_arg( 1 ) . to_resolved( ) . await ?,
112+ uses_arg2. trait_method_with_arg( 1 ) . to_resolved( ) . await ?,
113+ ) ;
114+
115+ let ignores_arg = IgnoresArg ( 0 ) . cell ( ) ;
116+ let ignores_arg2 = IgnoresArg ( 1 ) . cell ( ) ;
117+ assert_eq ! (
118+ ignores_arg. trait_method_with_arg( 0 ) . to_resolved( ) . await ?,
119+ ignores_arg2. trait_method_with_arg( 0 ) . to_resolved( ) . await ?,
120+ ) ;
121+ assert_eq ! (
122+ ignores_arg. trait_method_with_arg( 1 ) . to_resolved( ) . await ?,
123+ ignores_arg2. trait_method_with_arg( 1 ) . to_resolved( ) . await ?,
124+ ) ;
125+ assert_eq ! (
126+ ignores_arg. trait_method_with_arg( 0 ) . to_resolved( ) . await ?,
127+ ignores_arg2. trait_method_with_arg( 1 ) . to_resolved( ) . await ?,
128+ ) ;
129+
130+ Ok ( ( ) )
131+ } )
132+ . await
133+ }
134+
135+ #[ tokio:: test( flavor = "multi_thread" , worker_threads = 2 ) ]
136+ async fn filtered_plain_method_args ( ) -> Result < ( ) > {
137+ run_once ( & REGISTRATION , || async {
138+ assert_eq ! (
139+ method_with_arg( 0 ) . to_resolved( ) . await ?,
140+ method_with_arg( 0 ) . to_resolved( ) . await ?,
141+ ) ;
142+ assert_ne ! (
143+ method_with_arg( 0 ) . to_resolved( ) . await ?,
144+ method_with_arg( 1 ) . to_resolved( ) . await ?,
145+ ) ;
146+ assert_eq ! (
147+ method_with_ignored_arg( 0 ) . to_resolved( ) . await ?,
148+ method_with_ignored_arg( 0 ) . to_resolved( ) . await ?,
149+ ) ;
150+ assert_eq ! (
151+ method_with_ignored_arg( 0 ) . to_resolved( ) . await ?,
152+ method_with_ignored_arg( 1 ) . to_resolved( ) . await ?,
153+ ) ;
154+
33155 Ok ( ( ) )
34156 } )
35157 . await
@@ -38,28 +160,56 @@ async fn filtered_trait_method_args() -> Result<()> {
38160#[ turbo_tasks:: value_trait]
39161trait ExampleTrait {
40162 #[ turbo_tasks:: function]
41- fn method_with_arg ( & self , number : i32 ) -> Vc < ( ) > ;
163+ fn trait_method_with_arg ( & self , number : i32 ) -> Vc < ( ) > ;
42164}
43165
44166#[ turbo_tasks:: value]
45- struct UsesArg ;
167+ struct UsesArg ( i32 ) ;
46168
47169#[ turbo_tasks:: value_impl]
48- impl ExampleTrait for UsesArg {
170+ impl UsesArg {
49171 #[ turbo_tasks:: function]
50172 fn method_with_arg ( & self , number : i32 ) -> Vc < ( ) > {
51173 let _ = number;
52174 Vc :: cell ( ( ) )
53175 }
54176}
55177
178+ #[ turbo_tasks:: value_impl]
179+ impl ExampleTrait for UsesArg {
180+ #[ turbo_tasks:: function]
181+ fn trait_method_with_arg ( & self , number : i32 ) -> Vc < ( ) > {
182+ let _ = number;
183+ Vc :: cell ( ( ) )
184+ }
185+ }
186+
56187#[ turbo_tasks:: value]
57- struct IgnoresArg ;
188+ struct IgnoresArg ( i32 ) ;
58189
59190#[ turbo_tasks:: value_impl]
60- impl ExampleTrait for IgnoresArg {
191+ impl IgnoresArg {
61192 #[ turbo_tasks:: function]
62193 fn method_with_arg ( & self , _number : i32 ) -> Vc < ( ) > {
63194 Vc :: cell ( ( ) )
64195 }
65196}
197+
198+ #[ turbo_tasks:: value_impl]
199+ impl ExampleTrait for IgnoresArg {
200+ #[ turbo_tasks:: function]
201+ fn trait_method_with_arg ( & self , _number : i32 ) -> Vc < ( ) > {
202+ Vc :: cell ( ( ) )
203+ }
204+ }
205+
206+ #[ turbo_tasks:: function]
207+ fn method_with_arg ( number : i32 ) -> Vc < ( ) > {
208+ let _ = number;
209+ Vc :: cell ( ( ) )
210+ }
211+
212+ #[ turbo_tasks:: function]
213+ fn method_with_ignored_arg ( _number : i32 ) -> Vc < ( ) > {
214+ Vc :: cell ( ( ) )
215+ }
0 commit comments