Uh oh!
There was an error while loading. Please reload this page.
Fix substs issues for const errors - #60508
Conversation
rust-highfive
commented
May 3, 2019
(rust_highfive has picked a reviewer for you, use r? to override) |
varkor
commented
May 3, 2019
This currently breaks because it tries to substitute a const for a type parameter. I think this was a pre-existing issue, but the bug this PR fixes was hiding it. I think that type parameters are still being ordered before const parameters (even if they appear afterwards in the source code), so there's a mismatch. |
estebank
commented
May 3, 2019
@varkor the parser ignores the order when making the ast node but complains about the order so an error will be emitted. Why do we depend on source ordering here? |
varkor
commented
May 3, 2019
@estebank: I haven't fully diagnosed the issue yet, but ideally parameters would preserve their source order throughout the compiler: there shouldn't be any reason lifetimes, types and consts should come in that order specifically. The error should essentially just be a lint. However, that hasn't always been the case and I imagine there are some broken assumptions here because of it. |
varkor
commented
May 3, 2019
A quick fix would be to abort as soon as misordered const/type parameters are found in a signature. It should only regress diagnostics for const generics and I can fix the issue properly later. |
estebank
commented
May 3, 2019
@varkor I think the order is lost because in the parser we collect independent vecs for each type of argument instead of one vec with annotated items. We could indeed |
7cbf469 to
735714aComparevarkor
commented
May 4, 2019
I've added a temporary |
Uh oh!
There was an error while loading. Please reload this page.
petrochenkov
commented
May 4, 2019
@bors r+ |
bors
commented
May 4, 2019
📌 Commit 735714af24f422dcba10d1beabf35a0816f645c2 has been approved by |
735714a to
1f47f12Compare1f47f12 to
3e6787cComparevarkor
commented
May 4, 2019
@bors r=petrochenkov |
bors
commented
May 4, 2019
📌 Commit 3e6787c has been approved by |
bors
commented
May 5, 2019
Fix substs issues for const errors Fixes#60503.
bors
commented
May 5, 2019
☀️ Test successful - checks-travis, status-appveyor |
Fixes#60503.