@@ -679,9 +679,53 @@ fn serialize_task_type(
679679 let deserialize: Result < CachedTaskType , _ > = serde_path_to_error:: deserialize (
680680 & mut pot_de_symbol_list ( ) . deserializer_for_slice ( & * task_type_bytes) ?,
681681 ) ;
682- if let Err ( err) = deserialize {
683- println ! ( "Task type would not be deserializable {task_id:?}: {err:?}\n {task_type:#?}" ) ;
684- panic ! ( "Task type would not be deserializable {task_id:?}: {err:?}" ) ;
682+ match deserialize {
683+ Err ( err) => {
684+ println ! (
685+ "Task type would not be deserializable {task_id:?}: {err:?}\n {task_type:#?}"
686+ ) ;
687+ panic ! ( "Task type would not be deserializable {task_id:?}: {err:?}" ) ;
688+ }
689+ Ok ( task_type2) => {
690+ if & task_type2 != task_type {
691+ println ! (
692+ "Task type would not round-trip {task_id:?}:\n original: \
693+ {task_type:#?}\n round-tripped: {task_type2:#?}"
694+ ) ;
695+ panic ! (
696+ "Task type would not round-trip {task_id:?}:\n original: \
697+ {task_type:#?}\n round-tripped: {task_type2:#?}"
698+ ) ;
699+ }
700+ let mut bytes2 = Vec :: new ( ) ;
701+ let result2 = POT_CONFIG . serialize_into ( & task_type2, & mut bytes2) ;
702+ match result2 {
703+ Err ( err) => {
704+ println ! (
705+ "Task type would not be serializable the second time {task_id:?}: \
706+ {err:?}\n {task_type2:#?}"
707+ ) ;
708+ panic ! (
709+ "Task type would not be serializable the second time {task_id:?}: \
710+ {err:?}\n {task_type2:#?}"
711+ ) ;
712+ }
713+ Ok ( ( ) ) => {
714+ if bytes2 != * task_type_bytes {
715+ println ! (
716+ "Task type would not serialize to the same bytes the second time \
717+ {task_id:?}:\n original: {:x?}\n second: {:x?}\n {task_type2:#?}",
718+ task_type_bytes, bytes2
719+ ) ;
720+ panic ! (
721+ "Task type would not serialize to the same bytes the second time \
722+ {task_id:?}:\n original: {:x?}\n second: {:x?}\n {task_type2:#?}",
723+ task_type_bytes, bytes2
724+ ) ;
725+ }
726+ }
727+ }
728+ }
685729 }
686730 }
687731 Ok ( ( ) )
@@ -757,7 +801,10 @@ fn serialize(task: TaskId, data: &Vec<CachedDataItem>) -> Result<SmallVec<[u8; 1
757801 if let Err ( err) = serde_path_to_error:: serialize ( & item, & mut serializer) {
758802 if item. is_optional ( ) {
759803 #[ cfg( feature = "verify_serialization" ) ]
760- println ! ( "Skipping non-serializable optional item for {task}: {item:?}" ) ;
804+ println ! (
805+ "Skipping non-serializable optional item for {task}: {item:?} due to \
806+ {err}"
807+ ) ;
761808 } else {
762809 error = Err ( err) . context ( {
763810 anyhow ! ( "Unable to serialize data item for {task}: {item:?}" )
0 commit comments