Skip to content

Macro-expanded macro definitions can be used even if they are unconfigured #32764

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

Closed
jseyfried opened this issue Apr 6, 2016 · 3 comments
Closed

Comments

@jseyfried
Copy link
Contributor

For example, this compiles:

macro_rules! bar {
    {} => {
        #[cfg(foo)]
        macro_rules! baz { () => {} }
    }
}

bar! {}

fn main() { baz!(); }

If we replaced bar! {} with its expansion, #[cfg(foo)] macro_rules! { baz { () => {} } }, the example wouldn't compile.

@jseyfried
Copy link
Contributor Author

I think we should fix this by removing unconfigured items after each macro expansion pass since we'll have to do this anyway to get accurate name resolution during macro expansion.

cc @nrc

@durka
Copy link
Contributor

durka commented Apr 6, 2016

Same as #22250?

@jseyfried
Copy link
Contributor Author

@durka yeah, closing in favor of #22250.

@jseyfried jseyfried changed the title Macro-expanded procedural macros can be used even if they are unconfigured Macro-expanded macro definitions can be used even if they are unconfigured Jun 1, 2016
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