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

"name resolution" #16

Open
2 of 6 tasks
nikomatsakis opened this issue Jan 18, 2018 · 14 comments
Open
2 of 6 tasks

"name resolution" #16

nikomatsakis opened this issue Jan 18, 2018 · 14 comments
Labels
A-resolve Area: name resolution C-enhancement Category: enhancement E-hard Difficulty: might require advanced knowledge T-compiler Relevant to compiler team

Comments

@nikomatsakis
Copy link
Contributor

nikomatsakis commented Jan 18, 2018

We should be talking about the librustc_resolve crate works here. Some topics of interest:

@nikomatsakis nikomatsakis mentioned this issue Jan 18, 2018
20 tasks
@vorner
Copy link
Contributor

vorner commented Jan 18, 2018

Hello.

Could I have a try with this one? Few notes:

  • I don't know much about the compiler. But there's the name of the relevant crate in the instructions and I usually prefer learning on my own, so I'll try reading it through and if I have problems understanding, I'd ask for some help later on.
  • I can't really (yet) get an estimate on when I'd have something to show, with both not really knowing much about the subject and working on it during evenings after a day job.

@nikomatsakis
Copy link
Contributor Author

@vorner sounds good to me! One of the things I've been wrestling with, as an aside, is just how much detail this guide should go into. I don't think it should replace "in-code" comments -- that is, we don't want the material to become outdated very regularly. We'll have to feel our way.

To that end, I was thinking that perhaps a good place to start would be to dive into the code and try to add comments explaining how it works. This will of course be kind of "bottom up" -- at some point then we should be able to decide what of that material should go into guide, which should go into the code itself.

Anyway, let me know how things are going. I'll try to check in from time to time.

@vorner
Copy link
Contributor

vorner commented Jan 19, 2018

My idea was to do the comments in code (if I find places where the code isn't self-documenting and find them missing) and then try to write a high level picture with very little details. I guess it'll need some more iteration later on, and details can always be added.

@nikomatsakis
Copy link
Contributor Author

@vorner sounds perfect

@mark-i-m
Copy link
Member

Ping @vorner ?

Did you wish to continue iterating on this chapter?

@mark-i-m
Copy link
Member

Ping @vorner ?

@vorner
Copy link
Contributor

vorner commented Feb 15, 2018

Did you wish to continue iterating on this chapter?

Sorry, I was busy and missed the previous ping :-|.

Yes, I still want to have a second go through the code, put comments on there and polish the text in the chapter and possibly add some more details.

But if I'm taking too long, I'd definitely understand if someone else wants to take it over (though it seems there's plenty of other work available).

@mark-i-m
Copy link
Member

No worries!

I just was making sure you were still interested :)

@mark-i-m mark-i-m added the E-help-wanted Call for participation: extra help is wanted label Mar 4, 2018
@mark-i-m mark-i-m added the E-medium Difficulty: might require some prior knowledge or code reading label Mar 16, 2018
kennytm added a commit to kennytm/rust that referenced this issue Mar 26, 2018
…chenkov

Some comments and documentation for name resolution crate

Hello

I'm trying to get a grasp of how the name resolution crate works, as part of helping with rust-lang/rustc-dev-guide#16. Not that I'd be succeeding much, but as I was reading the code, I started to put some notes into it, to help me understand.

I guess I didn't get very far yet, but I'd like to share what I have, in case it might be useful for someone else. I hope these are correct (even if incomplete), but I'll be glad for a fast check in case I put something misleading there.
TimNN added a commit to TimNN/rust that referenced this issue Mar 26, 2018
…chenkov

Some comments and documentation for name resolution crate

Hello

I'm trying to get a grasp of how the name resolution crate works, as part of helping with rust-lang/rustc-dev-guide#16. Not that I'd be succeeding much, but as I was reading the code, I started to put some notes into it, to help me understand.

I guess I didn't get very far yet, but I'd like to share what I have, in case it might be useful for someone else. I hope these are correct (even if incomplete), but I'll be glad for a fast check in case I put something misleading there.
@demurgos
Copy link

demurgos commented Apr 5, 2018

Thank you for your work on this guide, it's really helpful.
I am currently trying to understand how name resolution works with cycles between types so it would be great if this was expanded. I think it relates to the following parts:

There are some exceptions to this. Items are bit tricky, because they can be used even before encountered ‒ therefore every block needs to be first scanned for items to fill in its Rib.

Other, even more problematic ones, are imports which need recursive fixed-point resolution and macros, that need to be resolved and expanded before the rest of the code can be processed.

@mark-i-m
Copy link
Member

Did you ever find out anything about this?

@vorner
Copy link
Contributor

vorner commented Apr 11, 2018

If it is question aimed at me, then no. Whatever I discovered through the code has been put into the text.

@mark-i-m
Copy link
Member

Thanks @vorner :) I actually meant the question for @demurgos

@varkor
Copy link
Member

varkor commented May 18, 2018

It says ribs were explained as part of #21, but that doesn't seem to be the case. I can't see them mentioned anywhere, including the glossary.

@mark-i-m
Copy link
Member

@varkor Sorry, should be #22. Updated above. Also, rib should probably be added the glossary.

IIRC each rib corresponds to a scope or namespace. For example, there is a rib for global names, a rib for items declared in module foo, a rib for names in function foo::bar, and so on...

@jieyouxu jieyouxu added E-hard Difficulty: might require advanced knowledge A-resolve Area: name resolution T-compiler Relevant to compiler team and removed E-medium Difficulty: might require some prior knowledge or code reading E-help-wanted Call for participation: extra help is wanted E-hard Difficulty: might require advanced knowledge A-resolve Area: name resolution T-compiler Relevant to compiler team labels Nov 3, 2024
@jieyouxu jieyouxu added C-enhancement Category: enhancement E-hard Difficulty: might require advanced knowledge A-resolve Area: name resolution T-compiler Relevant to compiler team labels Nov 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-resolve Area: name resolution C-enhancement Category: enhancement E-hard Difficulty: might require advanced knowledge T-compiler Relevant to compiler team
Projects
None yet
Development

No branches or pull requests

6 participants