MCPcopy Create free account
hub / github.com/SoftbearStudios/bitcode / test_tuple_len_changed

Function test_tuple_len_changed

src/serde/ser.rs:628–638  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

626 #[test]
627 #[should_panic(expected = "type changed")]
628 fn test_tuple_len_changed() {
629 struct TupleN(usize);
630 impl Serialize for TupleN {
631 fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
632 let mut tuple = serializer.serialize_tuple(self.0)?;
633 (0..self.0).try_for_each(|_| tuple.serialize_element(&false))?;
634 tuple.end()
635 }
636 }
637 let _ = crate::serialize(&vec![TupleN(1), TupleN(2)]);
638 }
639
640 // Has to be a macro because it borrows something on the stack and returns it.
641 macro_rules! new_wrapper {

Callers

nothing calls this directly

Calls 1

serializeFunction · 0.85

Tested by

no test coverage detected