-
Notifications
You must be signed in to change notification settings - Fork 13.4k
error: macros cannot expand to foreign items #5668
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
I should at least include some code. Here's some code:
|
Nominating for milestone 5, production-ready |
Visiting for triage. My nomination vote goes with "feature complete"; this is a proper (if minor) feature. Unless it's implemented-and-buggy currently? |
accepted for feature-complete milestone |
This need not block 1.0. Assigning P-low. |
Triage bump (still an issue). |
still an issue. |
My own use case is I have a bunch of external functions like: extern {
pub fn manager_node_is_listening_device(manager: *mut Manager, home_id: u32, node_id: u8) -> bool;
pub fn manager_node_is_frequent_listening_device(manager: *mut Manager, home_id: u32, node_id: u8) -> bool;
pub fn manager_node_is_beaming_device(manager: *mut Manager, home_id: u32, node_id: u8) -> bool;
} and I wanted to be more DRY: macro_rules! node_getters {
( $($name: ident -> $t: ty),+ ) => {
$(pub fn $name(manager: *mut Manager, home_id: u32, node_id: u8) -> $t;)*
}
}
extern {
node_getters! {
manager_node_is_listening_device -> bool,
manager_node_is_frequent_listening_device -> bool,
manager_node_is_beaming_device -> bool
}
} (Note I have a bunch of more functions too) |
Triage: no comments in two years, and |
Macros work in foreign blocks now, but they are not yet stable and gated by |
I'm assuming this is supposed to be in the language, but not yet supported. I'm hoping to support it. Placeholder bug.
The text was updated successfully, but these errors were encountered: