This repository has been archived by the owner on Aug 22, 2024. It is now read-only.
Tolerate missing summaries for call graphs #1191
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
The root cause of the #1190 issue is that there is no MIR for CStr::from_bytes_with_nul and no foreign contract either. That means that the analysis of main is necessarily imprecise and analyzing the rest of the function will just generate a bunch of diagnostics that are probably false positives. Providing a foreign contract for CStr::from_bytes_with_nul will make the problem go way for the specific repro case, but won't solve the problem for all code until the vast majority of functions without MIR have been provided with contracts.
That is not going to happen any time soon, so the alternative is to embrace the fact that call graphs are already so abstract that no one gets too excited when a non reachable call (false positive) shows up in the call graph. As #1190 illustrates, false negatives are much of more of a concern here. Consequently, the analysis will now carry on when even when it is incomplete and prone to false positives, if the analysis is done in order to retrieve a call graph.
Fixes #1190
Type of change
How Has This Been Tested?
./validate.sh
Checked that the repro in #1190 now works as expected.