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

Fix returning invalid strides and dimensions for rank zero arrays. #303

Merged
merged 1 commit into from
Mar 23, 2022

Conversation

adamreichold
Copy link
Member

The docs contain:

When nd is 0, the array is sometimes called a rank-0 array. Such arrays have undefined dimensions and strides and cannot be accessed.

@adamreichold
Copy link
Member Author

adamreichold commented Mar 22, 2022

The test has funny failures like

thread 'rank_0_array_has_invalid_strides_dimensions' panicked at 'assertion failed: `(left == right)`
  left: `[]`,
 right: `[]`', tests/array.rs:77:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

without the fix as p == ptr::null() in this case which is not valid for slice::from_raw_parts even when n == 0.

@adamreichold adamreichold force-pushed the fix-rank-zero-strides-dimensions branch from e75190b to 4e4845d Compare March 22, 2022 22:16
@adamreichold adamreichold force-pushed the fix-rank-zero-strides-dimensions branch from 4e4845d to 25c4070 Compare March 22, 2022 23:05
Copy link
Member

@davidhewitt davidhewitt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch 👍

@adamreichold adamreichold merged commit 0831a1a into release-0.16 Mar 23, 2022
@adamreichold adamreichold deleted the fix-rank-zero-strides-dimensions branch March 23, 2022 11:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants