co3 0.3.1

Build C API from Rust
Documentation
error: `is_valid` is only supported on structs or enum variants
  --> tests/ui_fail/custom_validation.rs:23:5
   |
23 |     #[reprC(is_valid = |a| *a != 0)]
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: `NICHE_VALUE` is only supported on structs
  --> tests/ui_fail/custom_validation.rs:29:10
   |
29 | pub enum CustomEnum1 {
   |          ^^^^^^^^^^^

error: `is_valid` is only supported on structs or enum variants
  --> tests/ui_fail/custom_validation.rs:36:10
   |
36 | pub enum CustomEnum2 {
   |          ^^^^^^^^^^^

error: Unions are not supported
  --> tests/ui_fail/custom_validation.rs:42:1
   |
42 | / #[reprC(is_valid = |a| *a != 0)]
43 | | pub union CustomUnion1 {
44 | |     a: u32,
45 | | }
   | |_^

error: Unions are not supported
  --> tests/ui_fail/custom_validation.rs:48:1
   |
48 | / #[reprC(is_valid = |a| *a != 0)]
49 | | pub union CustomUnion2 {
50 | |     a: u32,
51 | | }
   | |_^

error[E0277]: the trait bound `T: co3::ExternC` is not satisfied
  --> tests/ui_fail/custom_validation.rs:53:10
   |
53 | #[derive(ReprC)]
   |          ^^^^^ the trait `co3::ExternC` is not implemented for `T`
   |
note: required for `ParametrizedView<'_dšč, T>` to implement `co3::ExternC`
  --> tests/ui_fail/custom_validation.rs:53:10
   |
53 | #[derive(ReprC)]
   |          ^^^^^ type parameter would need to implement `co3::ExternC`
   = help: consider manually implementing `co3::ExternC` to avoid undesired bounds
   = note: this error originates in the derive macro `co3::ReprC` which comes from the expansion of the derive macro `ReprC` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider further restricting type parameter `T` with trait `ExternC`
   |
55 | pub struct Parametrized<T: ?Sized + co3::ExternC>(T);
   |                                   ++++++++++++++

error[E0277]: the trait bound `T: co3::ExternC` is not satisfied
  --> tests/ui_fail/custom_validation.rs:53:10
   |
53 | #[derive(ReprC)]
   |          ^^^^^ the trait `co3::ExternC` is not implemented for `T`
   |
note: required for `ParametrizedView<'_dšč, T>` to implement `co3::ExternC`
  --> tests/ui_fail/custom_validation.rs:53:10
   |
53 | #[derive(ReprC)]
   |          ^^^^^ type parameter would need to implement `co3::ExternC`
   = help: consider manually implementing `co3::ExternC` to avoid undesired bounds
note: the requirement `ParametrizedView<'_dšč, T>: co3::ExternC` appears on the `impl`'s associated constant `NICHE_VALUE` but not on the corresponding trait's associated constant
  --> src/niche.rs
   |
   |     pub trait Niche: ExternC<CType: Copy> + Sized {
   |               ----- in this trait
   |         const NICHE_VALUE: Self::CType;
   |               ^^^^^^^^^^^ this trait's associated constant doesn't have the requirement `ParametrizedView<'_dšč, T>: co3::ExternC`
   = note: this error originates in the derive macro `co3::ReprC` which comes from the expansion of the derive macro `ReprC` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider further restricting type parameter `T` with trait `ExternC`
   |
55 | pub struct Parametrized<T: ?Sized + co3::ExternC>(T);
   |                                   ++++++++++++++

error[E0277]: the trait bound `T: co3::ExternC` is not satisfied
  --> tests/ui_fail/custom_validation.rs:57:10
   |
57 | #[derive(ReprC)]
   |          ^^^^^ the trait `co3::ExternC` is not implemented for `T`
   |
   = note: required for `[T]` to implement `co3::ExternC`
   = note: 1 redundant requirement hidden
   = note: required for `UnsizedSliceView<'_dšč, T>` to implement `co3::ExternC`
   = note: this error originates in the derive macro `co3::ReprC` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0277]: the trait bound `T: co3::ExternC` is not satisfied
  --> tests/ui_fail/custom_validation.rs:57:10
   |
57 | #[derive(ReprC)]
   |          ^^^^^ the trait `co3::ExternC` is not implemented for `T`
   |
   = note: required for `[T]` to implement `co3::ExternC`
   = note: 1 redundant requirement hidden
   = note: required for `UnsizedSliceView<'_dšč, T>` to implement `co3::ExternC`
note: the requirement `UnsizedSliceView<'_dšč, T>: co3::ExternC` appears on the `impl`'s associated constant `NICHE_VALUE` but not on the corresponding trait's associated constant
  --> src/niche.rs
   |
   |     pub trait Niche: ExternC<CType: Copy> + Sized {
   |               ----- in this trait
   |         const NICHE_VALUE: Self::CType;
   |               ^^^^^^^^^^^ this trait's associated constant doesn't have the requirement `UnsizedSliceView<'_dšč, T>: co3::ExternC`
   = note: this error originates in the derive macro `co3::ReprC` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0277]: the trait bound `[T]: Copy` is not satisfied
  --> tests/ui_fail/custom_validation.rs:57:10
   |
57 | #[derive(ReprC)]
   |          ^^^^^ the trait `Copy` is not implemented for `[T]`
   |
help: the trait `Copy` is implemented for `[T; N]`
  --> $RUST/core/src/array/mod.rs
   |
   | impl<T: Copy, const N: usize> Copy for [T; N] {}
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: required for `CUnsizedSliceConstView<T>` to implement `Copy`
  --> tests/ui_fail/custom_validation.rs:57:10
   |
57 | #[derive(ReprC)]
   |          ^^^^^ type parameter would need to implement `Copy`
note: required by a bound in `Niche`
  --> src/niche.rs
   |
   |     pub trait Niche: ExternC<CType: Copy> + Sized {
   |                                     ^^^^ required by this bound in `Niche`
   = note: this error originates in the derive macro `co3::ReprC` which comes from the expansion of the derive macro `ReprC` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0277]: the trait bound `[_]: Copy` is not satisfied
  --> tests/ui_fail/custom_validation.rs:57:10
   |
57 | #[derive(ReprC)]
   |          ^^^^^ the trait `Copy` is not implemented for `[_]`
   |
help: the trait `Copy` is implemented for `[T; N]`
  --> $RUST/core/src/array/mod.rs
   |
   | impl<T: Copy, const N: usize> Copy for [T; N] {}
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: required for `CUnsizedSliceConstView<T>` to implement `Copy`
  --> tests/ui_fail/custom_validation.rs:57:10
   |
57 | #[derive(ReprC)]
   |          ^^^^^ type parameter would need to implement `Copy`
note: required by a bound in `borrow_cast`
  --> src/borrow.rs
   |
   | pub const fn borrow_cast<C: BorrowCast<AsConst: Copy> + Copy>(source: C) -> C::AsConst {
   |                                                 ^^^^ required by this bound in `borrow_cast`
   = note: this error originates in the derive macro `co3::ReprC` which comes from the expansion of the derive macro `ReprC` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0277]: the trait bound `UnsizedSlice<u8>: Niche` is not satisfied
  --> tests/ui_fail/custom_validation.rs:63:21
   |
63 |     require_niche::<UnsizedSlice<u8>>();
   |                     ^^^^^^^^^^^^^^^^ unsatisfied trait bound
   |
help: the trait `RustSpec` is not implemented for `UnsizedSlice<u8>`
  --> tests/ui_fail/custom_validation.rs:59:1
   |
59 | pub struct UnsizedSlice<T>([T]);
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^
   = help: the following other types implement trait `RustSpec`:
             &'_lšč0 _TŠČ0
             &'_lšč0 mut _TŠČ0
             ()
             (A, B)
             (A, B, C)
             (A, B, C, D)
             (A, B, C, D, E)
             (A, B, C, D, E, F)
           and $N others
note: required for `UnsizedSlice<u8>` to implement `Niche`
  --> tests/ui_fail/custom_validation.rs:59:12
   |
57 | #[derive(ReprC)]
   |          ----- type parameter would need to implement `Niche`
58 | #[reprC(NICHE_VALUE = unsafe { core::mem::zeroed() })]
59 | pub struct UnsizedSlice<T>([T]);
   |            ^^^^^^^^^^^^^^^
   = help: consider manually implementing `Niche` to avoid undesired bounds
note: required by a bound in `require_niche`
  --> tests/ui_fail/custom_validation.rs:62:25
   |
62 |     fn require_niche<T: co3::niche::Niche>() {}
   |                         ^^^^^^^^^^^^^^^^^ required by this bound in `require_niche`

error[E0277]: the trait bound `[u8]: Copy` is not satisfied
  --> tests/ui_fail/custom_validation.rs:63:21
   |
63 |     require_niche::<UnsizedSlice<u8>>();
   |                     ^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `[u8]`
   |
help: the trait `Copy` is implemented for `[T; N]`
  --> $RUST/core/src/array/mod.rs
   |
   | impl<T: Copy, const N: usize> Copy for [T; N] {}
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: required for `UnsizedSlice<u8>` to implement `Niche`
  --> tests/ui_fail/custom_validation.rs:59:12
   |
57 | #[derive(ReprC)]
   |          ----- type parameter would need to implement `Niche`
58 | #[reprC(NICHE_VALUE = unsafe { core::mem::zeroed() })]
59 | pub struct UnsizedSlice<T>([T]);
   |            ^^^^^^^^^^^^^^^
   = help: consider manually implementing `Niche` to avoid undesired bounds
note: required by a bound in `require_niche`
  --> tests/ui_fail/custom_validation.rs:62:25
   |
62 |     fn require_niche<T: co3::niche::Niche>() {}
   |                         ^^^^^^^^^^^^^^^^^ required by this bound in `require_niche`