Skip to content

Can't leak crate-private traits error in libcrux-ml-kem #189

@msprotz

Description

@msprotz

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions