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

Update compilation tests #2

Merged
merged 3 commits into from
Jan 1, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 4 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,15 @@ env:

jobs:
test:
name: Test Rust ${{matrix.toolchain}} on ${{matrix.os}}
name: Test Rust on ${{matrix.os}}
runs-on: ${{matrix.os}}-latest
strategy:
fail-fast: false
matrix:
toolchain: [stable, nightly]
os: [ubuntu]
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
toolchain: ${{matrix.toolchain}}
- uses: dtolnay/rust-toolchain@stable
- uses: taiki-e/install-action@nextest
# make sure benches don't bit-rot
- name: build benches
Expand All @@ -58,10 +55,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install minimal nightly with clippy and rustfmt
uses: actions-rs/toolchain@v1
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
components: clippy
- name: Clippy
uses: actions-rs/cargo@v1
Expand All @@ -74,10 +69,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install minimal nightly with clipy
uses: actions-rs/toolchain@v1
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
components: rustfmt
- name: rustfmt
uses: actions-rs/cargo@v1
Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[toolchain]
channel = "stable"
channel = "1.83"
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ impl<A: SpongeAPI, I: List> Drop for ExtraSponge<A, I> {
}

#[cfg(test)]
/// Unit tests for the Sponge API.
pub mod unit_tests;

#[cfg(test)]
Expand Down
31 changes: 25 additions & 6 deletions src/unit_tests/compilation/consume.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,32 @@ error[E0277]: the trait bound `UTerm: PrivateSub<UInt<UTerm, B1>>` is not satisf
--> src/unit_tests/compilation/consume.rs:9:9
|
9 | Use<iopat![Absorb<U3>, Squeeze<U1>, Absorb<U1>], Absorb<U6>>,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `PrivateSub<UInt<UTerm, B1>>` is not implemented for `UTerm`
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `PrivateSub<UInt<UTerm, B1>>` is not implemented for `UTerm`, which is required by `Cons<extra_safe::traits::Absorb<UInt<UInt<UTerm, B1>, B1>>, Cons<extra_safe::traits::Squeeze<UInt<UTerm, B1>>, Cons<extra_safe::traits::Absorb<UInt<UTerm, B1>>, Nil>>>: Consume<extra_safe::traits::Absorb<UInt<UInt<UInt<UTerm, B1>, B1>, B0>>>`
|
= help: the following other types implement trait `PrivateSub<Rhs>`:
<UInt<Ul, B0> as PrivateSub<UInt<Ur, B0>>>
<UInt<Ul, B0> as PrivateSub<UInt<Ur, B1>>>
<UInt<Ul, B1> as PrivateSub<UInt<Ur, B0>>>
<UInt<Ul, B1> as PrivateSub<UInt<Ur, B1>>>
`UInt<Ul, B0>` implements `PrivateSub<UInt<Ur, B0>>`
`UInt<Ul, B0>` implements `PrivateSub<UInt<Ur, B1>>`
`UInt<Ul, B1>` implements `PrivateSub<UInt<Ur, B0>>`
`UInt<Ul, B1>` implements `PrivateSub<UInt<Ur, B1>>`
= note: required for `UInt<UTerm, B1>` to implement `PrivateSub<UInt<UInt<UTerm, B1>, B1>>`
= note: required for `UInt<UInt<UTerm, B1>, B1>` to implement `Sub<UInt<UInt<UInt<UTerm, B1>, B1>, B0>>`
= note: required for `Cons<Absorb<UInt<UInt<UTerm, B1>, B1>>, Cons<Squeeze<UInt<UTerm, B1>>, Cons<Absorb<UInt<UTerm, B1>>, Nil>>>` to implement `Consume<extra_safe::traits::Absorb<UInt<UInt<UInt<UTerm, B1>, B1>, B0>>>`
= note: required for `Cons<extra_safe::traits::Absorb<UInt<UInt<UTerm, B1>, B1>>, Cons<extra_safe::traits::Squeeze<UInt<UTerm, B1>>, Cons<extra_safe::traits::Absorb<UInt<UTerm, B1>>, Nil>>>` to implement `Consume<extra_safe::traits::Absorb<UInt<UInt<UInt<UTerm, B1>, B1>, B0>>>`

error[E0277]: the trait bound `UTerm: PrivateSub<UInt<UTerm, B1>>` is not satisfied
--> src/unit_tests/compilation/consume.rs:8:5
|
8 | / assert_type_eq!(
9 | | Use<iopat![Absorb<U3>, Squeeze<U1>, Absorb<U1>], Absorb<U6>>,
10 | | iopat![Squeeze<U1>, Absorb<U1>]
11 | | );
| |_____^ the trait `PrivateSub<UInt<UTerm, B1>>` is not implemented for `UTerm`, which is required by `Cons<extra_safe::traits::Absorb<UInt<UInt<UTerm, B1>, B1>>, Cons<extra_safe::traits::Squeeze<UInt<UTerm, B1>>, Cons<extra_safe::traits::Absorb<UInt<UTerm, B1>>, Nil>>>: Consume<extra_safe::traits::Absorb<UInt<UInt<UInt<UTerm, B1>, B1>, B0>>>`
|
= help: the following other types implement trait `PrivateSub<Rhs>`:
`UInt<Ul, B0>` implements `PrivateSub<UInt<Ur, B0>>`
`UInt<Ul, B0>` implements `PrivateSub<UInt<Ur, B1>>`
`UInt<Ul, B1>` implements `PrivateSub<UInt<Ur, B0>>`
`UInt<Ul, B1>` implements `PrivateSub<UInt<Ur, B1>>`
= note: required for `UInt<UTerm, B1>` to implement `PrivateSub<UInt<UInt<UTerm, B1>, B1>>`
= note: required for `UInt<UInt<UTerm, B1>, B1>` to implement `Sub<UInt<UInt<UInt<UTerm, B1>, B1>, B0>>`
= note: required for `Cons<extra_safe::traits::Absorb<UInt<UInt<UTerm, B1>, B1>>, Cons<extra_safe::traits::Squeeze<UInt<UTerm, B1>>, Cons<extra_safe::traits::Absorb<UInt<UTerm, B1>>, Nil>>>` to implement `Consume<extra_safe::traits::Absorb<UInt<UInt<UInt<UTerm, B1>, B1>, B0>>>`
= note: this error originates in the macro `assert_type_eq` (in Nightly builds, run with -Z macro-backtrace for more info)
35 changes: 28 additions & 7 deletions src/unit_tests/compilation/consume_head.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,34 @@ error[E0277]: cannot subtract `B1` from `UInt<UTerm, B0>`
9 | Use<iopat![Absorb<U5>, Squeeze<U0>, Absorb<U1>], Absorb<U6>>,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no implementation for `UInt<UTerm, B0> - B1`
|
= help: the trait `Sub<B1>` is not implemented for `UInt<UTerm, B0>`
= help: the trait `Sub<B1>` is not implemented for `UInt<UTerm, B0>`, which is required by `Cons<extra_safe::traits::Absorb<UInt<UInt<UInt<UTerm, B1>, B0>, B1>>, Cons<extra_safe::traits::Squeeze<UTerm>, Cons<extra_safe::traits::Absorb<UInt<UTerm, B1>>, Nil>>>: Consume<extra_safe::traits::Absorb<UInt<UInt<UInt<UTerm, B1>, B1>, B0>>>`
= help: the following other types implement trait `Sub<Rhs>`:
<UInt<U, B0> as Sub<B1>>
<UInt<U, B> as Sub<B0>>
<UInt<UInt<U, B>, B1> as Sub<B1>>
<UInt<UTerm, B1> as Sub<B1>>
<UInt<Ul, Bl> as Sub<Ur>>
`UInt<U, B0>` implements `Sub<B1>`
`UInt<U, B>` implements `Sub<B0>`
`UInt<UInt<U, B>, B1>` implements `Sub<B1>`
`UInt<UTerm, B1>` implements `Sub<B1>`
`UInt<Ul, Bl>` implements `Sub<Ur>`
= note: required for `UInt<UInt<UTerm, B1>, B0>` to implement `PrivateSub<UInt<UInt<UTerm, B1>, B1>>`
= note: required for `UInt<UInt<UInt<UTerm, B1>, B0>, B1>` to implement `Sub<UInt<UInt<UInt<UTerm, B1>, B1>, B0>>`
= note: required for `Cons<Absorb<UInt<UInt<UInt<UTerm, B1>, B0>, B1>>, Cons<Squeeze<UTerm>, Cons<Absorb<UInt<UTerm, B1>>, Nil>>>` to implement `Consume<extra_safe::traits::Absorb<UInt<UInt<UInt<UTerm, B1>, B1>, B0>>>`
= note: required for `Cons<extra_safe::traits::Absorb<UInt<UInt<UInt<UTerm, B1>, B0>, B1>>, Cons<extra_safe::traits::Squeeze<UTerm>, Cons<extra_safe::traits::Absorb<UInt<UTerm, B1>>, Nil>>>` to implement `Consume<extra_safe::traits::Absorb<UInt<UInt<UInt<UTerm, B1>, B1>, B0>>>`

