-
Notifications
You must be signed in to change notification settings - Fork 1.9k
fix: resolve const generic param-env panic in type projection #21235
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
fix: resolve const generic param-env panic in type projection #21235
Conversation
ChayimFriedman2
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.
Please add a test. You can take the code from #21173, but please verify it fails without the changes and succeeds with them.
I have tested it manually for both the cases on my machine, let me try to add some tests as well. |
|
Hey @ChayimFriedman2, I've tested it manually. Panics on master, works with the fix. I tried adding an automated test but ran into issues. The panic happens deep in the trait solver during normalization, and salsa catches panics from queries. Even calling Any suggestions on how to set up a test that would catch this? Happy to add one if you can point me in the right direction. Results of
thread 'main' panicked at ra-ap-rustc_type_ir-0.139.0/src/inherent.rs:580:13:
cannot find `!BoundConst { var: 0 }` in param-env: ParamEnv {
clauses: [],
}
Inference: 154.38ms, 0b
MIR lowering: 308.83µs, 0b
Mir failed bodies: 0 (0%)
Data layouts: 68.71µs, 0b
Failed data layouts: 0 (0%)
Const evaluation: 4.08µs, 0b
IDE: 1.61ms, 0b (1 files)
Total: 2.68s, 0b |
|
It should just panic and fail the test, doesn't it? |
|
salsa doesn't catch and silence the panics, at least the ones emitted from the type system. So, if you failed to reproduce the panic, it just didn't happened. |
e3603fa to
fd73399
Compare
|
@ChayimFriedman2 @ShoyuVanilla I have added some tests about the panic. NOTE: I have add an additional test for the case of |
ChayimFriedman2
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.
We don't need that many tests, and I also don't think the long comment above the test is a good idea - the explanation for the test can be looked up by opening the issue. Other than that, LGTM.
|
Oh, and please squash. |
Sure Got it. Should i keep this test or not ? the case of assignment which would pass anyways for both the branches. |
|
Ah no. Please spend some more effort and try to create a test. Possibly of help will be to include the minicore item |
fd73399 to
d6271ab
Compare
Oh I think you misunderstood. There were 4 tests earlier, 3 of them regarding this issue and one in which So I have removed the last 3 tests and kept only one which is a test for this functionality. Panics on |
|
So I have removed the unnecessary test cases. |
ChayimFriedman2
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.
Ah yes, I misunderstood then.
Thanks!
Closes #21173