diff --git a/src/gfx_macros/shader_param.rs b/src/gfx_macros/shader_param.rs index 6ebb47c1750..788bf174d54 100644 --- a/src/gfx_macros/shader_param.rs +++ b/src/gfx_macros/shader_param.rs @@ -277,8 +277,19 @@ impl ItemDecorator for ShaderParam { let link_ty = generic::ty::Literal( generic::ty::Path::new_local(&link_name[]) ); - (*push)(context.item_struct(span, link_ident, link_def)); - // process meta parameters + let link_item = context.item_struct(span, link_ident, link_def) + .map(|mut item| { + item.attrs.push(context.attribute(span, + context.meta_list(span, token::InternedString::new("derive"), vec![ + context.meta_word(span, token::InternedString::new("Copy")), + context.meta_word(span, token::InternedString::new("Debug")), + ]) + )); + item + }); + (*push)(link_item); + + // process meta parameters (expecting none) match meta_item.node { ast::MetaWord(_) => (), //expected _ => { @@ -286,6 +297,7 @@ impl ItemDecorator for ShaderParam { "No arguments are expected for #[shader_param]") } } + // #[derive ShaderParam] let trait_def = generic::TraitDef { span: span, diff --git a/tests/shader_param.rs b/tests/shader_param.rs index 180433763e6..44a6d081de7 100644 --- a/tests/shader_param.rs +++ b/tests/shader_param.rs @@ -19,22 +19,34 @@ extern crate gfx_macros; mod secret_lib; +use secret_lib::gfx; + // Test all features #[shader_param] #[allow(dead_code)] struct TestParam { a: i32, b: [f32; 4], - c: secret_lib::gfx::shade::TextureParam, - d: secret_lib::gfx::RawBufferHandle, + c: gfx::shade::TextureParam, + d: gfx::RawBufferHandle, e: f32, #[name = "a_f"] f: [f32; 4], } +#[test] +fn test_link_copy() { + // testing if RefBatch is copyable + fn _is_copy(_t: T) {} + fn _ref_copy(batch: gfx::batch::RefBatch) { + _is_copy(batch) + } +} + #[test] fn test_shader_param() { - // testing if the types are visible - let _ref: secret_lib::gfx::batch::RefBatch; - let _owned: secret_lib::gfx::batch::OwnedBatch; + // testing if RefBatch can be constructed + let _ref: gfx::batch::RefBatch; + // testing if OwnedBatch can be constructed + let _owned: gfx::batch::OwnedBatch; }