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

Macros that operate on attributes #8393

Closed
nikomatsakis opened this issue Aug 8, 2013 · 0 comments
Closed

Macros that operate on attributes #8393

nikomatsakis opened this issue Aug 8, 2013 · 0 comments
Assignees

Comments

@nikomatsakis
Copy link
Contributor

There is no way to write a macro that takes a list of attributes as input, like e.g. this one:


macro_rules! test ( ($nm:ident,
                     $a:inner_attr,
                     $i:item) => (mod $nm { $a $i }); )

test!(a,
      #[cfg(qux)],
      pub fn bar() { })

test!(b,
      #[cfg(not(qux))],
      pub fn bar() { })

#[qux]
fn main() {
    a::bar();
    //~^ ERROR use of undeclared module `a`
    //~^^ ERROR unresolved name
    //~^^^ ERROR unresovled name `a::bar`
    b::bar();
}

I need this for #3678, since I have a macro there for generating wrappers around extern fns and it needs attributes. Pull request forthcoming.

@ghost ghost assigned nikomatsakis Aug 8, 2013
flip1995 pushed a commit to flip1995/rust that referenced this issue Mar 24, 2022
`unnecessary_lazy_eval` show suggestions on multiline lint

Closes rust-lang#8393

changelog: [`unnecessary_lazy_eval`] now shows suggestions for long-line lints
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