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

make type modifiers usable for macro substitution #285

Closed
rust-highfive opened this issue Sep 24, 2014 · 1 comment
Closed

make type modifiers usable for macro substitution #285

rust-highfive opened this issue Sep 24, 2014 · 1 comment

Comments

@rust-highfive
Copy link

Issue by metajack
Friday Apr 05, 2013 at 21:04 GMT

For earlier discussion, see rust-lang/rust#5748

This issue was labelled with: A-syntaxext, B-RFC in the Rust repository


Currently you can not pass @ or ~ or @mut to a macro by itself, but this would be useful in a few cases. I tried doing this to add Clone trait implementations without copying the code:

macro_rules! ptr_clone_impl(
    ($p:something) => {
        impl<T:Clone> Clone for $p T {
            #[inline(always)]
            fn clone(&self) -> $p T { $p (**self).clone() }
        }
    }
)

ptr_clone_impl!(~)
ptr_clone_impl!(@)
ptr_clone_impl!(@mut)

But as far as I can tell there is no fragment specifier that will work for those tokens.

@alexcrichton
Copy link
Member

We don't really have sigils now, so I think this is no longer relevant

wycats pushed a commit to wycats/rust-rfcs that referenced this issue Mar 5, 2019
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

2 participants