Skip to content

CEP-0030: Attribute Target Expansion

Draft

Draft proposal for attribute targets beyond V1 declarations, fields, parameters, impls, and type constructors.

Summary

Catalyst should eventually decide whether attributes can target local variables, expressions, statements, call arguments, or arbitrary type-use sites.

V1 keeps attribute targets limited to a small set of semantic declarations and type constructors.

Example

Possible future shape:

fn render(input: []const f32) {
  @local_note("scratch size kept for instrumentation")
  const scratch = input.len()

  output.write(@likely input.len() > 0)
}

The proposal must decide how local-variable and expression attributes are parsed, reflected, lowered, and diagnosed.

Motivation

Broader attribute targets can express optimization hints, diagnostics, lint controls, ABI details, or tooling metadata at finer granularity. They also complicate parsing, lowering, reflection, and source ownership.

Proposed Direction

The proposal should cover:

  • local variable attributes;
  • expression and statement attributes;
  • call-argument attributes;
  • arbitrary type-use attributes;
  • target-kind reflection;
  • ordering and conflict rules;
  • lowering and diagnostics for attributes attached to non-declaration syntax.

V1 Compatibility

V1 rejects expression, statement, local variable, call argument, and arbitrary type-use attributes.