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

Can't use same self expression in macro in two methods with differing self mutability #7911

Closed
jdm opened this issue Jul 19, 2013 · 1 comment · Fixed by #11965
Closed

Can't use same self expression in macro in two methods with differing self mutability #7911

jdm opened this issue Jul 19, 2013 · 1 comment · Fixed by #11965
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@jdm
Copy link
Contributor

jdm commented Jul 19, 2013

macro_rules! generate_node_base(($type_:path, $field:expr) => (
    impl<View> NodeBase<View> for $type_ {
        fn base_node(&self) -> &Node<View> {
            unsafe { cast::transmute(&$field) }
        }

        fn base_node_mut(&mut self) -> &mut Node<View> {
            unsafe { cast::transmute(&mut $field) }
        }
    }
))

This macro causes an ICE of No type for local variable 49656 when invoked like generate_node_base!(Comment, self.parent.parent). When I make the macro take two different expressions (using the second in the second method) and invoke it like generate_node_base!(Comment, self.parent.parent, self.parent.parent), it works fine.

@graydon
Copy link
Contributor

graydon commented Aug 22, 2013

possibly the same bug as #6000 ? I.e. that macros are not making separate copies of ASTs when spliced into multiple locations in the result?

@bors bors closed this as completed in 5c5d995 Feb 1, 2014
flip1995 pushed a commit to flip1995/rust that referenced this issue Nov 4, 2021
…ticks, r=Manishearth

Small fixes for missing backticks in doc

changelog: none
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants