Created
October 26, 2014 02:12
-
-
Save gifnksm/41c8f65844b31d1f8240 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct Doc; | |
#[cfg(not(phantom))] | |
struct Node<'a> { | |
doc: &'a Doc | |
} | |
#[cfg(phantom)] | |
struct Node<'a>; | |
impl Doc { | |
#[cfg(phantom)] | |
fn node<'a>(&'a self) -> Node<'a> { | |
Node | |
} | |
#[cfg(not(phantom))] | |
fn node<'a>(&'a self) -> Node<'a> { | |
Node { doc: self } | |
} | |
} | |
fn main() { | |
let node; | |
{ | |
let doc = Doc; | |
node = doc.node(); | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment