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

Cannot find macro from subcrate #58914

Closed
Dylan-DPC-zz opened this issue Mar 4, 2019 · 3 comments
Closed

Cannot find macro from subcrate #58914

Dylan-DPC-zz opened this issue Mar 4, 2019 · 3 comments
Labels
A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..) A-resolve Area: Name/path resolution done by `rustc_resolve` specifically T-lang Relevant to the language team, which will review and decide on the PR/issue.

Comments

@Dylan-DPC-zz
Copy link

Setup:

You have a workspace, with one subcrate. The subcrate contains a macro (which is exported).

The main crate in the workspace uses the subcrate as a dependency, but it cannot resolve the macro by importing it with use (the 2018 edition way)

Here is a PoC: https://github.com/Dylan-DPC/macros-workspace-test

Rust version: 1.33.0 (stable)
Edition: 2018

@petrochenkov
Copy link
Contributor

use subcrate::macros::foo -> use subcrate::foo.
macro_export-ed macros are placed into the crate root rather than into the module they are defined in.

AFAIR, the latter was considered during macro import stabilization, but it was too late for a breaking change that large.

@jonas-schievink jonas-schievink added A-resolve Area: Name/path resolution done by `rustc_resolve` specifically A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..) T-lang Relevant to the language team, which will review and decide on the PR/issue. labels Mar 4, 2019
@Dylan-DPC-zz
Copy link
Author

Thanks. Will try this and get back to you

@Dylan-DPC-zz
Copy link
Author

closing this since it is intended behaviour

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..) A-resolve Area: Name/path resolution done by `rustc_resolve` specifically T-lang Relevant to the language team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

3 participants