-
Notifications
You must be signed in to change notification settings - Fork 100
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
Ignore messages for assert, panic, and unreachable macros #1924
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.
Didn't we talk about updating the documentation? We should also mention that we don't invoke the fmt()
function of the arguments, since they could introduce some bad behavior or side effect.
@@ -1,10 +0,0 @@ | |||
// Copyright Kani Contributors |
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 turn this into fixme test instead?
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 currently don't have a way to add fixme tests that are passing, but should actually fail (see discussion on #1666). That's why I deleted it. I'm not happy about that though, so I'm open to ideas on how we can keep the test in our regressions in a meaningful way.
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.
Honestly, I just rename the test, add a comment and change the expected file to the current output. It won't be part of a fixme suite, but I think it's better than deleting it.
Added.
Can you clarify what you mean? |
`std::process::{abort, exit}` functions | Invokes `panic!()` to abort the execution | | ||
|
||
[^skip-errors]: The effect of skipping string formatting code is that Kani fails to detect and report any compiler warnings/errors associated with them (see https://github.com/model-checking/kani/issues/803) |
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.
I think we should also call out that we may miss invalid behavior present in the formatting code and that the analysis result can be affected if the format code has any side effect.
I found a way to make #1918 work fully, so might abandon this PR! |
Closing in favor of #1918. |
Description of changes:
We've had a myriad of issues related to the processing of messages for the
assert
,panic
, andunreachable
macros using theformat_args
macro. The purpose of usingformat_args
in an unreachable (if false
) block was to make sure the args are checked for errors/warnings. However, the usage offormat_args
caused Kani to fail to compile crates that useassert
andpanic
in const contexts (e.g. https://github.com/time-rs/time/blob/4c13327d5fed8571316b181e828067fc54038e05/time/src/lib.rs#L362). Fixing this would require using a macro that has the following properties:We're unaware of a macro that satisfies those 3 properties. The
format_args
macro seems to be on its way to be usable in const contexts as the error message indicates:so in the meantime, we've decided to drop the processing of arguments. This may cause Kani to not produce compile-time errors in some cases.
Resolved issues:
Resolves #1586
Related RFC:
Optional #ISSUE-NUMBER.
Call-outs:
This PR will reintroduce two issues that were previously addressed by processing the messages using the
format_args
macro:Testing:
How is this change tested?
Is this a refactor change?
Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 and MIT licenses.