-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Implement Chalk lowering rule Normalize-From-Impl #49626
Conversation
Note that this is my first real rustc contribution. So if I'm doing things wrong, let me know! Also I wasn't sure how to test where clauses for associated types ( |
Welcome! Sorry for me being slow! Still catching up from Rust All Hands. |
Yep. Still a WIP. |
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.
Looks good! One nit.
src/librustc_traits/lowering.rs
Outdated
@@ -171,6 +181,53 @@ fn program_clauses_for_impl<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId | |||
Lrc::new(vec![clause]) | |||
} | |||
|
|||
pub fn program_clauses_for_associated_type<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, item_id: DefId) |
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.
Nit: can we make this for_associated_type_value
or impl_item
, something like that?
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.
Good point, changed it to type_value
.
Your PR failed on Travis. Through arcane magic we have determined that the following fragments from the build log may contain information about the problem. Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
The Travis failure seems to be spurious. |
@bors r+ |
📌 Commit 2a18fdc has been approved by |
@bors r- The log bot is still being tested, so don't rely entirely on it yet. The Travis failure is legit.
|
Apart from the travis failure, seems mostly good, but there are some things which I think are not necessary, like adding the where clauses of the impl in the right hand side of As for other rules related to associated types, I'd prefer to start by implementing all of them in chalk (not done yet, but they are fully described here ), and we'll probably revisit the rules in rustc one this has been done and proof tested in chalk. |
@kennytm Good to know. I rebased and updated the code. @scalexm I implemented the rule from the rustc guide (https://rust-lang-nursery.github.io/rustc-guide/traits-lowering-rules.html#lowering-impl-items). If I'm understanding you correctly, you're saying that the |
@fanzier the rustc guide is not entirely up to date when it comes to associated types (especially because the rules have not been fully implemented and tested in chalk yet). I’m not sure yet if we want to assert that the trait is implemented in the
rather than rewriting all the where clauses denoted by |
@scalexm Thanks for the explanation, that makes sense. I'll change it as you suggested. |
@bors delegate=scalexm |
✌️ @scalexm can now approve this pull request |
@bors retry rollup |
Implement Chalk lowering rule Normalize-From-Impl This extends the Chalk lowering pass with the "Normalize-From-Impl" rule for generating program clauses from a trait definition as part of rust-lang#49177. r? @nikomatsakis
@bors r- rollup- Unfortunately #49800 has changed some types and caused this PR to fail. See #49939 (comment) for error log. |
Can someone please approve this again? I only rebased and made it compile. |
@bors r+ |
📌 Commit b7c4a57 has been approved by |
Implement Chalk lowering rule Normalize-From-Impl This extends the Chalk lowering pass with the "Normalize-From-Impl" rule for generating program clauses from a trait definition as part of #49177. r? @nikomatsakis
☀️ Test successful - status-appveyor, status-travis |
This extends the Chalk lowering pass with the "Normalize-From-Impl" rule for generating program clauses from a trait definition as part of #49177.
r? @nikomatsakis