Can't leak crate-private traits error in libcrux-ml-kem
Here are the revisions I'm working off of:
jonathan@verveine:~/Code/libcrux/libcrux-ml-kem (dev) $ git rev-parse head
b013f19f98b066f15bf931df38481a453a149aa8
jonathan@verveine:~/Code/libcrux/libcrux-ml-kem (dev) $ (cd $CHARON_HOME && git rev-parse head)
ed5047fd07e6c6aa8e7b9f352637f91977adacbe
If I try to extract libcrux-ml-kem, I get:
jonathan@verveine:~/Code/libcrux/libcrux-ml-kem (dev) $ charon
Compiling libcrux-ml-kem v0.0.2-pre.2 (/Users/jonathan/Code/libcrux/libcrux-ml-kem)
Compiling libcrux-sha3 v0.0.2-pre.2 (/Users/jonathan/Code/libcrux/libcrux-sha3)
warning: unknown lint: `private_bounds`
--> libcrux-sha3/src/generic_keccak.rs:9:9
|
9 | #[allow(private_bounds)] // TODO: figure out visibility
| ^^^^^^^^^^^^^^ help: did you mean: `trivial_bounds`
|
= note: `#[warn(unknown_lints)]` on by default
warning: unknown lint: `private_bounds`
--> libcrux-sha3/src/generic_keccak.rs:23:9
|
23 | #[allow(private_bounds)] // TODO: figure out visibility
| ^^^^^^^^^^^^^^ help: did you mean: `trivial_bounds`
error[E0445]: crate-private trait `traits::KeccakItem<N>` in public interface
--> libcrux-sha3/src/generic_keccak.rs:11:1
|
11 | pub struct KeccakState<const N: usize, T: KeccakItem<N>> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak crate-private trait
|
::: libcrux-sha3/src/traits.rs:2:1
|
2 | pub(crate) trait KeccakItem<const N: usize>: Clone + Copy {
| --------------------------------------------------------- `traits::KeccakItem<N>` declared as crate-private
error[E0445]: crate-private trait `traits::KeccakItem<N>` in public interface
--> libcrux-sha3/src/generic_keccak.rs:24:1
|
24 | impl<const N: usize, T: KeccakItem<N>> KeccakState<N, T> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak crate-private trait
|
::: libcrux-sha3/src/traits.rs:2:1
|
2 | pub(crate) trait KeccakItem<const N: usize>: Clone + Copy {
| --------------------------------------------------------- `traits::KeccakItem<N>` declared as crate-private
For more information about this error, try `rustc --explain E0445`.
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: ()', src/charon-driver.rs:91:14
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: `libcrux-sha3` (lib) generated 2 warnings
error: could not compile `libcrux-sha3` (lib) due to 2 previous errors; 2 warnings emitted
warning: build failed, waiting for other jobs to finish...
[ INFO charon_lib::export:111] [GCrateData<_, _>::serialize_to_file]: Generated the file: /Users/jonathan/Code/libcrux/build_script_build.llbc
@Nadrieril I want to change the priority of this issue (make it P1) but it doesn't appear in the dashboard. Any idea where the issue comes from? (I had to add the issue by hand)
Yeah it's a known limitation. GitHub project has an option to auto-import issues from one repo but only one. I chose aeneas a bit arbitrarily; this means we need to add charon issues to the project by hand. If we paid for a GitHub plan we'd have the option to auto-import from more repos. There might also be a way to use GitHub Actions to automate this, I'll have to look into it.
@msprotz I think this is not due to charon itself but to the old rustc version it uses. The error says that it doesn't know the "private_bounds" lint, which was added to a more recent rustc version than the one we use. I think https://github.com/AeneasVerif/charon/pull/186 should fix your issue.
@msprotz Can you try with latest charon main?
Yup I just need to wrap up my trait work first then will attempt upgrading tool versions. Expect a few days' delay.
~I can confirm this is fixed. Thanks!~
Actually I just saw this again. Will try to send a repro soon.
Has this happened again since?
I think the code got rewritten and I don't remember which set of revisions last triggered it. I'm ok with closing, and we'll reopen it if it resurfaces. Thanks.