From c1f7b42662d8c747597f3233abe65bc4827cb870 Mon Sep 17 00:00:00 2001 From: Nick Fitzgerald Date: Wed, 15 Aug 2018 11:45:45 -0700 Subject: [PATCH] web-sys: Provide more info in logs when type conversion fails --- crates/webidl/src/lib.rs | 7 ++++++- crates/webidl/src/util.rs | 12 ++++++++++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/crates/webidl/src/lib.rs b/crates/webidl/src/lib.rs index ed6ab3af..d077a1f7 100644 --- a/crates/webidl/src/lib.rs +++ b/crates/webidl/src/lib.rs @@ -812,7 +812,12 @@ impl<'src> WebidlParse<'src, &'src str> for weedle::interface::ConstMember<'src> let ty = match idl_type.to_syn_type(TypePosition::Return) { None => { - warn!("Can not convert const type to syn type: {:?}", idl_type); + warn!( + "Cannot convert const type to syn type: {:?} in {:?} on {:?}", + idl_type, + self, + self_name + ); return Ok(()); }, Some(ty) => ty, diff --git a/crates/webidl/src/util.rs b/crates/webidl/src/util.rs index 80e31c9c..011d3555 100644 --- a/crates/webidl/src/util.rs +++ b/crates/webidl/src/util.rs @@ -235,7 +235,11 @@ impl<'src> FirstPassRecord<'src> { ret @ _ => { match ret.to_syn_type(TypePosition::Return) { None => { - warn!("Can not convert return type to syn type: {:?}", ret); + warn!( + "Cannot convert return type to syn type: {:?} on {:?}", + ret, + rust_name + ); return Vec::new(); }, Some(ret) => Some(ret), @@ -315,7 +319,11 @@ impl<'src> FirstPassRecord<'src> { let syn_type = if let Some(syn_type) = idl_type.to_syn_type(TypePosition::Argument) { syn_type } else { - warn!("Can not convert argument type to syn type: {:?}", idl_type); + warn!( + "Cannot convert argument type to syn type: {:?} on {:?}", + idl_type, + rust_name + ); continue 'outer; }; let argument_name = rust_ident(&argument_name.to_snake_case());