error[E0277]: cannot subtract `B1` from `UInt<UTerm, B0>`
--> src/unit_tests/compilation/consume_head.rs:8:5
|
8 | / assert_type_eq!(
9 | | Use<iopat![Absorb<U5>, Squeeze<U0>, Absorb<U1>], Absorb<U6>>,
10 | | Nil
11 | | );
| |_____^ no implementation for `UInt<UTerm, B0> - B1`
|
= help: the trait `Sub<B1>` is not implemented for `UInt<UTerm, B0>`, which is required by `Cons<extra_safe::traits::Absorb<UInt<UInt<UInt<UTerm, B1>, B0>, B1>>, Cons<extra_safe::traits::Squeeze<UTerm>, Cons<extra_safe::traits::Absorb<UInt<UTerm, B1>>, Nil>>>: Consume<extra_safe::traits::Absorb<UInt<UInt<UInt<UTerm, B1>, B1>, B0>>>`
= help: the following other types implement trait `Sub<Rhs>`:
`UInt<U, B0>` implements `Sub<B1>`
`UInt<U, B>` implements `Sub<B0>`
`UInt<UInt<U, B>, B1>` implements `Sub<B1>`
`UInt<UTerm, B1>` implements `Sub<B1>`
`UInt<Ul, Bl>` implements `Sub<Ur>`
= note: required for `UInt<UInt<UTerm, B1>, B0>` to implement `PrivateSub<UInt<UInt<UTerm, B1>, B1>>`
= note: required for `UInt<UInt<UInt<UTerm, B1>, B0>, B1>` to implement `Sub<UInt<UInt<UInt<UTerm, B1>, B1>, B0>>`
= note: required for `Cons<extra_safe::traits::Absorb<UInt<UInt<UInt<UTerm, B1>, B0>, B1>>, Cons<extra_safe::traits::Squeeze<UTerm>, Cons<extra_safe::traits::Absorb<UInt<UTerm, B1>>, Nil>>>` to implement `Consume<extra_safe::traits::Absorb<UInt<UInt<UInt<UTerm, B1>, B1>, B0>>>`
= note: this error originates in the macro `assert_type_eq` (in Nightly builds, run with -Z macro-backtrace for more info)
8 changes: 8 additions & 0 deletions src/unit_tests/compilation/normalize.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,11 @@ error[E0277]: the trait bound `Cons<extra_safe::traits::Absorb<UInt<UInt<UInt<UT
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Same<Cons<extra_safe::traits::Absorb<UInt<UInt<UInt<UTerm, B1>, B0>, B0>>, Nil>>` is not implemented for `Cons<extra_safe::traits::Absorb<UInt<UInt<UInt<UTerm, B1>, B0>, B1>>, Nil>`
|
= note: this error originates in the macro `assert_type_eq` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0277]: the trait bound `Cons<extra_safe::traits::Absorb<UInt<UInt<UInt<UTerm, B1>, B0>, B1>>, Nil>: Same<Cons<extra_safe::traits::Absorb<UInt<UInt<UInt<UTerm, B1>, B0>, B0>>, Nil>>` is not satisfied
--> src/unit_tests/compilation/normalize.rs:7:5
|
7 | assert_type_eq!(Norm<iopat![Absorb<U2>, Absorb<U3>]>, iopat![Absorb<U4>]);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Same<Cons<extra_safe::traits::Absorb<UInt<UInt<UInt<UTerm, B1>, B0>, B0>>, Nil>>` is not implemented for `Cons<extra_safe::traits::Absorb<UInt<UInt<UInt<UTerm, B1>, B0>, B1>>, Nil>`
|
= note: this error originates in the macro `assert_type_eq` (in Nightly builds, run with -Z macro-backtrace for more info)
11 changes: 11 additions & 0 deletions src/unit_tests/compilation/normalize_complex.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,14 @@ error[E0277]: the trait bound `Cons<extra_safe::traits::Absorb<UInt<UInt<UInt<UI
| |_____^ the trait `Same<Cons<extra_safe::traits::Absorb<UInt<UInt<UTerm, B1>, B0>>, Cons<extra_safe::traits::Absorb<UInt<UInt<UInt<UTerm, B1>, B1>, B0>>, Nil>>>` is not implemented for `Cons<extra_safe::traits::Absorb<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>>, Nil>`
|
= note: this error originates in the macro `assert_type_eq` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0277]: the trait bound `Cons<extra_safe::traits::Absorb<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>>, Nil>: Same<Cons<extra_safe::traits::Absorb<UInt<UInt<UTerm, B1>, B0>>, Cons<extra_safe::traits::Absorb<UInt<UInt<UInt<UTerm, B1>, B1>, B0>>, Nil>>>` is not satisfied
--> src/unit_tests/compilation/normalize_complex.rs:7:5
|
7 | / assert_type_eq!(
8 | | Norm<iopat![Absorb<U2>, Squeeze<U0>, Absorb<U3>, Absorb<U3>]>,
9 | | iopat![Absorb<U2>, Absorb<U6>]
10 | | );
| |_____^ the trait `Same<Cons<extra_safe::traits::Absorb<UInt<UInt<UTerm, B1>, B0>>, Cons<extra_safe::traits::Absorb<UInt<UInt<UInt<UTerm, B1>, B1>, B0>>, Nil>>>` is not implemented for `Cons<extra_safe::traits::Absorb<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>>, Nil>`
|
= note: this error originates in the macro `assert_type_eq` (in Nightly builds, run with -Z macro-backtrace for more info)
12 changes: 6 additions & 6 deletions src/unit_tests/compilation/sponge_bad_api.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ error[E0277]: cannot subtract `B1` from `UInt<UInt<UTerm, B0>, B0>`
89 | extra_sponge.absorb(Array::from_core_array(five_array), &mut Vec::default());
| ^^^^^^ no implementation for `UInt<UInt<UTerm, B0>, B0> - B1`
|
= help: the trait `Sub<B1>` is not implemented for `UInt<UInt<UTerm, B0>, B0>`
= help: the trait `Sub<B1>` is not implemented for `UInt<UInt<UTerm, B0>, B0>`, which is required by `Cons<extra_safe::traits::Absorb<UInt<UInt<UInt<UTerm, B1>, B0>, B0>>, Cons<extra_safe::traits::Squeeze<UInt<UInt<UTerm, B1>, B1>>, Nil>>: Consume<extra_safe::traits::Absorb<UInt<UInt<UInt<UTerm, B1>, B0>, B1>>>`
= help: the following other types implement trait `Sub<Rhs>`:
<UInt<U, B0> as Sub<B1>>
<UInt<U, B> as Sub<B0>>
<UInt<UInt<U, B>, B1> as Sub<B1>>
<UInt<UTerm, B1> as Sub<B1>>
<UInt<Ul, Bl> as Sub<Ur>>
`UInt<U, B0>` implements `Sub<B1>`
`UInt<U, B>` implements `Sub<B0>`
`UInt<UInt<U, B>, B1>` implements `Sub<B1>`
`UInt<UTerm, B1>` implements `Sub<B1>`
`UInt<Ul, Bl>` implements `Sub<Ur>`
= note: required for `UInt<UInt<UInt<UTerm, B1>, B0>, B0>` to implement `PrivateSub<UInt<UInt<UInt<UTerm, B1>, B0>, B1>>`
= note: required for `UInt<UInt<UInt<UTerm, B1>, B0>, B0>` to implement `Sub<UInt<UInt<UInt<UTerm, B1>, B0>, B1>>`
= note: required for `Cons<extra_safe::traits::Absorb<UInt<UInt<UInt<UTerm, B1>, B0>, B0>>, Cons<extra_safe::traits::Squeeze<UInt<UInt<UTerm, B1>, B1>>, Nil>>` to implement `Consume<extra_safe::traits::Absorb<UInt<UInt<UInt<UTerm, B1>, B0>, B1>>>`
6 changes: 3 additions & 3 deletions src/unit_tests/compilation/sponge_creation.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ error[E0308]: mismatched types
83 | | basic_sponge,
84 | | &mut start_acc,
85 | | );
| |_________^ expected struct `UTerm`, found struct `UInt`
| |_________^ expected `UTerm`, found `UInt<UTerm, B1>`
|
= note: expected struct `ExtraSponge<BasicSponge, Cons<Absorb<UInt<UInt<UTerm, B1>, B0>>, Cons<Absorb<UInt<..., ...>>, ...>>>`
found struct `ExtraSponge<_, Cons<extra_safe::traits::Absorb<UInt<UInt<UInt<UTerm, B1>, B0>, B1>>, Cons<extra_safe::traits::Squeeze<UInt<UInt<UTerm, B1>, B1>>, Nil>>>`
= note: expected struct `ExtraSponge<BasicSponge, Cons<extra_safe::traits::Absorb<UInt<UInt<UTerm, B1>, B0>>, Cons<extra_safe::traits::Absorb<UInt<UInt<UTerm, B1>, B1>>, Cons<extra_safe::traits::Squeeze<UInt<UInt<UTerm, B1>, B1>>, Nil>>>>`
found struct `ExtraSponge<BasicSponge, Cons<extra_safe::traits::Absorb<UInt<UInt<UInt<UTerm, B1>, B0>, B1>>, Cons<extra_safe::traits::Squeeze<UInt<UInt<UTerm, B1>, B1>>, Nil>>>`
Loading