Skip to content

Config readability and current dependency on cfg_aliases #9559

Open
0 of 1 issue completed
Open

Description

@ChrisDryden

I'm still working on getting a sense of all of the dependencies in this package to see where some opportunities arise in reducing the dependency set and I came across the dependency we have on cfg_aliases though the nix project. It is used extensively in that project because of the platform specific nature of their code and the many cfg statements.

We have a similar setup where for example in the stty package we have this all over the place:

    #[cfg(not(any(
        target_os = "freebsd",
        target_os = "dragonfly",
        target_os = "ios",
        target_os = "macos",
        target_os = "netbsd",
        target_os = "openbsd"
    )))]

As the reader of the code for me its not immediately apparent when reading this why this statement is included all over the place and being unfamiliar with dragonfly I was unaware that the detail shared with all of these platforms is that they are BSD.

The way this dependency works is that you define in the build.rs something like:

cfg_aliases! {
    bsd_platform: { any(target_os = "freebsd", target_os = "dragonfly", target_os = "ios", target_os = "macos", target_os = "netbsd", target_os = "openbsd")) },
}

and then in the code itself you use:

#[cfg(not(bsd_platform)))]

The onboarding to do something like this isn't that difficult but wanted to first see if this was something the maintainers were interested in doing?

Activity

  1. oech3 commented on Dec 5, 2025

    @oech3
    Contributor

    I agree with it because it makes .rs easy to patch or sed too.

  2. oech3 commented on Dec 5, 2025

    @oech3
  3. self-assigned this
    on Oct 22, 2026
  4. xtqqczze commented on Oct 23, 2026

    @xtqqczze
    Collaborator

    I'm going to work on this, starting with #15634.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions