Skip to main content

Attribute Registry

All standard attributes, organised by purpose. Each row lists the attribute, its valid targets, and a one-line semantics.

Derive

AttributeTargetsSemantics
@derive(Clone)typegenerate Clone impl
@derive(Copy)typemark as Copy (requires all fields Copy)
@derive(Debug)typegenerate Debug::debug
@derive(Display)typegenerate Display::format
@derive(Eq, PartialEq)typegenerate equality
@derive(Ord, PartialOrd)typegenerate ordering (lexical)
@derive(Hash)typegenerate Hash
@derive(Default)typegenerate Default (fields must impl Default)
@derive(Serialize)typegenerate serialisation
@derive(Deserialize)typegenerate deserialisation
@derive(Builder)typegenerate fluent builder
@derive(Error)typegenerate Error impl with Display delegation
@derive(From<T>)typegenerate From<T> conversion (one-field newtypes)
@derive(Into<T>)typedual of From<T>

Layout

AttributeTargetsSemantics
@repr(C)typeC-compatible layout, no reordering
@repr(transparent)type (one field)identical layout to inner
@repr(align(N))typeforce alignment to N
@repr(packed)typeno padding between fields
@repr(u8/u16/u32/u64)variantsum-type discriminant size

Verification

The @verify attribute takes a semantic strategy — the underlying solver (the SMT backend, portfolio, …) is an implementation detail picked by the capability router. The full set admitted by the grammar:

AttributeTargetsSemantics
@verify(runtime)fn, typeruntime assertion check only; no formal proof
@verify(static)fn, typestatic type-level verification only
@verify(formal)fn, typeformal verification with the default strategy (recommended)
@verify(proof)fn, typealias of formal, emphasising proof extraction
@verify(fast)fn, typeoptimise for fast verification; may sacrifice completeness on hard goals
@verify(thorough)fn, typemaximum completeness; races multiple strategies, returns the first success
@verify(reliable)fn, typealias of thorough, emphasising result reliability
@verify(certified)fn, typeindependently cross-verified; required for proof-certificate export (Coq/Lean/Dedukti/Metamath)
@verify(synthesize)fn, typesynthesis mode — generate a term satisfying the spec rather than checking it

Project-wide defaults and per-module overrides live in the [verify] section of verum.toml — see reference → verum.toml.

FFI

AttributeTargetsSemantics
@extern("C")fn, extern blockC linkage
@extern("C", calling_convention = "X")fnoverride calling convention
@ownership(transfer_to = "caller" | "callee")ffi itemownership transfer at boundary
@ownership(borrow = [...])ffi itemparams are borrowed, not transferred

Target & dispatch

AttributeTargetsSemantics
@device(cpu)fnrun on CPU (default, usually implicit)
@device(gpu)fnroute through MLIR GPU pipeline — triggers VbcToMlirGpuLowering in Phase 7
@gpu.kernelfnmark as a GPU kernel (implies @device(gpu)) with kernel-launch semantics
@differentiablefnsynthesise a VJP companion in Phase 4a autodiff
@thread_localstaticper-thread storage
@nakedfnno prologue / epilogue (assembly trampolines only)
@intrinsic("name")fncompiler-provided primitive (forward decl)

Optimisation

AttributeTargetsSemantics
@inlinefnsuggest inlining
@inline(always)fnforce inlining
@inline(never)fnforbid inlining
@hotfnmark as hot path; bias optimisation / layout
@coldfnmark as cold path; bias away
@vectorize(lanes = N)fnrequest SIMD vectorisation
@unroll(factor = N)fnrequest loop unrolling
@multiversionfnemit multiple versions for CPU feature dispatch
@link_section("name")fn, staticplace into a named section
@no_manglefn, staticdisable name mangling

Testing

AttributeTargetsSemantics
@testfnregister as a unit test
@test(property)fnproperty-based test
@test(ignore)fnskip in normal runs
@benchfnregister as a benchmark
@fuzzfnregister as a fuzz target

Conditional compilation

AttributeTargetsSemantics
@cfg(feature = "X")anyinclude if feature X is enabled
@cfg(target_os = "X")anyOS guard
@cfg(target_arch = "X")anyarchitecture guard
@cfg(debug_assertions)anydebug-only
@cfg(not(X)), @cfg(any(...)), @cfg(all(...))anycompose

Parameters & fields

AttributeTargetsSemantics
@unusedparamsilence unused-param warnings
@must_usefn, type, fieldwarn if result is discarded
@validate(min = X, max = Y)fieldderive a refinement
@validate(matches = rx#"...")fieldregex validation
@serialize(rename = "...", skip, skip_if_null)fieldserialisation control
@deserialize(default, alias = "...")fielddeserialisation control

Meta

AttributeTargetsSemantics
@const exprexprforce compile-time evaluation
@meta_macrometa fnexpose as a callable @name(...) macro
@tacticmeta fnexpose as a proof tactic
@logicfnmark as reflection-eligible
@llvm_onlyfncannot run in VBC interpreter
@requires_runtimefnneeds a specific runtime feature

Documentation

AttributeTargetsSemantics
@doc("...")anydocumentation comment
@doc(hidden)anyexclude from generated docs
@deprecated(since = "...", note = "...")anymark deprecated

Miscellaneous

AttributeTargetsSemantics
@stdanystandard library marker
@internalanyinternal-only (ignored by verum doc)
@specializeimplspecialisation instance
@universe_polyfn, typeenable universe polymorphism
@cap(name = "X", domain = "Y")fndeclares a capability it holds

Custom attributes

User-defined via @meta_macro (see Language → metaprogramming).

See also