-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
[stdlib] Give the CollectionElementNew
trait to UnsafeMaybeUninitalized
#2971
[stdlib] Give the CollectionElementNew
trait to UnsafeMaybeUninitalized
#2971
Conversation
…alized` Signed-off-by: gabrieldemarmiesse <gabrieldemarmiesse@gmail.com>
Signed-off-by: gabrieldemarmiesse <gabrieldemarmiesse@gmail.com>
Signed-off-by: gabrieldemarmiesse <gabrieldemarmiesse@gmail.com>
@ConnorGray all done. I also think that it should be possible in a future PR to remove the requirements for the type that can be put inside an EDIT: Actually, I'll clean up more stuff in this PR. |
Signed-off-by: gabrieldemarmiesse <gabrieldemarmiesse@gmail.com>
Signed-off-by: gabrieldemarmiesse <gabrieldemarmiesse@gmail.com>
Signed-off-by: gabrieldemarmiesse <gabrieldemarmiesse@gmail.com>
Signed-off-by: gabrieldemarmiesse <gabrieldemarmiesse@gmail.com>
Signed-off-by: gabrieldemarmiesse <gabrieldemarmiesse@gmail.com>
Signed-off-by: gabrieldemarmiesse <gabrieldemarmiesse@gmail.com>
Summary of the changes:
@ConnorGray it's ready for review, for real this time :) |
!sync |
" UnsafeMaybeUninitialized. It has very specific semantics." | ||
), | ||
]() | ||
self = Self() |
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 think making this a compile time failure might prevent uses like InlineArray[UnsafeMaybeUninitialized[T]]
, because that type would instantiate a call to this copy constructor.
The goal would be to avoid dynamically doing a copy operation, but we need the compiler to accept code that "looks like" it could do a copy, because its up to the programmer to make sure no actual copy gets attempted.
@@ -343,7 +343,7 @@ struct UnsafePointer[ | |||
@always_inline | |||
fn initialize_pointee_explicit_copy[ | |||
T2: ExplicitlyCopyable | |||
](inout self: UnsafePointer[T, address_space], value: T2): | |||
](self: UnsafePointer[T, address_space], value: T2): |
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.
👍 , this makes sense.
Hey Gabriel, thanks for your work on this, I think this all looks good—I like that change to make this work with Re: the We could investigate switching this to |
Signed-off-by: gabrieldemarmiesse <gabrieldemarmiesse@gmail.com>
Signed-off-by: gabrieldemarmiesse <gabrieldemarmiesse@gmail.com>
Awesome, thank you for the changes Gabriel! This looks good, I'll move forward with merging :) |
!sync |
✅🟣 This contribution has been merged 🟣✅ Your pull request has been merged to the internal upstream Mojo sources. It will be reflected here in the Mojo repository on the nightly branch during the next Mojo nightly release, typically within the next 24-48 hours. We use Copybara to merge external contributions, click here to learn more. |
Landed in 431a620! Thank you for your contribution 🎉 |
This is part of the PR #2965
@ConnorGray I think you're the right person for a review :)