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

[util] Ptr doesn't track byte length separately #645

Merged
merged 1 commit into from
Nov 27, 2023
Merged

Conversation

joshlf
Copy link
Member

@joshlf joshlf commented Nov 27, 2023

Since raw pointer slice casts are now guaranteed to preserve element count [1], we no longer need to separately store the byte length of a Ptr. Instead, we can compute it from the raw pointer field.

[1] rust-lang/reference#1417

@joshlf joshlf requested a review from jswrenn November 27, 2023 19:46
src/util.rs Show resolved Hide resolved
src/util.rs Outdated Show resolved Hide resolved
src/util.rs Show resolved Hide resolved
Copy link
Collaborator

@jswrenn jswrenn left a comment

Choose a reason for hiding this comment

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

See comments.

Since raw pointer slice casts are now guaranteed to preserve element
count [1], we no longer need to separately store the byte length of a
`Ptr`. Instead, we can compute it from the raw pointer field.

[1] rust-lang/reference#1417
@joshlf joshlf added this pull request to the merge queue Nov 27, 2023
Merged via the queue into main with commit 64aafb5 Nov 27, 2023
126 checks passed
@joshlf joshlf deleted the ptr-no-elems-count branch November 27, 2023 21:29
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