diff --git a/dxr/tests/derive.rs b/dxr/tests/derive.rs index f2f3e8f..1cbf08b 100644 --- a/dxr/tests/derive.rs +++ b/dxr/tests/derive.rs @@ -5,6 +5,7 @@ fn try_build_pass() { t.pass("tests/trybuild/moo.rs"); t.pass("tests/trybuild/appendix.rs"); t.pass("tests/trybuild/recursive.rs"); + t.pass("tests/trybuild/custom_result_type.rs"); t.pass("tests/trybuild/ownership.rs"); t.pass("tests/trybuild/collections.rs"); } diff --git a/dxr/tests/trybuild/custom_result_type.rs b/dxr/tests/trybuild/custom_result_type.rs new file mode 100644 index 0000000..67f2b23 --- /dev/null +++ b/dxr/tests/trybuild/custom_result_type.rs @@ -0,0 +1,10 @@ +use dxr::{TryFromValue, TryToValue}; + +type Result = std::result::Result; + +#[derive(TryFromValue, TryToValue)] +pub struct Array { + array: [i32; 4], +} + +fn main() {} diff --git a/dxr_derive/src/lib.rs b/dxr_derive/src/lib.rs index 00e80de..1e38f2c 100644 --- a/dxr_derive/src/lib.rs +++ b/dxr_derive/src/lib.rs @@ -145,7 +145,7 @@ pub fn try_from_value(input: TokenStream) -> TokenStream { let impl_block = quote! { impl #impl_generics #dxr::TryFromValue for #name #ty_generics #where_clause { - fn try_from_value(value: &#dxr::Value) -> Result<#name #ty_generics, #dxr::DxrError> { + fn try_from_value(value: &#dxr::Value) -> std::result::Result<#name #ty_generics, #dxr::DxrError> { use ::std::collections::HashMap; use ::std::string::String; use #dxr::{Value, DxrError}; @@ -258,7 +258,7 @@ pub fn try_to_value(input: TokenStream) -> TokenStream { let impl_block = quote! { impl #impl_generics #dxr::TryToValue for #name #ty_generics #where_clause { - fn try_to_value(&self) -> Result<#dxr::Value, #dxr::DxrError> { + fn try_to_value(&self) -> std::result::Result<#dxr::Value, #dxr::DxrError> { use ::std::collections::HashMap; use ::std::string::String; use #dxr::Value;