IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /docs/manual/basics.md). For the complete Mojo documentation index, see llms.txt.
Skip to main content
Version: Nightly
For the complete Mojo documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /docs/manual/basics.md).

TrivialRegisterPassable

A marker trait to denote the type to be register passable trivial.

The compiler treats the type that conforms to this trait with the following constraints:

  • The type implicitly conforms to Copyable and the compiler synthesizes copy ctor that does a memcpy.
  • A trivial __deinit__ member is synthesized by the compiler too, so the type can’t be a linear type.
  • All declared members are required to also conforms to this trait, since you can’t memcpy or trivially destroy a container if one of its stored members has a non-trivial copy constructor.
  • You are not allowed to define a custom copy ctor or __deinit__.
struct Foo(TrivialRegisterPassable):
...

Implemented traits

AnyType, Copyable, Deinitable, ImplicitlyCopyable, Movable, RegisterPassable