Skip to content

Apply target filtering to payload variant declarations #477

Closed

Description

@LunaStev

Problem

#[target(...)] filtering does not recognize variant as a declaration that can be skipped. An inactive variant leaves its body tokens at top level and causes a parse error.

#[target(os="windows")]
variant Hidden {
    Value(i32),
}

fun main() -> i32 { return 0; }

Checking this on Linux with current master plus PR #474 fails on Value even though the entire declaration is inactive. front/parser/src/import.rs has a declaration-kind list for target filtering, but variant is missing from it.

This breaks cross-target source portability and should be fixed before alpha.

Scope

  • Add variant to declaration-level target filtering.
  • Audit the list against every supported top-level declaration kind.
  • Add positive and negative tests for inactive and active payload variants.
  • Cover imported files as well as the root source.

Acceptance criteria

  • The reproducer checks on Linux without exposing the inactive variant body.
  • The same declaration remains available and fully validated on a matching Windows target.
  • Every top-level declaration kind has target-filter regression coverage.

Related: #347, #474

Activity

  1. added
    bug
    good first issue
    needs testing
    cross-platform
    on Sep 5, 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

    bugcross-platformgood first issueneeds testing

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions