Uh oh!
There was an error while loading. Please reload this page.
nll type annotations in multisegment path - #55093
Conversation
rust-highfive
commented
Oct 15, 2018
The job 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 |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
This comment has been minimized.
This comment has been minimized.
d5eba13 to
63f5057Comparebors
commented
Oct 15, 2018
☔ The latest upstream changes (presumably #54858) made this pull request unmergeable. Please resolve the merge conflicts. |
At some point, I had thought to use this code to handle equality comparisons for the `IfEq` verify bounds; at that point, we might not have had an infcx to talk about. But we wound up doing "SCC representatives" instead, so that's fine.
This used to be public, then I made it private in a previous PR, but there really wasn't a strong need for that.
We used to use a kind of "home-grown" variant where we tracked the value of each canonical variable.
The name is not great. Nor is the existence of this code great. It should be merged with the main "type relating code" at some point.
(long lines)
049f1e6 to
7ce2e7aCompare
matthewjasper
left a comment
There was a problem hiding this comment.
LGTM. Not sure how confident I am reviewing a PR of this size though.
nikomatsakis
commented
Oct 16, 2018
r? @pnkfelix |
pnkfelix
left a comment
There was a problem hiding this comment.
hooray for the new UserTypeAnnotation enum! I hope this will make the corresponding visit methods easier to grok
| pub substs: &'tcx Substs<'tcx>, | ||
| /// The self-type, in the case of a `<T>::Item` path (when applied | ||
| /// to an inherent impl). See `UserSubsts` below. |
There was a problem hiding this comment.
I don't understand where the reader is meant to be led by the "See UserSubsts below."
There was a problem hiding this comment.
(Probably a typo for UserSelfTy.)
| struct A<'a> { x: &'a u32 } | ||
| impl<'a> A<'a> { | ||
| fn new<'b, T>(x: &'a u32, y: T) -> Self { |
There was a problem hiding this comment.
(I see the same thing occuring in the other tests. To be honest I had thought that we didn't allow unreferenced lifetimes in generic binders ... but I guess that is just a lint, when it comes to lifetimes...?)
There was a problem hiding this comment.
copy and paste error, I think
| fn foo<'a>() { | ||
| let v = 22; | ||
| let x = A::<'a>::new(&v, 22); |
There was a problem hiding this comment.
I think you and I mirrored each other on our respective PR's; there should be an //~ ERROR on this line, right?
pnkfelix
commented
Oct 16, 2018
I had a slew of nits. But none of them should block landing this PR, and frankly, I want to rebase my own work pronto on top of this. |
pnkfelix
commented
Oct 16, 2018
@bors r+ |
bors
commented
Oct 16, 2018
📌 Commit 7ce2e7a has been approved by |
nikomatsakis
commented
Oct 16, 2018
@bors p=1 -- lots of stuff wants to build on this |
nikomatsakis
commented
Oct 16, 2018
nikomatsakis
commented
Oct 16, 2018
@bors r=pnkfelix p=1 |
bors
commented
Oct 16, 2018
📌 Commit b70b4a6 has been approved by |
bors
commented
Oct 16, 2018
…, r=pnkfelix nll type annotations in multisegment path This turned out to be sort of tricky. The problem is that if you have a path like ``` <Foo<&'static u32>>::bar ``` and it comes from an impl like `impl<T> Foo<T>` then the self-type the user gave doesn't *directly* map to the substitutions that the impl wants. To handle this, then, we have to preserve not just the "user-given substs" we used to do, but also a "user-given self-ty", which we have to apply later. This PR makes those changes. It also removes the code from NLL relate-ops that handled canonical variables and moves to use normal inference variables instead. This simplifies a few things and gives us a bit more flexibility (for example, I predict we are going to have to start normalizing at some point, and it would be easy now). r? @matthewjasper -- you were just touching this code, do you feel comfortable reviewing this? Fixes#54574
bors
commented
Oct 17, 2018
☀️ Test successful - status-appveyor, status-travis |
This turned out to be sort of tricky. The problem is that if you have a path like
and it comes from an impl like
impl<T> Foo<T>then the self-type the user gave doesn't directly map to the substitutions that the impl wants. To handle this, then, we have to preserve not just the "user-given substs" we used to do, but also a "user-given self-ty", which we have to apply later. This PR makes those changes.It also removes the code from NLL relate-ops that handled canonical variables and moves to use normal inference variables instead. This simplifies a few things and gives us a bit more flexibility (for example, I predict we are going to have to start normalizing at some point, and it would be easy now).
r? @matthewjasper -- you were just touching this code, do you feel comfortable reviewing this?
Fixes#54574