-
-
Notifications
You must be signed in to change notification settings - Fork 16
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
Replace Sentinel
with Self::dangling()
for uninitialized EcoVec
#28
Conversation
Codecov ReportPatch coverage:
❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more. Additional details and impacted files@@ Coverage Diff @@
## main #28 +/- ##
==========================================
+ Coverage 91.59% 91.62% +0.03%
==========================================
Files 3 3
Lines 1047 1039 -8
==========================================
- Hits 959 952 -7
+ Misses 88 87 -1
☔ View full report in Codecov by Sentry. |
Sentinel
with NonNull::dangling()
for uninitialzed EcoVec
Sentinel
with NonNull::dangling()
for uninitialized EcoVec
Interesting observation with the header. It's only possible through an optimization that's more recent than the sentinel mechanic (the fact that an EcoVec's pointer points behind its header). Technically, I don't think there is any guarantee that I still think the approach has potential, maybe we'd have to drop lower and construct the dangling pointer ourselves to get the guarantees we need. Directly from the value |
I think if we use It's kind of funny, actually. |
8dffa44
to
fb2909a
Compare
Sentinel
with NonNull::dangling()
for uninitialized EcoVec
Sentinel
with Self::dangling()
for uninitialized EcoVec
fb2909a
to
68cbcc9
Compare
The changes look great! Most of the explanation is already there in the doc comment, but it would be great if there was also an explicit Edit: Could you also wrap the doc comment at 80 columns? |
68cbcc9
to
46ff467
Compare
Thanks for the idea and implementation! |
This allows
EcoVec::new()
to beconst
.I believe this is safe. All tests pass with
cargo miri test
, and I have given my reasoning in the comments. It also does not makeEcoVec::as_slice()
any more expensive.