Skip to content

Commit

Permalink
update after fix
Browse files Browse the repository at this point in the history
Signed-off-by: martinvuyk <martin.vuyklop@gmail.com>
  • Loading branch information
martinvuyk committed Feb 28, 2025
1 parent 3deb91d commit 6f5acc2
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 23 deletions.
19 changes: 8 additions & 11 deletions mojo/stdlib/src/memory/pointer.mojo
Original file line number Diff line number Diff line change
Expand Up @@ -341,17 +341,14 @@ struct Pointer[
"""
self._value = _mlir_value

# FIXME(#3617)
# @always_inline("nodebug")
# fn __init__(
# inout self, *, ref [origin, address_space._value.value]to: type
# ):
# """Create a pointer with the input value.

# Args:
# to: The value to construct a pointer to.
# """
# self = Self(_mlir_value=__get_mvalue_as_litref(to))
@always_inline("nodebug")
fn __init__(out self, *, ref [origin, address_space._value.value]to: type):
"""Constructs a Pointer from a reference to a value.
Args:
to: The value to construct a pointer to.
"""
self = Self(_mlir_value=__get_mvalue_as_litref(to))

@staticmethod
@always_inline("nodebug")
Expand Down
8 changes: 3 additions & 5 deletions mojo/stdlib/src/memory/unsafe_pointer.mojo
Original file line number Diff line number Diff line change
Expand Up @@ -128,11 +128,9 @@ struct UnsafePointer[
"""
self.address = value

@always_inline
fn __init__(
inout self, *, ref [origin, address_space._value.value]to: type
):
"""Create a pointer with the input value.
@always_inline("nodebug")
fn __init__(out self, *, ref [origin, address_space._value.value]to: type):
"""Constructs a Pointer from a reference to a value.
Args:
to: The value to construct a pointer to.
Expand Down
7 changes: 2 additions & 5 deletions mojo/stdlib/test/memory/test_pointer.mojo
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,8 @@ def test_str():


def test_pointer_to():
# FIXME(#3617)
# var local = 1
# assert_not_equal(0, int(Pointer(to=local)))
# _ = local
...
var local = 1
assert_not_equal(0, Pointer(to=local)[])


def main():
Expand Down
3 changes: 1 addition & 2 deletions mojo/stdlib/test/memory/test_unsafepointer.mojo
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,7 @@ def test_address_of():

def test_pointer_to():
var local = 1
assert_not_equal(0, int(UnsafePointer(to=local)))
_ = local
assert_not_equal(0, UnsafePointer(to=local)[])


def test_explicit_copy_of_pointer_address():
Expand Down

0 comments on commit 6f5acc2

Please sign in to comment.