Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

current CI action is not enough to catch even basic compilation error #39

Open
mjzk opened this issue Sep 7, 2024 · 0 comments
Open

Comments

@mjzk
Copy link

mjzk commented Sep 7, 2024

when I build for grandine binary, I got the error:

...
error: could not parse string literal: expected `,`
  --> ssz/src/byte_vector.rs:27:18
   |
27 |     Copy(bound = "N: ArrayLength<u8, ArrayType: Copy>"),
   |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: could not parse bound
  --> ssz/src/byte_vector.rs:27:18
   |
27 |     Copy(bound = "N: ArrayLength<u8, ArrayType: Copy>"),
   |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: could not parse string literal: expected `,`
  --> ssz/src/contiguous_vector.rs:36:18
   |
36 |     Copy(bound = "T: Copy, N: ArrayLength<T, ArrayType: Copy>"),
   |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: could not parse bound
  --> ssz/src/contiguous_vector.rs:36:18
   |
36 |     Copy(bound = "T: Copy, N: ArrayLength<T, ArrayType: Copy>"),
   |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0204]: the trait `std::marker::Copy` cannot be implemented for this type
  --> ssz/src/contiguous_vector.rs:43:12
   |
43 | pub struct ContiguousVector<T, N: ArrayLength<T>> {
   |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
44 |     elements: GenericArray<T, N>,
   |     ---------------------------- this field does not implement `std::marker::Copy`
   |
note: the `std::marker::Copy` impl for `GenericArray<T, N>` requires that `<N as ArrayLength<T>>::ArrayType: std::marker::Copy`
  --> ssz/src/contiguous_vector.rs:44:15
   |
44 |     elements: GenericArray<T, N>,
   |               ^^^^^^^^^^^^^^^^^^

For more information about this error, try `rustc --explain E0204`.
error: could not compile `ssz` (lib) due to 5 previous errors

but cargo test --release --no-fail-fast is indeed successful now. So, the CI action passed.

This is a serious engineering problem, in fact. We should guarantee the compilation successful even for develop branch to allow catching the simplest mistakes.

I have checked the codes in ssz, this compilation error is just a mistake to derivative Copy for ArrayLength which is like this:

pub unsafe trait ArrayLength<T>: Unsigned {
    /// Associated type representing the array type for the number
    type ArrayType;
}

ArrayType here which is an associated type is not implemented in above code. It is trivial to fix. (I also can help a PR if needed.)

My concern is that our current CI action does not catch this simplest compilation error. I suggest we just add a binary build step in the action. I also can help a PR for this.

@mjzk mjzk mentioned this issue Sep 26, 2024
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant