about summary refs log tree commit diff
path: root/tvix/nix-compat-derive/src/de.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tvix/nix-compat-derive/src/de.rs')
-rw-r--r--tvix/nix-compat-derive/src/de.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/tvix/nix-compat-derive/src/de.rs b/tvix/nix-compat-derive/src/de.rs
index 2214254e2b32..e678b50b0533 100644
--- a/tvix/nix-compat-derive/src/de.rs
+++ b/tvix/nix-compat-derive/src/de.rs
@@ -34,6 +34,11 @@ pub fn expand_nix_deserialize_remote(
 ) -> syn::Result<TokenStream> {
     let cx = Context::new();
     let remote = Remote::from_ast(&cx, crate_path, input);
+    if let Some(attrs) = remote.as_ref().map(|r| &r.attrs) {
+        if attrs.from_str.is_none() && attrs.type_from.is_none() && attrs.type_try_from.is_none() {
+            cx.error_spanned(input, "Missing from_str, from or try_from attribute");
+        }
+    }
     cx.check()?;
     let remote = remote.unwrap();