Skip to content

Commit

Permalink
[mojo-stdlib] Mark Origin register passable.
Browse files Browse the repository at this point in the history
This marks the type as register_passable and tidies it up a bit.
Doing so allows it to be used with the legacy `T{..}` initializer
syntax, which is handy for various workarounds.

MODULAR_ORIG_COMMIT_REV_ID: 9ee5247be330d992e5207eca041532bb10c34600
  • Loading branch information
lattner authored and modularbot committed Nov 25, 2024
1 parent b9e6169 commit 0f65571
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions stdlib/src/builtin/type_aliases.mojo
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,13 @@ alias OriginSet = __mlir_type.`!lit.origin.set`
"""A set of origin parameters."""


# Helper to build a value of !lit.origin type.
# TODO: Should be a parametric alias.
@value
@register_passable("trivial")
struct Origin[is_mutable: Bool]:
"""This represents a origin reference of potentially parametric type.
TODO: This should be replaced with a parametric type alias.
"""This represents a origin reference for a memory value.
Parameters:
is_mutable: Whether the origin reference is mutable.
is_mutable: Whether the origin is mutable.
"""

alias type = __mlir_type[
Expand Down

0 comments on commit 0f65571

Please sign in to comment.