From 0f655714fa726e6661dbdfdc7f6df0c0b3d245c8 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sun, 24 Nov 2024 15:03:47 -0800 Subject: [PATCH] [mojo-stdlib] Mark Origin register passable. 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 --- stdlib/src/builtin/type_aliases.mojo | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/stdlib/src/builtin/type_aliases.mojo b/stdlib/src/builtin/type_aliases.mojo index f255368e96..5bbee8d763 100644 --- a/stdlib/src/builtin/type_aliases.mojo +++ b/stdlib/src/builtin/type_aliases.mojo @@ -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[