-
Notifications
You must be signed in to change notification settings - Fork 777
More fixes for Stylo #640
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
More fixes for Stylo #640
Conversation
We have a couple knobs to turn for item resolution, such as whether we keep going through type references and type aliases. It makes sense to have a single, easy place to configure these knobs.
This commit adds a bunch of debug logging to the template type parameters analysis. I've essentially adding this same code and then never committed it, like three or four different times. Because I keep re-writing it, I think it is worth keeping around in a more permanent fashion.
This commit makes the test-one.sh script log the input header as well as the emitted bindings to stdout.
In stylo bindings generation, we were hitting bugs where the analysis saw a template type parameter behind a type ref to a type alias, and this was then used as an argument to a template instantiation. Because of the indirection, the analysis got confused and ignored the template argument because it was "not" a named template type, and therefore we didn't care about its usage. This commit makes sure that we keep resolving through type references and aliases to find the inner named template type parameter to add to the current item's usage set. Fixes rust-lang#638.
…nctions The method was getting fairly large, and it is a little easier to read if we break it down into smaller parts.
It had some incorrectness where there was a difference between the abstract `self_template_param_usage` and `template_param_usage` functions. In reality, they are different cases of the same function. The comment was misleading in that it implied that we run both on the same IR item, when in fact we will only run one or the other. I've tried to make it more clear in the new version of the comment.
The trait is all about accessing template parameters, and is also implemented for things that are not template declarations or definitions, but do end up using template parameters one way or another. The new name makes more sense.
Organizationally, it makes more sense.
emilio
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.
Awesome :)
src/ir/named.rs
Outdated
| // parameters, but we can push the issue down the line to them. | ||
| Some(&TypeKind::TemplateInstantiation(ref inst)) | ||
| if !self.whitelisted_items.contains(&inst.template_definition()) => { | ||
| debug!(" instantiation of blacklisted template, uses all template \ |
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.
These should probably be trace!, but no big deal.
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.
Is trace! a lower level than debug!? If so, then yes I can definitely do that
These logs are pretty loud, so let's knock em down a log level.
|
Thanks for the review! Just pushed a new commit going @bors-servo r=emilio |
|
📌 Commit 9689db6 has been approved by |
|
☀️ Test successful - status-travis |
See each commit message for details. bce1330 is the big correctness fix for a bug we were hitting in stylo.
r? @emilio