-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
accessing private struct member in a macro triggers compiler panic #25386
Labels
I-ICE
Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Comments
steveklabnik
added
the
I-ICE
Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
label
May 18, 2015
This still causes an ICE A complete test case: mod stuff {
pub struct Item {
c_object: Box<CObj>,
}
pub struct CObj {
name: Option<String>,
}
impl Item {
pub fn new() -> Item {
Item {
c_object: Box::new(CObj { name: None }),
}
}
}
}
macro_rules! check_ptr_exist {
($var:expr, $member:ident) => (
(*$var.c_object).$member.is_some()
);
}
fn main() {
let item = stuff::Item::new();
println!("{}", check_ptr_exist!(item, name));
} |
I can't reproduce it with |
Here's the compiler output:
|
Closed
Triage: this still causes an ICE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Using this macro:
The text was updated successfully, but these errors were encountered: