Skip to content

digest: type name readability regression #1069

Open
@tarcieri

Description

@tarcieri

Digest now makes use of several vaguely-named generic wrapper structs and type aliases to give them human-readable names.

This makes both the type names emitted by rustc and the resulting rustdoc harder to read, as they render the canonical type name rather than the type alias.

For example, what used to render in rustdoc as:

impl PrehashSignature for Signature {
    type Digest = Sha256;
}

now renders as:

impl PrehashSignature for Signature {
    type Digest = CoreWrapper<CtVariableCoreWrapper<Sha256VarCore, UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>>>
}

e.g. https://docs.rs/k256/0.11.3/k256/schnorr/struct.Signature.html#impl-PrehashSignature

I think this usability issue and various others (e.g. confusing error messages relating to blanket impls of sealed traits) could be fixed by using newtypes around the generic core, rather than just type aliases.

Metadata

Metadata

Assignees

No one assigned

    Labels

    digestHash function crate

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions