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
2d01e08e
Unverified
Commit
2d01e08e
authored
Nov 20, 2025
by
Tobias Koppers
Committed by
GitHub
Nov 20, 2025
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Turbopack: test if unused self arguments are filtered (#86353)
### What? add test case for self argument filtering
parent
24033486
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
158 additions
and
8 deletions
+158
-8
filter_unused_args.rs
...ck/crates/turbo-tasks-backend/tests/filter_unused_args.rs
+158
-8
No files found.
turbopack/crates/turbo-tasks-backend/tests/filter_unused_args.rs
View file @
2d01e08e
...
@@ -9,9 +9,9 @@ use turbo_tasks_testing::{Registration, register, run_once};
...
@@ -9,9 +9,9 @@ use turbo_tasks_testing::{Registration, register, run_once};
static
REGISTRATION
:
Registration
=
register!
();
static
REGISTRATION
:
Registration
=
register!
();
#[tokio
::
test(flavor
=
"multi_thread"
,
worker_threads
=
2
)]
#[tokio
::
test(flavor
=
"multi_thread"
,
worker_threads
=
2
)]
async
fn
filtered_
trait
_method_args
()
->
Result
<
()
>
{
async
fn
filtered_
impl
_method_args
()
->
Result
<
()
>
{
run_once
(
&
REGISTRATION
,
||
async
{
run_once
(
&
REGISTRATION
,
||
async
{
let
uses_arg
=
UsesArg
.cell
();
let
uses_arg
=
UsesArg
(
0
)
.cell
();
assert_eq!
(
assert_eq!
(
uses_arg
.method_with_arg
(
0
)
.to_resolved
()
.await
?
,
uses_arg
.method_with_arg
(
0
)
.to_resolved
()
.await
?
,
uses_arg
.method_with_arg
(
0
)
.to_resolved
()
.await
?
,
uses_arg
.method_with_arg
(
0
)
.to_resolved
()
.await
?
,
...
@@ -21,7 +21,7 @@ async fn filtered_trait_method_args() -> Result<()> {
...
@@ -21,7 +21,7 @@ async fn filtered_trait_method_args() -> Result<()> {
uses_arg
.method_with_arg
(
1
)
.to_resolved
()
.await
?
,
uses_arg
.method_with_arg
(
1
)
.to_resolved
()
.await
?
,
);
);
let
ignores_arg
=
IgnoresArg
.cell
();
let
ignores_arg
=
IgnoresArg
(
0
)
.cell
();
assert_eq!
(
assert_eq!
(
ignores_arg
.method_with_arg
(
0
)
.to_resolved
()
.await
?
,
ignores_arg
.method_with_arg
(
0
)
.to_resolved
()
.await
?
,
ignores_arg
.method_with_arg
(
0
)
.to_resolved
()
.await
?
,
ignores_arg
.method_with_arg
(
0
)
.to_resolved
()
.await
?
,
...
@@ -30,6 +30,128 @@ async fn filtered_trait_method_args() -> Result<()> {
...
@@ -30,6 +30,128 @@ async fn filtered_trait_method_args() -> Result<()> {
ignores_arg
.method_with_arg
(
0
)
.to_resolved
()
.await
?
,
ignores_arg
.method_with_arg
(
0
)
.to_resolved
()
.await
?
,
ignores_arg
.method_with_arg
(
1
)
.to_resolved
()
.await
?
,
ignores_arg
.method_with_arg
(
1
)
.to_resolved
()
.await
?
,
);
);
Ok
(())
})
.await
}
#[tokio
::
test(flavor
=
"multi_thread"
,
worker_threads
=
2
)]
async
fn
filtered_trait_method_args
()
->
Result
<
()
>
{
run_once
(
&
REGISTRATION
,
||
async
{
let
uses_arg
=
UsesArg
(
0
)
.cell
();
assert_eq!
(
uses_arg
.trait_method_with_arg
(
0
)
.to_resolved
()
.await
?
,
uses_arg
.trait_method_with_arg
(
0
)
.to_resolved
()
.await
?
,
);
assert_ne!
(
uses_arg
.trait_method_with_arg
(
0
)
.to_resolved
()
.await
?
,
uses_arg
.trait_method_with_arg
(
1
)
.to_resolved
()
.await
?
,
);
let
ignores_arg
=
IgnoresArg
(
0
)
.cell
();
assert_eq!
(
ignores_arg
.trait_method_with_arg
(
0
)
.to_resolved
()
.await
?
,
ignores_arg
.trait_method_with_arg
(
0
)
.to_resolved
()
.await
?
,
);
assert_eq!
(
ignores_arg
.trait_method_with_arg
(
0
)
.to_resolved
()
.await
?
,
ignores_arg
.trait_method_with_arg
(
1
)
.to_resolved
()
.await
?
,
);
Ok
(())
})
.await
}
#[tokio
::
test(flavor
=
"multi_thread"
,
worker_threads
=
2
)]
async
fn
filtered_impl_method_self
()
->
Result
<
()
>
{
run_once
(
&
REGISTRATION
,
||
async
{
let
uses_arg
=
UsesArg
(
0
)
.cell
();
let
uses_arg2
=
UsesArg
(
1
)
.cell
();
assert_eq!
(
uses_arg
.method_with_arg
(
0
)
.to_resolved
()
.await
?
,
uses_arg2
.method_with_arg
(
0
)
.to_resolved
()
.await
?
,
);
assert_eq!
(
uses_arg
.method_with_arg
(
1
)
.to_resolved
()
.await
?
,
uses_arg2
.method_with_arg
(
1
)
.to_resolved
()
.await
?
,
);
let
ignores_arg
=
IgnoresArg
(
0
)
.cell
();
let
ignores_arg2
=
IgnoresArg
(
1
)
.cell
();
assert_eq!
(
ignores_arg
.method_with_arg
(
0
)
.to_resolved
()
.await
?
,
ignores_arg2
.method_with_arg
(
0
)
.to_resolved
()
.await
?
,
);
assert_eq!
(
ignores_arg
.method_with_arg
(
1
)
.to_resolved
()
.await
?
,
ignores_arg2
.method_with_arg
(
1
)
.to_resolved
()
.await
?
,
);
assert_eq!
(
ignores_arg
.method_with_arg
(
0
)
.to_resolved
()
.await
?
,
ignores_arg2
.method_with_arg
(
1
)
.to_resolved
()
.await
?
,
);
Ok
(())
})
.await
}
#[tokio
::
test(flavor
=
"multi_thread"
,
worker_threads
=
2
)]
async
fn
filtered_trait_method_self
()
->
Result
<
()
>
{
run_once
(
&
REGISTRATION
,
||
async
{
let
uses_arg
=
UsesArg
(
0
)
.cell
();
let
uses_arg2
=
UsesArg
(
1
)
.cell
();
assert_eq!
(
uses_arg
.trait_method_with_arg
(
0
)
.to_resolved
()
.await
?
,
uses_arg2
.trait_method_with_arg
(
0
)
.to_resolved
()
.await
?
,
);
assert_eq!
(
uses_arg
.trait_method_with_arg
(
1
)
.to_resolved
()
.await
?
,
uses_arg2
.trait_method_with_arg
(
1
)
.to_resolved
()
.await
?
,
);
let
ignores_arg
=
IgnoresArg
(
0
)
.cell
();
let
ignores_arg2
=
IgnoresArg
(
1
)
.cell
();
assert_eq!
(
ignores_arg
.trait_method_with_arg
(
0
)
.to_resolved
()
.await
?
,
ignores_arg2
.trait_method_with_arg
(
0
)
.to_resolved
()
.await
?
,
);
assert_eq!
(
ignores_arg
.trait_method_with_arg
(
1
)
.to_resolved
()
.await
?
,
ignores_arg2
.trait_method_with_arg
(
1
)
.to_resolved
()
.await
?
,
);
assert_eq!
(
ignores_arg
.trait_method_with_arg
(
0
)
.to_resolved
()
.await
?
,
ignores_arg2
.trait_method_with_arg
(
1
)
.to_resolved
()
.await
?
,
);
Ok
(())
})
.await
}
#[tokio
::
test(flavor
=
"multi_thread"
,
worker_threads
=
2
)]
async
fn
filtered_plain_method_args
()
->
Result
<
()
>
{
run_once
(
&
REGISTRATION
,
||
async
{
assert_eq!
(
method_with_arg
(
0
)
.to_resolved
()
.await
?
,
method_with_arg
(
0
)
.to_resolved
()
.await
?
,
);
assert_ne!
(
method_with_arg
(
0
)
.to_resolved
()
.await
?
,
method_with_arg
(
1
)
.to_resolved
()
.await
?
,
);
assert_eq!
(
method_with_ignored_arg
(
0
)
.to_resolved
()
.await
?
,
method_with_ignored_arg
(
0
)
.to_resolved
()
.await
?
,
);
assert_eq!
(
method_with_ignored_arg
(
0
)
.to_resolved
()
.await
?
,
method_with_ignored_arg
(
1
)
.to_resolved
()
.await
?
,
);
Ok
(())
Ok
(())
})
})
.await
.await
...
@@ -38,14 +160,14 @@ async fn filtered_trait_method_args() -> Result<()> {
...
@@ -38,14 +160,14 @@ async fn filtered_trait_method_args() -> Result<()> {
#[turbo_tasks
::
value_trait]
#[turbo_tasks
::
value_trait]
trait
ExampleTrait
{
trait
ExampleTrait
{
#[turbo_tasks
::
function]
#[turbo_tasks
::
function]
fn
method_with_arg
(
&
self
,
number
:
i32
)
->
Vc
<
()
>
;
fn
trait_
method_with_arg
(
&
self
,
number
:
i32
)
->
Vc
<
()
>
;
}
}
#[turbo_tasks
::
value]
#[turbo_tasks
::
value]
struct
UsesArg
;
struct
UsesArg
(
i32
)
;
#[turbo_tasks
::
value_impl]
#[turbo_tasks
::
value_impl]
impl
ExampleTrait
for
UsesArg
{
impl
UsesArg
{
#[turbo_tasks
::
function]
#[turbo_tasks
::
function]
fn
method_with_arg
(
&
self
,
number
:
i32
)
->
Vc
<
()
>
{
fn
method_with_arg
(
&
self
,
number
:
i32
)
->
Vc
<
()
>
{
let
_
=
number
;
let
_
=
number
;
...
@@ -53,13 +175,41 @@ impl ExampleTrait for UsesArg {
...
@@ -53,13 +175,41 @@ impl ExampleTrait for UsesArg {
}
}
}
}
#[turbo_tasks
::
value_impl]
impl
ExampleTrait
for
UsesArg
{
#[turbo_tasks
::
function]
fn
trait_method_with_arg
(
&
self
,
number
:
i32
)
->
Vc
<
()
>
{
let
_
=
number
;
Vc
::
cell
(())
}
}
#[turbo_tasks
::
value]
#[turbo_tasks
::
value]
struct
IgnoresArg
;
struct
IgnoresArg
(
i32
)
;
#[turbo_tasks
::
value_impl]
#[turbo_tasks
::
value_impl]
impl
ExampleTrait
for
IgnoresArg
{
impl
IgnoresArg
{
#[turbo_tasks
::
function]
#[turbo_tasks
::
function]
fn
method_with_arg
(
&
self
,
_number
:
i32
)
->
Vc
<
()
>
{
fn
method_with_arg
(
&
self
,
_number
:
i32
)
->
Vc
<
()
>
{
Vc
::
cell
(())
Vc
::
cell
(())
}
}
}
}
#[turbo_tasks
::
value_impl]
impl
ExampleTrait
for
IgnoresArg
{
#[turbo_tasks
::
function]
fn
trait_method_with_arg
(
&
self
,
_number
:
i32
)
->
Vc
<
()
>
{
Vc
::
cell
(())
}
}
#[turbo_tasks
::
function]
fn
method_with_arg
(
number
:
i32
)
->
Vc
<
()
>
{
let
_
=
number
;
Vc
::
cell
(())
}
#[turbo_tasks
::
function]
fn
method_with_ignored_arg
(
_number
:
i32
)
->
Vc
<
()
>
{
Vc
::
cell
(())
}
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