Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Encode expected/actual info in ShapeError #962

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft

Commits on Mar 29, 2021

  1. Configuration menu
    Copy the full SHA
    da365be View commit details
    Browse the repository at this point in the history
  2. FEAT: Encode expected/actual info in ShapeError

    Add a (limited) way to add specific information to a ShapeError
    
    Admittedly wonky, but space efficient.
    
    Result<(), ShapeError> used to be 1 byte, and with this change it
    expands to 16 bytes (2 usize on 64-bit).
    
    The remaining 15 bytes are used for optimistically packing as much of
    extra info into the error message as possible.
    
    For example we can store expected/actual index for errors (for example
    index out of bounds or axis out of bounds, these are not so commonly
    handled with ShapeError).
    
    With this change it is supported:
    
    - Expected/actual index with 7 bytes per index
    - Expected/actual shape with 7 bytes per shape
      supports storing shapes with one or two bytes (< 256²) per dimension,
      with limited ndim.
    bluss committed Mar 29, 2021
    Configuration menu
    Copy the full SHA
    3a59caa View commit details
    Browse the repository at this point in the history
  3. FIX: Add extra information to errors where possible

    Where possible, add expected/actual information to the ShapeError.
    
    In many places it is identified new places where more specific
    ErrorKinds and error messages are needed. These are not updated here - a
    comment is inserted - this will be updated in a future version, when we
    can accept breaking changes.
    bluss committed Mar 29, 2021
    Configuration menu
    Copy the full SHA
    5f34c4a View commit details
    Browse the repository at this point in the history