-
Notifications
You must be signed in to change notification settings - Fork 99
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
Allow panic with args to be called in a const context #1918
Allow panic with args to be called in a const context #1918
Conversation
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.
Can you please also add a test that panic during const evaluation?
Failed Checks: concat!("ArrayVec::", "try_insert",\ | ||
": index {} is out of bounds in vector of length {}"),\ | ||
5, 3 | ||
Failed Checks: concat!\ |
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.
Is this new line on purpose?
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.
TBH, I have no idea how this new line came about. It's not clear how where those new lines are coming from.
Sure. |
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.
Awesome!! I was wondering if the compiler will also prune the assert before codegen. 🤞
Is there a way to examine the MIR that the codegen module receives? |
Looks like it does get pruned, e.g.
This is what
|
Description of changes:
Calling
panic!
with args, e.g.is allowed by
rustc
in const contexts, but Kani compilation currently fails. This PR updates Kani's definition of thepanic
macro to allow this to go through.Resolved issues:
Resolves #1586
Related RFC:
Optional #ISSUE-NUMBER.
Call-outs:
Testing:
How is this change tested? Added a new test
Is this a refactor change? No
Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 and MIT licenses.