-
Notifications
You must be signed in to change notification settings - Fork 146
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
New modifications #155
New modifications #155
Conversation
c2acd16
to
0865b42
Compare
Could you please redo these changes so there's a separate commit for each of the points you mentioned? This is really difficult to review in its current condition. |
aa1a49c
to
a797f80
Compare
@jdm Sure |
lib.rs: Alloc feature Cargo.toml: New features and 2018 edition
For testing in development and CI
Method names are now matching std
lib.rs
Outdated
@@ -258,25 +258,25 @@ impl<A: Array> SmallVecData<A> { | |||
#[inline] | |||
unsafe fn inline(&self) -> &A { | |||
match *self { | |||
SmallVecData::Inline(ref a) => a, | |||
SmallVecData::Inline(ref a) => &*a.as_ptr(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe it's unsound to return an &A
that points to a possibly-uninitialized A
. This method should be changed to return a raw pointer. (The callers of this method only need raw pointers anyways.)
lib.rs
Outdated
_ => debug_unreachable!(), | ||
} | ||
} | ||
#[inline] | ||
unsafe fn inline_mut(&mut self) -> &mut A { | ||
match *self { | ||
SmallVecData::Inline(ref mut a) => a, | ||
SmallVecData::Inline(ref mut a) => &mut *a.as_mut_ptr(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Like inline
above, this method should be changed to return a raw pointer.
Thanks @mbrubeck |
Can I squash commits? |
@SimonSapin How does this work relate to #157? |
I haven’t looked at the diff, but based on the description a lot of it is similar or equivalent. Only with a different approach: incremental changes v.s. rewrite. |
Based on this current work, I can apply @SimonSapin modifications in future PRs |
The const_generics feature is now fully functional. Is anything preventing this PR from being merged? |
While experimenting with const generics in a branch is fine, I would prefer not to have them in the
I realize this is not exactly what you meant, but that’s an overstatement. Using |
I am sorry for the misunderstanding. Early versions of this PR contained a non-functional implementation for constant generics and it is now properly fixed.
It is the own nature of unstable Rustc features to break existing code in future releases, the same reason can be applied to already included unstable features of Nevertheless, if you guys feel comfortable enough to merge this code without constant generics, I can extract it into a separate PR. |
|
☔ The latest upstream changes (presumably #159) made this pull request unmergeable. Please resolve the merge conflicts. |
I think most of this stuff has landed already incrementally... Should this be closed? |
(Like, constant generics and other improvements are still welcome I guess, but this PR as is is pretty unlikely to land) |
I cherry-picked and landed some of the changes from this that weren't covered by other PRs. I'm closing this now but feel free to open new PRs for any remaining changes. Smaller, incremental patches are appreciated if possible. Thanks! |
Fixes #154 and some other things.
alloc
feature and doesn't remove thestd
feature because ofstd::io::Write
.mem::uninitialized
withMaybeUninit
.NonNull<T>
instead of*mut T
.VecLike
.core::hint::unreachable_unchecked
instead ofunchecked
.lib.rs
file into smaller modules for better readability, localization and maintainability.1.36
.2018
epochversion.This change is