Skip to content

Do not discard target conditions when attributes are stacked #1111

Open

Description

@LunaStev

Problem

When two target attributes precede an item, an inactive first condition can consume only the next attribute line, leaving the function unconditional.

Reproduction and evidence

Audited canonical master 69a67c6e0fb700f37ee6114f5a66d37ee13771a5 (0.0.1-alpha-dev). Matching checkout-built compiler/std were used for compiler probes on Linux amd64 with Rust 1.89.0 and LLVM 21.1.8. Artifact inspection, mocked/projection checks and foreign-target object emission are identified below and are not native execution on those operating systems.

#[target(os="windows")]
#[target(arch="x86_64")]
fun omitted()->i32{return 7;}
fun main()->i32{return omitted();}
target/debug/wavec --std-root "$PWD/std" build repro.wave --emit=check
target/debug/wavec --std-root "$PWD/std" build repro.wave --emit=ir --out-dir out

Observed on Linux x86_64: both commands succeed and IR contains omitted(), despite its Windows-only first attribute. This does not assume stacked attributes are already an approved syntax; unsupported combinations must fail closed rather than erase a condition.

Scope

Decide stacked target syntax and preserve every applicable condition or reject the combination explicitly.

Starting points: front/parser/src/import.rs:1.

Design discussion required

Recommended if stacking is supported: combine conditions with AND. Alternative: reject repeated target attributes with a source diagnostic. Make the grammar/policy choice before implementation.

Please mention @LunaStev to discuss the design before starting implementation.

Completion criteria

  • A false condition never silently becomes unconditional code.
  • Cover false/true permutations, more than two attributes and following declarations.
  • Preserve the current single-attribute behavior and source coordinates.

Related: #729, #950. Related broad trackers or completed implementations are context, not claims that their entire scope is unfinished.

Activity

  1. added
    bug
    discussion
    on Nov 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugdiscussion

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions