diff --git a/src/lib.rs b/src/lib.rs index 8b96313..74fe1ba 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -230,6 +230,7 @@ impl Drop for ExtraSponge { } #[cfg(test)] +/// Unit tests for the Sponge API. pub mod unit_tests; #[cfg(test)] diff --git a/src/unit_tests/compilation/consume.stderr b/src/unit_tests/compilation/consume.stderr index 4acdc1e..01b2570 100644 --- a/src/unit_tests/compilation/consume.stderr +++ b/src/unit_tests/compilation/consume.stderr @@ -2,13 +2,36 @@ error[E0277]: the trait bound `UTerm: PrivateSub>` is not satisf --> src/unit_tests/compilation/consume.rs:9:9 | 9 | Use, Squeeze, Absorb], Absorb>, - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `PrivateSub>` is not implemented for `UTerm` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `PrivateSub>` is not implemented for `UTerm`, which is required by `Cons, B1>>, Cons>, Cons>, Nil>>>: Consume, B1>, B0>>>` | = help: the following other types implement trait `PrivateSub`: - as PrivateSub>> - as PrivateSub>> - as PrivateSub>> - as PrivateSub>> + `UInt` implements `PrivateSub>` + `UInt` implements `PrivateSub>` + `UInt` implements `PrivateSub>` + `UInt` implements `PrivateSub>` = note: required for `UInt` to implement `PrivateSub, B1>>` = note: required for `UInt, B1>` to implement `Sub, B1>, B0>>` = note: required for `Cons, B1>>, Cons>, Cons>, Nil>>>` to implement `Consume, B1>, B0>>>` + = note: the full name for the type has been written to '$DIR/target/tests/trybuild/aarch64-apple-darwin/debug/deps/$CRATE-b4d682b1f57e5d44.long-type-3642229067816383729.txt' + = note: consider using `--verbose` to print the full type name to the console + +error[E0277]: the trait bound `UTerm: PrivateSub>` is not satisfied + --> src/unit_tests/compilation/consume.rs:8:5 + | +8 | / assert_type_eq!( +9 | | Use, Squeeze, Absorb], Absorb>, +10 | | iopat![Squeeze, Absorb] +11 | | ); + | |_____^ the trait `PrivateSub>` is not implemented for `UTerm`, which is required by `Cons, B1>>, Cons>, Cons>, Nil>>>: Consume, B1>, B0>>>` + | + = help: the following other types implement trait `PrivateSub`: + `UInt` implements `PrivateSub>` + `UInt` implements `PrivateSub>` + `UInt` implements `PrivateSub>` + `UInt` implements `PrivateSub>` + = note: required for `UInt` to implement `PrivateSub, B1>>` + = note: required for `UInt, B1>` to implement `Sub, B1>, B0>>` + = note: required for `Cons, B1>>, Cons>, Cons>, Nil>>>` to implement `Consume, B1>, B0>>>` + = note: the full name for the type has been written to '$DIR/target/tests/trybuild/aarch64-apple-darwin/debug/deps/$CRATE-b4d682b1f57e5d44.long-type-3642229067816383729.txt' + = note: consider using `--verbose` to print the full type name to the console + = note: this error originates in the macro `assert_type_eq` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/src/unit_tests/compilation/consume_head.stderr b/src/unit_tests/compilation/consume_head.stderr index 3f8740a..ac1dcb1 100644 --- a/src/unit_tests/compilation/consume_head.stderr +++ b/src/unit_tests/compilation/consume_head.stderr @@ -4,13 +4,38 @@ error[E0277]: cannot subtract `B1` from `UInt` 9 | Use, Squeeze, Absorb], Absorb>, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no implementation for `UInt - B1` | - = help: the trait `Sub` is not implemented for `UInt` + = help: the trait `Sub` is not implemented for `UInt`, which is required by `Cons, B0>, B1>>, Cons, Cons>, Nil>>>: Consume, B1>, B0>>>` = help: the following other types implement trait `Sub`: - as Sub> - as Sub> - , B1> as Sub> - as Sub> - as Sub> + `UInt` implements `Sub` + `UInt` implements `Sub` + `UInt, B1>` implements `Sub` + `UInt` implements `Sub` + `UInt` implements `Sub` = note: required for `UInt, B0>` to implement `PrivateSub, B1>>` = note: required for `UInt, B0>, B1>` to implement `Sub, B1>, B0>>` = note: required for `Cons, B0>, B1>>, Cons, Cons>, Nil>>>` to implement `Consume, B1>, B0>>>` + = note: the full name for the type has been written to '$DIR/target/tests/trybuild/aarch64-apple-darwin/debug/deps/$CRATE-901c64bc5947f6da.long-type-12175079161346788738.txt' + = note: consider using `--verbose` to print the full type name to the console + +error[E0277]: cannot subtract `B1` from `UInt` + --> src/unit_tests/compilation/consume_head.rs:8:5 + | +8 | / assert_type_eq!( +9 | | Use, Squeeze, Absorb], Absorb>, +10 | | Nil +11 | | ); + | |_____^ no implementation for `UInt - B1` + | + = help: the trait `Sub` is not implemented for `UInt`, which is required by `Cons, B0>, B1>>, Cons, Cons>, Nil>>>: Consume, B1>, B0>>>` + = help: the following other types implement trait `Sub`: + `UInt` implements `Sub` + `UInt` implements `Sub` + `UInt, B1>` implements `Sub` + `UInt` implements `Sub` + `UInt` implements `Sub` + = note: required for `UInt, B0>` to implement `PrivateSub, B1>>` + = note: required for `UInt, B0>, B1>` to implement `Sub, B1>, B0>>` + = note: required for `Cons, B0>, B1>>, Cons, Cons>, Nil>>>` to implement `Consume, B1>, B0>>>` + = note: the full name for the type has been written to '$DIR/target/tests/trybuild/aarch64-apple-darwin/debug/deps/$CRATE-901c64bc5947f6da.long-type-12175079161346788738.txt' + = note: consider using `--verbose` to print the full type name to the console + = note: this error originates in the macro `assert_type_eq` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/src/unit_tests/compilation/normalize.stderr b/src/unit_tests/compilation/normalize.stderr index ed7b3b3..86a07d7 100644 --- a/src/unit_tests/compilation/normalize.stderr +++ b/src/unit_tests/compilation/normalize.stderr @@ -5,3 +5,11 @@ error[E0277]: the trait bound `Cons, B0>, B0>>, Nil>>` is not implemented for `Cons, 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, B0>, B1>>, Nil>: Same, B0>, B0>>, Nil>>` is not satisfied + --> src/unit_tests/compilation/normalize.rs:7:5 + | +7 | assert_type_eq!(Norm, Absorb]>, iopat![Absorb]); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Same, B0>, B0>>, Nil>>` is not implemented for `Cons, B0>, B1>>, Nil>` + | + = note: this error originates in the macro `assert_type_eq` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/src/unit_tests/compilation/normalize_complex.stderr b/src/unit_tests/compilation/normalize_complex.stderr index 27c66f5..dc3ada2 100644 --- a/src/unit_tests/compilation/normalize_complex.stderr +++ b/src/unit_tests/compilation/normalize_complex.stderr @@ -8,3 +8,14 @@ error[E0277]: the trait bound `Cons, B0>>, Cons, B1>, B0>>, Nil>>>` is not implemented for `Cons, 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, B0>, B0>, B0>>, Nil>: Same, B0>>, Cons, B1>, B0>>, Nil>>>` is not satisfied + --> src/unit_tests/compilation/normalize_complex.rs:7:5 + | +7 | / assert_type_eq!( +8 | | Norm, Squeeze, Absorb, Absorb]>, +9 | | iopat![Absorb, Absorb] +10 | | ); + | |_____^ the trait `Same, B0>>, Cons, B1>, B0>>, Nil>>>` is not implemented for `Cons, 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) diff --git a/src/unit_tests/compilation/sponge_bad_api.stderr b/src/unit_tests/compilation/sponge_bad_api.stderr index fff05e9..c35931e 100644 --- a/src/unit_tests/compilation/sponge_bad_api.stderr +++ b/src/unit_tests/compilation/sponge_bad_api.stderr @@ -4,13 +4,13 @@ error[E0277]: cannot subtract `B1` from `UInt, B0>` 89 | extra_sponge.absorb(Array::from_core_array(five_array), &mut Vec::default()); | ^^^^^^ no implementation for `UInt, B0> - B1` | - = help: the trait `Sub` is not implemented for `UInt, B0>` + = help: the trait `Sub` is not implemented for `UInt, B0>`, which is required by `Cons, B0>, B0>>, Cons, B1>>, Nil>>: Consume, B0>, B1>>>` = help: the following other types implement trait `Sub`: - as Sub> - as Sub> - , B1> as Sub> - as Sub> - as Sub> + `UInt` implements `Sub` + `UInt` implements `Sub` + `UInt, B1>` implements `Sub` + `UInt` implements `Sub` + `UInt` implements `Sub` = note: required for `UInt, B0>, B0>` to implement `PrivateSub, B0>, B1>>` = note: required for `UInt, B0>, B0>` to implement `Sub, B0>, B1>>` = note: required for `Cons, B0>, B0>>, Cons, B1>>, Nil>>` to implement `Consume, B0>, B1>>>` diff --git a/src/unit_tests/compilation/sponge_creation.stderr b/src/unit_tests/compilation/sponge_creation.stderr index c043ccb..19c977f 100644 --- a/src/unit_tests/compilation/sponge_creation.stderr +++ b/src/unit_tests/compilation/sponge_creation.stderr @@ -8,7 +8,8 @@ error[E0308]: mismatched types 83 | | basic_sponge, 84 | | &mut start_acc, 85 | | ); - | |_________^ expected struct `UTerm`, found struct `UInt` + | |_________^ expected `UTerm`, found `UInt` | = note: expected struct `ExtraSponge, B0>>, Cons>, ...>>>` found struct `ExtraSponge<_, Cons, B0>, B1>>, Cons, B1>>, Nil>>>` + = note: consider using `--verbose` to print the full type name to the console