-
Notifications
You must be signed in to change notification settings - Fork 564
Add section on expansion-time (early) name resolution #2055
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
base: master
Are you sure you want to change the base?
Conversation
|
Thanks for posting. Lot of good here. The main thing I'd suggest, by way of helping to sharpen this up, would be to try to write a concise example after each claim, in as many cases as that might make sense, that demonstrates that the claim is true (and would not pass if the claim were false). Aside from the intrinsic benefit of having such examples, I think this might help to focus the text on the language-level effects. (It's not surprising, given the good research you've been doing, that some bits of this currently have some "description of the implementation" flavor.) |
yaahc
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a fair number of comments are also contained inline in the documents
src/names/name-resolution.md
Outdated
| * .visitation-order | ||
| * derive helpers | ||
| * not visited when resolving derive macros in the parent scope (starting scope) | ||
| * derive helpers compat |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same concern as above about this being deprecated and removed next year.
This comment has been minimized.
This comment has been minimized.
|
@ehuss and I are looking at this together on the lang-docs office hours call, and we just wanted to express our appreciation to @petrochenkov for having been so responsive with @yaahc on working out the details here. This is a chapter that we've long wanted to exist, and we're thrilled and appreciative that @yaahc is digging in to shape this up. |
5397d08 to
1bd3afe
Compare
80fd707 to
570bedd
Compare
79bf489 to
71275de
Compare
f8b5ce9 to
74516a6
Compare
ef0932f to
61a0cf1
Compare
|
Something I'm missing is a discussion about blocks, and how they can introduce essentially an anonymous module ( mod bar {
pub struct Name;
}
mod baz {
pub struct Name;
}
use baz::Name;
pub fn foo() {
use bar::*;
Name; // resolves to bar::Name
}I think the reason it resolves to mod bar {
pub struct Name;
}
mod baz {
pub struct Name;
}
use baz::Name;
use bar::*;
pub fn foo() {
Name; // resolves to baz::Name
}If we were to ignore blocks, and pretend they don't exist from a module-hierarchy perspective, I would expect both these examples to be the same. I'm not sure if I'm understanding this correctly, since resolution within a block still "sees" everything outside of the block (inside it's module). |
08596c4 to
dceb962
Compare
ee84f4c to
ecea463
Compare
Co-authored-by: Vadim Petrochenkov <vadim.petrochenkov@gmail.com> Co-authored-by: Eric Huss <eric@huss.org> Co-authored-by: Tshepang Mbambo <hopsi@tuta.io>
|
Thanks to @yaahc for joining us on the lang-docs office hours today to speedrun many revisions to this chapter, which is really shaping up. |
Add test for derive helper compat collisions Resolves rust-lang/reference#2055 (comment) r? `@petrochenkov`
Add test for derive helper compat collisions Resolves rust-lang/reference#2055 (comment) r? `@petrochenkov`
Add test for derive helper compat collisions Resolves rust-lang/reference#2055 (comment) r? `@petrochenkov`
currently mostly a skeleton of a draft so we can collaboratively massage it into shape more easily before filling in with proper reference verbiage.
hoping to take a significant chunk out of #568