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

Implement auto-ref #5

Open
dtolnay opened this issue May 27, 2018 · 0 comments
Open

Implement auto-ref #5

dtolnay opened this issue May 27, 2018 · 0 comments

Comments

@dtolnay
Copy link
Owner

dtolnay commented May 27, 2018

If a library method is declared to take self by reference or mut reference and the user's macro invokes the method with a receiver that is not a reference, it would be good to mirror rustc's rules around automatically taking a reference to the receiver.

library! {
    extern crate krate {
        type Struct;

        impl Struct {
            fn method(&self);
        }
    }
}

let receiver = /* ... by value */;
RUNTIME::krate::Struct::method.INVOKE(receiver.reference()); // should not require reference()
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