-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mark Vcs as must-use
#5387
Mark Vcs as must-use
#5387
Conversation
This uses the `#[must-use]` macro [0] to mark Vcs as needing to be used when created. The compiler creates warnings for each case. Test Plan: Create a Vc in code and verify a warning is shown when Turbopack is built. [0] https://doc.rust-lang.org/reference/attributes/diagnostics.html#the-must_use-attribute
The latest updates on your projects. Learn more about Vercel for Git ↗︎
10 Ignored Deployments
|
✅ This change can build |
🟢 CI successful 🟢Thanks |
Linux Benchmark for 900d4c9Click to view benchmark
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we need this on TraitVcs and possibly on TT function return values?
MacOS Benchmark for 900d4c9
Click to view full benchmark
|
my_transitive_emitting_function("", "a"); | ||
my_transitive_emitting_function("", "b"); | ||
async fn my_multi_emitting_function() -> Result<ThingVc> { | ||
my_transitive_emitting_function("", "a").await?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better use let _ =
for these two
crates/turbopack/src/lib.rs
Outdated
@@ -435,7 +435,7 @@ impl AssetContext for ModuleAssetContext { | |||
request, | |||
); | |||
|
|||
result.add_reference(types_reference.into()); | |||
result.add_reference(types_reference.into()).await?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This probably returns a new result. Maybe rename the function to with_reference
result.add_reference(types_reference.into()).await?; | |
result = result.add_reference(types_reference.into()); |
Linux Benchmark for 70a6270Click to view benchmark
|
sig.span() | ||
.unwrap() | ||
.error( | ||
"Cannot return `()` from a turbo_tasks function. Return Result<NothingVc> instead.", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Cannot return `()` from a turbo_tasks function. Return Result<NothingVc> instead.", | |
"Cannot return `()` from a turbo_tasks function. Return a NothingVc instead.", |
Linux Benchmark for 84f15d3Click to view benchmark
|
See vercel/turborepo#5420 # Turbopack changes * vercel/turborepo#5420 * vercel/turborepo#5387
This uses the `#[must-use]` macro [0] to mark Vcs as needing to be used when created. The compiler creates warnings for each case. Test Plan: Create a Vc in code and verify a warning is shown when Turbopack is built. [0] https://doc.rust-lang.org/reference/attributes/diagnostics.html#the-must_use-attribute
This uses the `#[must-use]` macro [0] to mark Vcs as needing to be used when created. The compiler creates warnings for each case. Test Plan: Create a Vc in code and verify a warning is shown when Turbopack is built. [0] https://doc.rust-lang.org/reference/attributes/diagnostics.html#the-must_use-attribute
This uses the `#[must-use]` macro [0] to mark Vcs as needing to be used when created. The compiler creates warnings for each case. Test Plan: Create a Vc in code and verify a warning is shown when Turbopack is built. [0] https://doc.rust-lang.org/reference/attributes/diagnostics.html#the-must_use-attribute
This uses the
#[must-use]
macro [0] to mark Vcs as needing to be used when created. The compiler creates warnings for each case.Test Plan: Create a Vc in code and verify a warning is shown when Turbopack is built.
[0] https://doc.rust-lang.org/reference/attributes/diagnostics.html#the-must_use-attribute