Skip to content

Commit

Permalink
Merge rust-bitcoin#3834: Introduce an API surface test file
Browse files Browse the repository at this point in the history
a18d287 api: Run just check-api (Tobin C. Harding)
1175fac io: Introduce api test file (Tobin C. Harding)
01f3eef io: Move bridge type constructors (Tobin C. Harding)
a8fbd5e units: Remove api docs (Tobin C. Harding)
aaa20fc units: Move code comment to correct imports (Tobin C. Harding)

Pull request description:

  As we did for `units` add an integration test for the API surface of the `io` crate.

  The first two patches are cleanup to the `units` test. Patch 3 is trivial refactor.

ACKs for top commit:
  apoelstra:
    ACK a18d287; successfully ran local tests

Tree-SHA512: e5a39f97f7d6e34cb63613f337101f13fcc5d66f85277b6f0026d339b5677ff60f7e3050ae23807c3d20d0ae4e343a10983f43dab757a66fe4d33afd09a96f62
  • Loading branch information
apoelstra committed Jan 7, 2025
2 parents 70a8792 + a18d287 commit 75c8ec4
Show file tree
Hide file tree
Showing 7 changed files with 180 additions and 25 deletions.
10 changes: 10 additions & 0 deletions api/io/all-features.txt
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ impl core::convert::From<std::io::error::Error> for bitcoin_io::Error
impl core::error::Error for bitcoin_io::Error
impl core::fmt::Debug for bitcoin_io::Error
impl core::fmt::Debug for bitcoin_io::ErrorKind
impl core::fmt::Debug for bitcoin_io::Sink
impl core::fmt::Display for bitcoin_io::Error
impl core::hash::Hash for bitcoin_io::ErrorKind
impl core::marker::Copy for bitcoin_io::ErrorKind
Expand All @@ -76,6 +77,7 @@ impl core::panic::unwind_safe::RefUnwindSafe for bitcoin_io::Sink
impl core::panic::unwind_safe::UnwindSafe for bitcoin_io::ErrorKind
impl core::panic::unwind_safe::UnwindSafe for bitcoin_io::Sink
impl std::io::Write for bitcoin_io::Sink
impl<'a, R: core::fmt::Debug + bitcoin_io::Read + ?core::marker::Sized> core::fmt::Debug for bitcoin_io::Take<'a, R>
impl<'a, R> !core::panic::unwind_safe::UnwindSafe for bitcoin_io::Take<'a, R>
impl<'a, R> core::marker::Freeze for bitcoin_io::Take<'a, R> where R: ?core::marker::Sized
impl<'a, R> core::marker::Send for bitcoin_io::Take<'a, R> where R: core::marker::Send + ?core::marker::Sized
Expand Down Expand Up @@ -105,6 +107,9 @@ impl<T: core::convert::AsRef<[u8]>> bitcoin_io::BufRead for std::io::cursor::Cur
impl<T: core::convert::AsRef<[u8]>> bitcoin_io::Cursor<T>
impl<T: core::convert::AsRef<[u8]>> bitcoin_io::Read for bitcoin_io::Cursor<T>
impl<T: core::convert::AsRef<[u8]>> bitcoin_io::Read for std::io::cursor::Cursor<T>
impl<T: core::fmt::Debug> core::fmt::Debug for bitcoin_io::Cursor<T>
impl<T: core::fmt::Debug> core::fmt::Debug for bitcoin_io::FromStd<T>
impl<T: core::fmt::Debug> core::fmt::Debug for bitcoin_io::ToStd<T>
impl<T: std::io::BufRead> bitcoin_io::BufRead for bitcoin_io::FromStd<T>
impl<T: std::io::BufRead> std::io::BufRead for bitcoin_io::FromStd<T>
impl<T: std::io::Read> bitcoin_io::Read for bitcoin_io::FromStd<T>
Expand Down Expand Up @@ -214,6 +219,7 @@ pub fn bitcoin_io::BufRead::consume(&mut self, amount: usize)
pub fn bitcoin_io::BufRead::fill_buf(&mut self) -> bitcoin_io::Result<&[u8]>
pub fn bitcoin_io::Cursor<T>::consume(&mut self, amount: usize)
pub fn bitcoin_io::Cursor<T>::fill_buf(&mut self) -> bitcoin_io::Result<&[u8]>
pub fn bitcoin_io::Cursor<T>::fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result
pub fn bitcoin_io::Cursor<T>::get_mut(&mut self) -> &mut T
pub fn bitcoin_io::Cursor<T>::get_ref(&self) -> &T
pub fn bitcoin_io::Cursor<T>::inner(&self) -> &T
Expand Down Expand Up @@ -242,6 +248,7 @@ pub fn bitcoin_io::FromStd<T>::fill_buf(&mut self) -> bitcoin_io::Result<&[u8]>
pub fn bitcoin_io::FromStd<T>::fill_buf(&mut self) -> std::io::error::Result<&[u8]>
pub fn bitcoin_io::FromStd<T>::flush(&mut self) -> bitcoin_io::Result<()>
pub fn bitcoin_io::FromStd<T>::flush(&mut self) -> std::io::error::Result<()>
pub fn bitcoin_io::FromStd<T>::fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result
pub fn bitcoin_io::FromStd<T>::get_mut(&mut self) -> &mut T
pub fn bitcoin_io::FromStd<T>::get_ref(&self) -> &T
pub fn bitcoin_io::FromStd<T>::inner(&self) -> &T
Expand All @@ -263,6 +270,7 @@ pub fn bitcoin_io::Read::read_to_limit(&mut self, buf: &mut alloc::vec::Vec<u8>,
pub fn bitcoin_io::Read::take(&mut self, limit: u64) -> bitcoin_io::Take<'_, Self>
pub fn bitcoin_io::Sink::flush(&mut self) -> bitcoin_io::Result<()>
pub fn bitcoin_io::Sink::flush(&mut self) -> std::io::error::Result<()>
pub fn bitcoin_io::Sink::fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result
pub fn bitcoin_io::Sink::write(&mut self, buf: &[u8]) -> bitcoin_io::Result<usize>
pub fn bitcoin_io::Sink::write(&mut self, buf: &[u8]) -> std::io::error::Result<usize>
pub fn bitcoin_io::Sink::write_all(&mut self, _: &[u8]) -> bitcoin_io::Result<()>
Expand All @@ -271,11 +279,13 @@ pub fn bitcoin_io::Take<'_, R>::consume(&mut self, amount: usize)
pub fn bitcoin_io::Take<'_, R>::fill_buf(&mut self) -> bitcoin_io::Result<&[u8]>
pub fn bitcoin_io::Take<'_, R>::read(&mut self, buf: &mut [u8]) -> bitcoin_io::Result<usize>
pub fn bitcoin_io::Take<'_, R>::read_to_end(&mut self, buf: &mut alloc::vec::Vec<u8>) -> bitcoin_io::Result<usize>
pub fn bitcoin_io::Take<'a, R>::fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result
pub fn bitcoin_io::ToStd<T>::consume(&mut self, amount: usize)
pub fn bitcoin_io::ToStd<T>::fill_buf(&mut self) -> bitcoin_io::Result<&[u8]>
pub fn bitcoin_io::ToStd<T>::fill_buf(&mut self) -> std::io::error::Result<&[u8]>
pub fn bitcoin_io::ToStd<T>::flush(&mut self) -> bitcoin_io::Result<()>
pub fn bitcoin_io::ToStd<T>::flush(&mut self) -> std::io::error::Result<()>
pub fn bitcoin_io::ToStd<T>::fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result
pub fn bitcoin_io::ToStd<T>::inner(&self) -> &T
pub fn bitcoin_io::ToStd<T>::inner_mut(&mut self) -> &mut T
pub fn bitcoin_io::ToStd<T>::into_inner(self) -> T
Expand Down
6 changes: 6 additions & 0 deletions api/io/alloc-only.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ impl core::convert::From<bitcoin_io::ErrorKind> for bitcoin_io::Error
impl core::convert::From<core::convert::Infallible> for bitcoin_io::ErrorKind
impl core::fmt::Debug for bitcoin_io::Error
impl core::fmt::Debug for bitcoin_io::ErrorKind
impl core::fmt::Debug for bitcoin_io::Sink
impl core::fmt::Display for bitcoin_io::Error
impl core::hash::Hash for bitcoin_io::ErrorKind
impl core::marker::Copy for bitcoin_io::ErrorKind
Expand All @@ -33,6 +34,7 @@ impl core::panic::unwind_safe::RefUnwindSafe for bitcoin_io::ErrorKind
impl core::panic::unwind_safe::RefUnwindSafe for bitcoin_io::Sink
impl core::panic::unwind_safe::UnwindSafe for bitcoin_io::ErrorKind
impl core::panic::unwind_safe::UnwindSafe for bitcoin_io::Sink
impl<'a, R: core::fmt::Debug + bitcoin_io::Read + ?core::marker::Sized> core::fmt::Debug for bitcoin_io::Take<'a, R>
impl<'a, R> !core::panic::unwind_safe::UnwindSafe for bitcoin_io::Take<'a, R>
impl<'a, R> core::marker::Freeze for bitcoin_io::Take<'a, R> where R: ?core::marker::Sized
impl<'a, R> core::marker::Send for bitcoin_io::Take<'a, R> where R: core::marker::Send + ?core::marker::Sized
Expand All @@ -48,6 +50,7 @@ impl<T: bitcoin_io::Write> bitcoin_io::Write for &mut T
impl<T: core::convert::AsRef<[u8]>> bitcoin_io::BufRead for bitcoin_io::Cursor<T>
impl<T: core::convert::AsRef<[u8]>> bitcoin_io::Cursor<T>
impl<T: core::convert::AsRef<[u8]>> bitcoin_io::Read for bitcoin_io::Cursor<T>
impl<T: core::fmt::Debug> core::fmt::Debug for bitcoin_io::Cursor<T>
impl<T> core::marker::Freeze for bitcoin_io::Cursor<T> where T: core::marker::Freeze
impl<T> core::marker::Send for bitcoin_io::Cursor<T> where T: core::marker::Send
impl<T> core::marker::Sync for bitcoin_io::Cursor<T> where T: core::marker::Sync
Expand Down Expand Up @@ -91,6 +94,7 @@ pub fn bitcoin_io::BufRead::consume(&mut self, amount: usize)
pub fn bitcoin_io::BufRead::fill_buf(&mut self) -> bitcoin_io::Result<&[u8]>
pub fn bitcoin_io::Cursor<T>::consume(&mut self, amount: usize)
pub fn bitcoin_io::Cursor<T>::fill_buf(&mut self) -> bitcoin_io::Result<&[u8]>
pub fn bitcoin_io::Cursor<T>::fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result
pub fn bitcoin_io::Cursor<T>::get_mut(&mut self) -> &mut T
pub fn bitcoin_io::Cursor<T>::get_ref(&self) -> &T
pub fn bitcoin_io::Cursor<T>::inner(&self) -> &T
Expand All @@ -115,12 +119,14 @@ pub fn bitcoin_io::Read::read_exact(&mut self, buf: &mut [u8]) -> bitcoin_io::Re
pub fn bitcoin_io::Read::read_to_limit(&mut self, buf: &mut alloc::vec::Vec<u8>, limit: u64) -> bitcoin_io::Result<usize>
pub fn bitcoin_io::Read::take(&mut self, limit: u64) -> bitcoin_io::Take<'_, Self>
pub fn bitcoin_io::Sink::flush(&mut self) -> bitcoin_io::Result<()>
pub fn bitcoin_io::Sink::fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result
pub fn bitcoin_io::Sink::write(&mut self, buf: &[u8]) -> bitcoin_io::Result<usize>
pub fn bitcoin_io::Sink::write_all(&mut self, _: &[u8]) -> bitcoin_io::Result<()>
pub fn bitcoin_io::Take<'_, R>::consume(&mut self, amount: usize)
pub fn bitcoin_io::Take<'_, R>::fill_buf(&mut self) -> bitcoin_io::Result<&[u8]>
pub fn bitcoin_io::Take<'_, R>::read(&mut self, buf: &mut [u8]) -> bitcoin_io::Result<usize>
pub fn bitcoin_io::Take<'_, R>::read_to_end(&mut self, buf: &mut alloc::vec::Vec<u8>) -> bitcoin_io::Result<usize>
pub fn bitcoin_io::Take<'a, R>::fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result
pub fn bitcoin_io::Write::flush(&mut self) -> bitcoin_io::Result<()>
pub fn bitcoin_io::Write::write(&mut self, buf: &[u8]) -> bitcoin_io::Result<usize>
pub fn bitcoin_io::Write::write_all(&mut self, buf: &[u8]) -> bitcoin_io::Result<()>
Expand Down
6 changes: 6 additions & 0 deletions api/io/no-features.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ impl core::convert::From<bitcoin_io::ErrorKind> for bitcoin_io::Error
impl core::convert::From<core::convert::Infallible> for bitcoin_io::ErrorKind
impl core::fmt::Debug for bitcoin_io::Error
impl core::fmt::Debug for bitcoin_io::ErrorKind
impl core::fmt::Debug for bitcoin_io::Sink
impl core::fmt::Display for bitcoin_io::Error
impl core::hash::Hash for bitcoin_io::ErrorKind
impl core::marker::Copy for bitcoin_io::ErrorKind
Expand All @@ -32,6 +33,7 @@ impl core::panic::unwind_safe::RefUnwindSafe for bitcoin_io::ErrorKind
impl core::panic::unwind_safe::RefUnwindSafe for bitcoin_io::Sink
impl core::panic::unwind_safe::UnwindSafe for bitcoin_io::ErrorKind
impl core::panic::unwind_safe::UnwindSafe for bitcoin_io::Sink
impl<'a, R: core::fmt::Debug + bitcoin_io::Read + ?core::marker::Sized> core::fmt::Debug for bitcoin_io::Take<'a, R>
impl<'a, R> !core::panic::unwind_safe::UnwindSafe for bitcoin_io::Take<'a, R>
impl<'a, R> core::marker::Freeze for bitcoin_io::Take<'a, R> where R: ?core::marker::Sized
impl<'a, R> core::marker::Send for bitcoin_io::Take<'a, R> where R: core::marker::Send + ?core::marker::Sized
Expand All @@ -46,6 +48,7 @@ impl<T: bitcoin_io::Write> bitcoin_io::Write for &mut T
impl<T: core::convert::AsRef<[u8]>> bitcoin_io::BufRead for bitcoin_io::Cursor<T>
impl<T: core::convert::AsRef<[u8]>> bitcoin_io::Cursor<T>
impl<T: core::convert::AsRef<[u8]>> bitcoin_io::Read for bitcoin_io::Cursor<T>
impl<T: core::fmt::Debug> core::fmt::Debug for bitcoin_io::Cursor<T>
impl<T> core::marker::Freeze for bitcoin_io::Cursor<T> where T: core::marker::Freeze
impl<T> core::marker::Send for bitcoin_io::Cursor<T> where T: core::marker::Send
impl<T> core::marker::Sync for bitcoin_io::Cursor<T> where T: core::marker::Sync
Expand Down Expand Up @@ -87,6 +90,7 @@ pub fn bitcoin_io::BufRead::consume(&mut self, amount: usize)
pub fn bitcoin_io::BufRead::fill_buf(&mut self) -> bitcoin_io::Result<&[u8]>
pub fn bitcoin_io::Cursor<T>::consume(&mut self, amount: usize)
pub fn bitcoin_io::Cursor<T>::fill_buf(&mut self) -> bitcoin_io::Result<&[u8]>
pub fn bitcoin_io::Cursor<T>::fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result
pub fn bitcoin_io::Cursor<T>::get_mut(&mut self) -> &mut T
pub fn bitcoin_io::Cursor<T>::get_ref(&self) -> &T
pub fn bitcoin_io::Cursor<T>::inner(&self) -> &T
Expand All @@ -108,11 +112,13 @@ pub fn bitcoin_io::Read::read(&mut self, buf: &mut [u8]) -> bitcoin_io::Result<u
pub fn bitcoin_io::Read::read_exact(&mut self, buf: &mut [u8]) -> bitcoin_io::Result<()>
pub fn bitcoin_io::Read::take(&mut self, limit: u64) -> bitcoin_io::Take<'_, Self>
pub fn bitcoin_io::Sink::flush(&mut self) -> bitcoin_io::Result<()>
pub fn bitcoin_io::Sink::fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result
pub fn bitcoin_io::Sink::write(&mut self, buf: &[u8]) -> bitcoin_io::Result<usize>
pub fn bitcoin_io::Sink::write_all(&mut self, _: &[u8]) -> bitcoin_io::Result<()>
pub fn bitcoin_io::Take<'_, R>::consume(&mut self, amount: usize)
pub fn bitcoin_io::Take<'_, R>::fill_buf(&mut self) -> bitcoin_io::Result<&[u8]>
pub fn bitcoin_io::Take<'_, R>::read(&mut self, buf: &mut [u8]) -> bitcoin_io::Result<usize>
pub fn bitcoin_io::Take<'a, R>::fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result
pub fn bitcoin_io::Write::flush(&mut self) -> bitcoin_io::Result<()>
pub fn bitcoin_io::Write::write(&mut self, buf: &[u8]) -> bitcoin_io::Result<usize>
pub fn bitcoin_io::Write::write_all(&mut self, buf: &[u8]) -> bitcoin_io::Result<()>
Expand Down
26 changes: 14 additions & 12 deletions io/src/bridge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use internals::rust_version;

/// A bridging wrapper providing the IO traits for types that already implement `std` IO traits.
#[repr(transparent)]
#[derive(Debug)]
pub struct FromStd<T>(T);

impl<T> FromStd<T> {
Expand Down Expand Up @@ -116,25 +117,14 @@ impl<T: std::io::Write> std::io::Write for FromStd<T> {

/// A bridging wrapper providing the std traits for types that already implement our traits.
#[repr(transparent)]
#[derive(Debug)]
pub struct ToStd<T>(T);

impl<T> ToStd<T> {
/// Wraps an IO type.
#[inline]
pub const fn new(inner: T) -> Self { Self(inner) }

/// Returns the wrapped value.
#[inline]
pub fn into_inner(self) -> T { self.0 }

/// Returns a reference to the wrapped value.
#[inline]
pub fn inner(&self) -> &T { &self.0 }

/// Returns a mutable reference to the wrapped value.
#[inline]
pub fn inner_mut(&mut self) -> &mut T { &mut self.0 }

/// Wraps a mutable reference to IO type.
#[inline]
pub fn new_mut(inner: &mut T) -> &mut Self {
Expand All @@ -149,6 +139,18 @@ impl<T> ToStd<T> {
// SAFETY: the type is repr(transparent) and the pointer is created from Box
unsafe { Box::from_raw(Box::into_raw(inner) as *mut Self) }
}

/// Returns the wrapped value.
#[inline]
pub fn into_inner(self) -> T { self.0 }

/// Returns a reference to the wrapped value.
#[inline]
pub fn inner(&self) -> &T { &self.0 }

/// Returns a mutable reference to the wrapped value.
#[inline]
pub fn inner_mut(&mut self) -> &mut T { &mut self.0 }
}

impl<T: super::Read> std::io::Read for ToStd<T> {
Expand Down
3 changes: 3 additions & 0 deletions io/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ pub trait BufRead: Read {
/// Reader adapter which limits the bytes read from an underlying reader.
///
/// Created by calling `[Read::take]`.
#[derive(Debug)]
pub struct Take<'a, R: Read + ?Sized> {
reader: &'a mut R,
remaining: u64,
Expand Down Expand Up @@ -191,6 +192,7 @@ impl BufRead for &[u8] {
}

/// Wraps an in memory reader providing the `position` function.
#[derive(Debug)]
pub struct Cursor<T> {
inner: T,
pos: u64,
Expand Down Expand Up @@ -329,6 +331,7 @@ impl Write for &mut [u8] {
/// A sink to which all writes succeed. See [`std::io::Sink`] for more info.
///
/// Created using `io::sink()`.
#[derive(Debug)]
pub struct Sink;

impl Write for Sink {
Expand Down
140 changes: 140 additions & 0 deletions io/tests/api.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
//! Test the API surface of `io`.
//!
//! The point of these tests are to check the API surface as opposed to test the API functionality.
//!
//! ref: <https://rust-lang.github.io/api-guidelines/about.html>
#![allow(dead_code)]
#![allow(unused_imports)]

use core::cell::Cell;
use core::convert::Infallible;

// These imports test "typical" usage by user code.
use bitcoin_io::{self as io, BufRead, Cursor, ErrorKind, Read, Sink, Take, Write};
#[cfg(feature = "std")]
use bitcoin_io::{FromStd, ToStd};

/// An arbitrary error kind.
const ERROR_KIND: ErrorKind = ErrorKind::TimedOut;

/// A struct that includes all public non-error enums.
#[derive(Debug)] // All public types implement Debug (C-DEBUG).
struct Enums {
a: ErrorKind,
}

impl Enums {
/// Creates an arbitrary `Enums` instance.
fn new() -> Self { Self { a: ERROR_KIND } }
}

/// A struct that includes all public non-error structs except `Take`.
#[derive(Debug)] // All public types implement Debug (C-DEBUG).
struct Structs {
#[cfg(feature = "std")]
a: FromStd<u32>,
#[cfg(feature = "std")]
b: ToStd<Dummy>,
c: Cursor<Dummy>,
d: Sink,
}

impl Structs {
fn new() -> Self {
Self {
#[cfg(feature = "std")]
a: FromStd::new(0),
#[cfg(feature = "std")]
b: ToStd::new(DUMMY),
c: Cursor::new(DUMMY),
d: Sink,
}
}
}

#[derive(Debug)] // `Take` implements Debug (C-DEBUG).
struct Taker<'a> {
a: Take<'a, Dummy>,
}

/// An arbitrary `Dummy` instance.
static DUMMY: Dummy = Dummy(0);

/// Dummy struct to implement all the traits we provide.
#[derive(Debug, Copy, Clone)]
struct Dummy(u64);

impl Read for Dummy {
fn read(&mut self, buf: &mut [u8]) -> Result<usize, io::Error> {
if buf.is_empty() {
Ok(0)
} else {
buf[0] = (self.0 & 0xFF) as u8;
Ok(1)
}
}
}

impl BufRead for Dummy {
fn fill_buf(&mut self) -> Result<&[u8], io::Error> { Ok(&[]) }
fn consume(&mut self, _: usize) {}
}

impl Write for Dummy {
fn write(&mut self, buf: &[u8]) -> Result<usize, io::Error> { Ok(buf.len()) }
fn write_all(&mut self, _: &[u8]) -> Result<(), io::Error> { Ok(()) }
fn flush(&mut self) -> Result<(), io::Error> { Ok(()) }
}

impl AsRef<[u8]> for Dummy {
fn as_ref(&self) -> &[u8] { &[] }
}

/// A struct that includes all public non-error types.
#[derive(Debug)] // All public types implement Debug (C-DEBUG).
struct Types {
a: Enums,
b: Structs,
}

impl Types {
fn new() -> Self { Self { a: Enums::new(), b: Structs::new() } }
}

/// A struct that includes all public error types.
#[derive(Debug)] // `io::Error` only implements `Debug`.
struct Errors {
a: io::Error,
}

// `Debug` representation is never empty (C-DEBUG-NONEMPTY).
#[test]
fn api_all_non_error_types_have_non_empty_debug() {
let t = Types::new();

let debug = format!("{:?}", t.a.a);
assert!(!debug.is_empty());

#[cfg(feature = "std")]
{
let debug = format!("{:?}", t.b.a);
assert!(!debug.is_empty());
let debug = format!("{:?}", t.b.b);
assert!(!debug.is_empty());
}
let debug = format!("{:?}", t.b.c);
assert!(!debug.is_empty());
let debug = format!("{:?}", t.b.d);
assert!(!debug.is_empty());
}

// Types are `Send` and `Sync` where possible (C-SEND-SYNC).
#[test]
fn all_non_error_tyes_implement_send_sync() {
fn assert_send<T: Send>() {}
assert_send::<Types>();

fn assert_sync<T: Sync>() {}
assert_sync::<Types>();
}
Loading

0 comments on commit 75c8ec4

Please sign in to comment.