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

RFC: Resolve ::foo::... when compiling the crate named foo #110

Closed
wants to merge 1 commit into from

Conversation

kmcallister
Copy link
Contributor

No description provided.

@alexcrichton
Copy link
Member

This seems like it may be the wrong solution for a very real problem. You'll notice that all of the facade crates have an inner mod std module for the same reason the standard library does, but this solution would only affect the standard library, not any of the other crates.

This is exactly what macro hygiene is supposed to solve, and pasting another resolve solution on top may not be the best approach for tackling it in the interim.

@kmcallister
Copy link
Contributor Author

Hm, good point. The facade pattern seems pretty unusual, though. Do you expect that users of Rust, as opposed to Rust itself, will encounter similar situations?

@alexcrichton
Copy link
Member

I would imagine that requiring hygiene will show up quite frequently for all users of rust using macros in one form or another, but the specific facade use case is quite rare because the compiler is the one with the deriving implementations, not a library.

That said, all users of libcore and friends without using libstd suffer from this problem as well, and likely have their own workarounds to fix it.

@wycats
Copy link
Contributor

wycats commented Jun 21, 2014

This problem occurs if you define a macro for use both inside a crate and to import into other crates that needs to use a define defined in the crate.

@alexcrichton
Copy link
Member

This was discussed at the triage meeting today. While the motivation is definitely valid, we feel that this RFC specifically may not be the best solution to the problem. There are a few surprises such as not all crate names are valid rust identifiers, and it may be desired to extend this to modules at some point in the future as well.

For now, I'm going to close this, and not mark it as postponed. This is a very real problem, however, and it would be very nice to have a hygiene-based solution!

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

Successfully merging this pull request may close these issues.

3 participants