Skip to content
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

Hide internal macros from public interface #755

Merged
merged 1 commit into from
May 6, 2022
Merged

Conversation

jsdw
Copy link
Collaborator

@jsdw jsdw commented May 6, 2022

The title says it all :)

@jsdw jsdw requested a review from a team as a code owner May 6, 2022 14:20
@@ -11,19 +10,19 @@ macro_rules! cfg_feature {

macro_rules! cfg_client {
($($item:item)*) => {
$crate::cfg_feature!("client", $($item)*);
cfg_feature!("client", $($item)*);
Copy link
Collaborator Author

@jsdw jsdw May 6, 2022

Choose a reason for hiding this comment

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

I wasn't sure without trying, but things seem to work fine without properly namespacing the macro!

Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm, here be dragons. I think there are situations when this will not work well, but can't remember what the full story was. $crate::macros::cfg_feature! should work though right?

@@ -1,4 +1,3 @@
#[macro_export]
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It's this macro_export which makes the macro part of the public interface I believe.

@@ -11,19 +10,19 @@ macro_rules! cfg_feature {

macro_rules! cfg_client {
($($item:item)*) => {
$crate::cfg_feature!("client", $($item)*);
cfg_feature!("client", $($item)*);
Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm, here be dragons. I think there are situations when this will not work well, but can't remember what the full story was. $crate::macros::cfg_feature! should work though right?

@niklasad1
Copy link
Member

Hmm, here be dragons. I think there are situations when this will not work well, but can't remember what the full story was. $crate::macros::cfg_feature! should work though right?

should be alright because they are internal anyway, so if it works in the CI that should be sufficent

@niklasad1
Copy link
Member

Great James, I looked at the generated docs and looks good :)

@niklasad1 niklasad1 merged commit ad429c7 into master May 6, 2022
@niklasad1 niklasad1 deleted the jsdw-hide-macros branch May 6, 2022 18:37
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