Skip to content

Commit

Permalink
add panic message when trying to derive TypeUuid on a generic
Browse files Browse the repository at this point in the history
  • Loading branch information
NathanSWard committed May 17, 2021
1 parent c6d1da5 commit 6988479
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions crates/bevy_reflect/bevy_reflect_derive/src/type_uuid.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
extern crate proc_macro;

use quote::quote;
use quote::{quote, ToTokens};
use syn::{parse::*, *};
use uuid::Uuid;

Expand All @@ -15,7 +15,11 @@ pub fn type_uuid_derive(input: proc_macro::TokenStream) -> proc_macro::TokenStre

// Build the trait implementation
let name = &ast.ident;
let (_impl_generics, _type_generics, _where_clause) = &ast.generics.split_for_impl();
let (impl_generics, type_generics, _) = &ast.generics.split_for_impl();

if !impl_generics.to_token_stream().is_empty() || !type_generics.to_token_stream().is_empty() {
panic!("#[derive(TypeUuid)] is not supported for generics.");
}

// TODO: panic if there are generics.

Expand Down

0 comments on commit 6988479

Please sign in to comment.