oxidecomputer / oxidecomputer/hubris

use const generics in DICE cert trait

Open
#778 2 comments 0 reactions 1 assignee View on GitHub

@flihp is already working on this.

Since Sep 14, 2022.

trust quorum
Dominant language
Rust
Stars
3.6k
Forks
239
Avg merge
1d 12h
Merged PRs (30d)
23

Description

This interface would ideally return sized arrays for the generic 'get_range' function. This isn't yet possible w/o using unstable features:

trait Foo {
    const BAR: usize;
    
    fn baz(self) -> [u8; Self::BAR];
}

Currently this produces an error:

error: generic parameters may not be used in const operations
 --> src/lib.rs:6:26
  |
6 |     fn baz(self) -> [u8; Self::BAR];
  |                          ^^^^^^^^^ cannot perform const operation using `Self`
  |
  = note: type parameters may not be used in const expressions
  = help: use `#![feature(generic_const_exprs)]` to allow generic const expressions

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.