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

Use vis meta-variable is macros #79

Open
ratijas opened this issue May 22, 2020 · 0 comments
Open

Use vis meta-variable is macros #79

ratijas opened this issue May 22, 2020 · 0 comments

Comments

@ratijas
Copy link
Contributor

ratijas commented May 22, 2020

Declarative macros like the one below could use the relatively new visibility aka :vis macro meta-variable instead of manual pub($tt*) etc. It had some issues in past, but now it's mostly fixed and safe to use.

rust-cpp/cpp/src/lib.rs

Lines 348 to 358 in 46c1f8d

macro_rules! cpp_class {
($(#[$($attrs:tt)*])* unsafe struct $name:ident as $type:expr) => {
$crate::__cpp_class_internal!{@parse [ $(#[$($attrs)*])* ] [] [unsafe struct $name as $type] }
};
($(#[$($attrs:tt)*])* pub unsafe struct $name:ident as $type:expr) => {
$crate::__cpp_class_internal!{@parse [ $(#[$($attrs)*])* ] [pub] [unsafe struct $name as $type] }
};
($(#[$($attrs:tt)*])* pub($($pub:tt)*) unsafe struct $name:ident as $type:expr) => {
$crate::__cpp_class_internal!{@parse [ $(#[$($attrs)*])* ] [pub($($pub)*)] [unsafe struct $name as $type] }
};
}

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

No branches or pull requests

1 participant