Skip to content
This repository was archived by the owner on Feb 11, 2026. It is now read-only.

remove 'complete' feature flag, make it unconditional#131

Merged
tertsdiepraam merged 1 commit intouutils:mainfrom
BenWiederhake:dev-remove-complete-featureflag
Apr 15, 2025
Merged

remove 'complete' feature flag, make it unconditional#131
tertsdiepraam merged 1 commit intouutils:mainfrom
BenWiederhake:dev-remove-complete-featureflag

Conversation

@BenWiederhake
Copy link
Copy Markdown
Contributor

@BenWiederhake BenWiederhake commented Apr 12, 2025

This avoids using cfg with the destination-crate's feature "complete" in proc-macro "derive".

Quoting cargo:

using a cfg inside a derive macro will use the cfgs from the
destination crate and not the ones from the defining crate

In these two instances, the cfg was simply used to avoid emitting dead code if the "complete" feature is not desired. By passing the "complete" feature down to the derive crate and evaluating if there, we achieve the same goal, without having to deal with suprisingly-valued and unexpected cfgs downstream. (EDIT: this sentence was a copy-paste-error, my bad!)

Discovered while trying to integrate uutils-args into coreutils: https://github.com/uutils/coreutils/actions/runs/14420666926/job/40442804575?pr=7739

This is my preferred approach.

Alternatively, we could just evaluate the flag inside the derive crate, and pass the feature flag to it, as implemented in #132.

This avoids using cfg with the destination-crate's feature "complete"
in proc-macro "derive".

Quoting cargo:

    using a cfg inside a derive macro will use the cfgs from the
    destination crate and not the ones from the defining crate

In these two instances, the cfg was simply used to avoid emitting dead
code if the "complete" feature is not desired. By passing the "complete"
feature down to the derive crate and evaluating if there, we achieve the
same goal, without having to deal with suprisingly-valued and unexpected
cfgs downstream.

Alternatively, we could just evaluate the flag inside the derive crate,
and pass the feature flag to it.
@tertsdiepraam tertsdiepraam merged commit 48aae19 into uutils:main Apr 15, 2025
4 checks passed
@BenWiederhake BenWiederhake deleted the dev-remove-complete-featureflag branch April 15, 2025 13:11
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants