Skip to content
Myr

Reduce scope of quote_spanned on SerializeWith wrapper

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by David Tolnay · committed by David Tolnay · parent 00460b8 · Browse files · 2 files+7 added−10 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+7 added−10 removed

  • other:+7 added−10 removed

2 files+7 added−10 removed

modified:serde_derive/src/dummy.rs+1 added-6 removed
12 unmodified lines
13 };1415 quote! {16 #[doc(hidden)]17 #[allow(18 clippy::needless_lifetimes,19 non_upper_case_globals,20 unused_attributes,21 unused_qualifications,22 )]17 #[allow(non_upper_case_globals, unused_attributes, unused_qualifications)]18 const _: () = {19 #use_serde20 #code21 };
2 unmodified lines
modified:serde_derive/src/ser.rs+6 added-4 removed
1222 unmodified lines
1223 // If #serialize_with returns wrong type, error will be reported on here.1224 // We attach span of the path to this piece so error will be reported1225 // on the #[serde(with = "...")]1226 // ^^^^^1227 quote_spanned!(serialize_with.span()=> {1227 let wrapper_serialize = quote_spanned! {serialize_with.span()=>1228 #serialize_with(#(self.values.#field_access, )* __s)1229 };12301231 quote!({1232 #[doc(hidden)]1233 struct __SerializeWith #wrapper_impl_generics #where_clause {1230 // If #field_tys is empty, this field is unused1231 #[allow(dead_code)]1234 values: (#(&'__a #field_tys, )*),1235 phantom: _serde::__private::PhantomData<#this_type #ty_generics>,1236 }1237
1 unmodified line
1239 fn serialize<__S>(&self, __s: __S) -> _serde::__private::Result<__S::Ok, __S::Error>1240 where1241 __S: _serde::Serializer,1242 {1241 #serialize_with(#(self.values.#field_access, )* __s)1243 #wrapper_serialize1244 }1245 }12461247 &__SerializeWith {
111 unmodified lines