Skip to content

New guideline to refer to names with global paths in a macro #76

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 20, 2025

Conversation

vapdrs
Copy link
Contributor

@vapdrs vapdrs commented May 14, 2025

As discussed in the 2025-05-07 meeting, a draft of this guideline was asked to be contributed. I'd be interested in any feedback, specifically for the release section, whose specification still seems in flux, and the rationale which I generated but am not sure if it captures the original idea contributor's purpose.

.. guideline:: Names in a macro definition shall use a global path
:id: gui_SJMrWDYZ0dN4
:category: advisory
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey 👋.
I think it should be mandatory because even a local use can easily shadow the intended path and cause unexpected behaviours,
Also not following this guideline will make your nacro non-deterministic and context-dependent.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the review. I'm willing to move this to required, especially if the $crate path prefix is also allowed for.

Moving it further to mandatory feels a bit strong, since I feel like there are exotic use cases for shadowing the paths inside of the macro. Right now I can't think of any patterns that use that though, so perhaps there aren't. I've updated category in 6698d44, feel free to let me know if you still think this should be mandatory.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes 'mandatory' feels quite strong, maybe this should be discussed in the next meeting.

Copy link
Collaborator

@PLeVasseur PLeVasseur left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @vapdrs -- thanks for contributing this guideline! Please take a look at the comments I left.

@PLeVasseur
Copy link
Collaborator

@vapdrs -- could you rebase? Then we can spin CI

@vapdrs vapdrs force-pushed the feature/macro-abs-modules branch from e0231a3 to 4809d14 Compare May 20, 2025 20:28
Copy link
Collaborator

@PLeVasseur PLeVasseur left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for putting this together @vapdrs! Looks good to me

@PLeVasseur PLeVasseur added this pull request to the merge queue May 20, 2025
Merged via the queue into rustfoundation:main with commit fbe0061 May 20, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants