From cfe7ebd463cf4e4e5ba070b1f61ba365ff70300f Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Mon, 21 May 2018 09:13:17 -0700 Subject: [PATCH] Disallow structs w/ lifetime/type parameters These can't work currently with wasm-bindgen, but maybe one day! Closes #200 --- crates/backend/src/ast.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/crates/backend/src/ast.rs b/crates/backend/src/ast.rs index d493ec5b..b047154f 100644 --- a/crates/backend/src/ast.rs +++ b/crates/backend/src/ast.rs @@ -704,6 +704,10 @@ impl ImportType { impl Struct { fn from(s: &mut syn::ItemStruct, _opts: BindgenAttrs) -> Struct { + if s.generics.params.len() > 0 { + panic!("structs with #[wasm_bindgen] cannot have lifetime or \ + type parameters currently"); + } let mut fields = Vec::new(); if let syn::Fields::Named(names) = &mut s.fields { for field in names.named.iter_mut() {