This repository was archived by the owner on Feb 11, 2026. It is now read-only.
Make 'complete' available to procmacro's output by conversion to module#135
Merged
tertsdiepraam merged 1 commit intouutils:mainfrom Apr 16, 2025
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR converts
completefrom a separate crate to a module, and makes it available viapub mod complete. This way, callers can use e.g.uutils_args::complete::Valuewithout having to declare an additional dependency on the (former)uutils_args_completecrate.Background: Using a proc-macro like
#[derive(Arguments)]injects code that is evaluated in the context of the destination crate. In some cases, the proc-macros inderiveinject a direct access to something in the (former) crateuutils_args_complete. This doesn't work if the destination crate doesn't add it as an explicit dependency, leading to compilation errors:There are multiple ways to resolve this issue:
completesomehow available through uutils-args itself, e.g. at the pathuutils_args::complete::*, and use that path when injecting code in our derive macro.There are two ways to make it available:
pub extern crate uutils_args_complete as complete;or some abomination like that.completea separate crate, and merge it as a module. This gets rid of some redundant metadata, and simplifies the structure, in my eyes.This PR uses Option 2b. In fact, since #131 makes
completea non-optional dependency anyway, I don't see a point in keeping it a separate crate.Most changes are very boring:
s/::uutils_args_complete/::uutils_args::complete/gand within the (former) cratecomplete, the stringcrate::becomescrate::complete::. The rest is just formatting. That's it.