Uh oh!
There was an error while loading. Please reload this page.
Improve errors on const mismatches - #90987
Conversation
rust-highfive
commented
Nov 17, 2021
r? @jackh726 (rust-highfive has picked a reviewer for you, use r? to override) |
b-naber
commented
Nov 17, 2021
r? @BoxyUwU |
d7d3787 to
978b853CompareUh oh!
There was an error while loading. Please reload this page.
978b853 to
c3d3f4dCompareThere was a problem hiding this comment.
I think this needs updating to print out with substs applied too
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
b-naber
commented
Nov 18, 2021
Don't see why CI fails, I did bless those tests. |
BoxyUwU
commented
Nov 18, 2021
Can you check if this handles precedence right 🤔 fnfoo<constM:usize>() -> [();3*M];let _:[();3*2 + N]foo::<{2 + N}>();do we get a silly error message like |
b-naber
commented
Nov 19, 2021
yeah we do, but I think it shouldn't be too hard to include precedence of operations here when constructing the suggestion. I can try that. |
bors
commented
Nov 21, 2021
☔ The latest upstream changes (presumably #91104) made this pull request unmergeable. Please resolve the merge conflicts. |
b-naber
commented
Nov 23, 2021
Taking precedence into account when applying substitutions is anything but straightforward. I'd prefer to do this in another PR, since this is basically more effort than the original PR. For now I'd suggest we just fall back to the unsubstituted suggestion, in case we would output the same suggestion as the error. |
b-naber
commented
Nov 23, 2021
@BoxyUwU Would that be ok for you? |
03909d7 to
27facbfCompareb-naber
commented
Nov 24, 2021
Did decide to implement this, wasn't as hard as I initially thought. |
This comment has been minimized.
This comment has been minimized.
27facbf to
517c887Compare
This comment has been minimized.
This comment has been minimized.
517c887 to
08f70c5Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
0ba4a85 to
3e2ee2cCompare
This comment has been minimized.
This comment has been minimized.
b-naber
commented
Nov 25, 2021
Ok, I only blessed the tests in ui/const-generics, but they all passed in that CI run. So it seems as if for some reason the |
bors
commented
Dec 16, 2021
☔ The latest upstream changes (presumably #91996) made this pull request unmergeable. Please resolve the merge conflicts. |
There was a problem hiding this comment.
This is the cause of the CI failures. the CI is failing on 32 bit stuff which means if we have a usize scalar here and call .to_i64 we get an InterpErrorInfo(InterpErrorInfoInner { kind: scalar size mismatch: expected 8 bytes but got 4 bytes instead, backtrace: None }) from this call but on 64bit it works fine because the sizes match.
the docs for to_i64 say "Fails if the scalar is a pointer" but I guess that is wrong .-.
this code would also just be wrong if the scalar was a u128 or something since those values cant all fit in a i128
not sure exactly what the right thing to replace this with is but we surely have code somewhere for printing this out
There was a problem hiding this comment.
Thanks, that's a great catch. I'll try to figure out how to handle this correctly here.
a5e50e3 to
57d137eCompare
This comment has been minimized.
This comment has been minimized.
b-naber
commented
Dec 24, 2021
For some reason I had to add the |
57d137e to
6ed9dfdCompare
This comment has been minimized.
This comment has been minimized.
6ed9dfd to
7b72ba8Comparerust-log-analyzer
commented
Dec 28, 2021
The job Click to see the possible cause of the failure (guessed by this bot) |
bors
commented
Jan 4, 2022
☔ The latest upstream changes (presumably #92556) made this pull request unmergeable. Please resolve the merge conflicts. |
JohnCSimon
commented
Jan 23, 2022
Ping from triage: |
@BoxyUwU Any ideas why |
BoxyUwU
commented
Jan 26, 2022
Not sure why your code isnt working but I looked around a bit and I think |
Fixes#86198
This allows us to suggest a correct anonymous constant in case there's a mismatch, e.g. in:
we now get a mismatch const error of the following form:
instead of the
found { M + 1 }constant that was previously output.