-
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] Use UnsafePointer
in vector.mojo
#2377
[stdlib] Use UnsafePointer
in vector.mojo
#2377
Conversation
7c765ba
to
78fde64
Compare
Not the same, one has a named argument ((sarcasm) yeah, I think it's a compiler bug). |
0f9bef1
to
1f60dde
Compare
UnsafePointer
in simd.mojo
and vector.mojo
UnsafePointer
in vector.mojo
Signed-off-by: gabrieldemarmiesse <gabrieldemarmiesse@gmail.com>
1f60dde
to
8291822
Compare
Thanks for pushing on this! I'll import the PR internally and we'll take a look at the compiler bug and see if there's a workaround, etc. |
Thanks for poking me about this Joe. @gabrieldemarmiesse the problem here is a disagreement about AnyRegType, I think it works if you change VecIter to:
AnyRegType is a bad thing :), we need to move off it completely to use AnyType. |
Signed-off-by: gabrieldemarmiesse <gabrieldemarmiesse@gmail.com>
Thanks @lattner it works well :) This PR is ready for review now |
@@ -243,5 +243,5 @@ struct InlinedFixedVector[ | |||
An iterator to the start of the vector. | |||
""" | |||
return Self._iterator( | |||
0, self.current_size, Reference(self).get_legacy_pointer() | |||
0, self.current_size, UnsafePointer(Reference(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.
Maybe:
0, self.current_size, UnsafePointer(Reference(self)) | |
0, self.current_size, UnsafePointer.address_of(self) |
[External] [stdlib] Use `UnsafePointer` in `vector.mojo` As part of the migrating from `Pointer` to `UnsafePointer`, continue this in `vector.mojo`. This requires changing one bit to use `AnyType` rather than `AnyRegType` to play nicely with `UnsafePointer`. In the near future, we want to replace use of `AnyRegType` with `AnyType` throughout the library. --------- Co-authored-by: gabrieldemarmiesse <gabrieldemarmiesse@gmail.com> Closes #2377 MODULAR_ORIG_COMMIT_REV_ID: a9d3d17ea2dc2e092569829d632754c7c81a6a39
Landed in #2559! |
[External] [stdlib] Use `UnsafePointer` in `vector.mojo` As part of the migrating from `Pointer` to `UnsafePointer`, continue this in `vector.mojo`. This requires changing one bit to use `AnyType` rather than `AnyRegType` to play nicely with `UnsafePointer`. In the near future, we want to replace use of `AnyRegType` with `AnyType` throughout the library. --------- Co-authored-by: gabrieldemarmiesse <gabrieldemarmiesse@gmail.com> Closes modularml#2377 MODULAR_ORIG_COMMIT_REV_ID: a9d3d17ea2dc2e092569829d632754c7c81a6a39 Signed-off-by: Lukas Hermann <lukashermann28@gmail.com>
[External] [stdlib] Use `UnsafePointer` in `vector.mojo` As part of the migrating from `Pointer` to `UnsafePointer`, continue this in `vector.mojo`. This requires changing one bit to use `AnyType` rather than `AnyRegType` to play nicely with `UnsafePointer`. In the near future, we want to replace use of `AnyRegType` with `AnyType` throughout the library. --------- Co-authored-by: gabrieldemarmiesse <gabrieldemarmiesse@gmail.com> Closes #2377 MODULAR_ORIG_COMMIT_REV_ID: a9d3d17ea2dc2e092569829d632754c7c81a6a39
With this change I get a weird error:
That does seem like a compiler bug no? Those looks the same to me:
Maybe I'm missing something?