Skip to content

Commit

Permalink
Generate an error if #[turbo_tasks::value(transparent)] would be a …
Browse files Browse the repository at this point in the history
…no-op

vercel/next.js#65336 fixes the issues surfaced
in next.js.
  • Loading branch information
bgw committed May 3, 2024
1 parent 776c923 commit 124c6fd
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 11 deletions.
9 changes: 9 additions & 0 deletions crates/turbo-tasks-macros/src/value_macro.rs
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,15 @@ pub fn value(args: TokenStream, input: TokenStream) -> TokenStream {
});
}
}
if inner_type.is_none() {
item.span()
.unwrap()
.error(
"#[turbo_tasks::value(transparent)] is only value with single-item unit \
structs",
)
.emit();
}
}

let ident = match &item {
Expand Down
2 changes: 1 addition & 1 deletion crates/turbopack-css/src/module_asset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ impl Asset for ModuleCssAsset {
/// A CSS class that is exported from a CSS module.
///
/// See [`ModuleCssClasses`] for more information.
#[turbo_tasks::value(transparent)]
#[turbo_tasks::value]
#[derive(Debug, Clone)]
enum ModuleCssClass {
Local {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,7 @@ use turbopack_ecmascript::{CustomTransformer, TransformContext};
/// Internally this contains a `CompiledPluginModuleBytes`, which points to the
/// compiled, serialized wasmer::Module instead of raw file bytes to reduce the
/// cost of the compilation.
#[turbo_tasks::value(
transparent,
serialization = "none",
eq = "manual",
into = "new",
cell = "new"
)]
#[turbo_tasks::value(serialization = "none", eq = "manual", into = "new", cell = "new")]
pub struct SwcPluginModule(
#[turbo_tasks(trace_ignore)]
#[cfg(feature = "swc_ecma_transform_plugin")]
Expand Down
2 changes: 1 addition & 1 deletion crates/turbopack-node/src/route_matcher.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use indexmap::IndexMap;
use turbo_tasks::Vc;

#[turbo_tasks::value(transparent)]
#[turbo_tasks::value]
#[derive(Debug, Clone)]
#[serde(untagged)]
pub enum Param {
Expand Down
2 changes: 1 addition & 1 deletion crates/turbopack-node/src/transforms/postcss.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ use crate::{

#[derive(Debug, Serialize, Deserialize, Clone)]
#[serde(rename_all = "camelCase")]
#[turbo_tasks::value(transparent, serialization = "custom")]
#[turbo_tasks::value(serialization = "custom")]
struct PostCssProcessingResult {
css: String,
map: Option<String>,
Expand Down
2 changes: 1 addition & 1 deletion crates/turbopack-node/src/transforms/webpack.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ use crate::{

#[derive(Debug, Serialize, Deserialize, Clone)]
#[serde(rename_all = "camelCase")]
#[turbo_tasks::value(transparent, serialization = "custom")]
#[turbo_tasks::value(serialization = "custom")]
struct WebpackLoadersProcessingResult {
source: String,
map: Option<String>,
Expand Down

0 comments on commit 124c6fd

Please sign in to comment.