generated from amazon-archives/__template_Apache-2.0
-
Notifications
You must be signed in to change notification settings - Fork 136
Join and format warnings about concurrent constructs #2135
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
Merged
celinval
merged 3 commits into
model-checking:main
from
celinval:issue-1460-verbose-async
Jan 19, 2023
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,10 +3,11 @@ | |
| use super::super::codegen::TypeExt; | ||
| use crate::codegen_cprover_gotoc::codegen::typ::{is_pointer, pointee_type}; | ||
| use crate::codegen_cprover_gotoc::GotocCtx; | ||
| use cbmc::btree_string_map; | ||
| use cbmc::goto_program::{Expr, ExprValue, SymbolTable, Type}; | ||
| use cbmc::goto_program::{Expr, ExprValue, Location, SymbolTable, Type}; | ||
| use cbmc::{btree_string_map, InternedString}; | ||
| use rustc_middle::ty::layout::LayoutOf; | ||
| use rustc_middle::ty::{Instance, Ty}; | ||
| use tracing::debug; | ||
|
|
||
| // Should move into rvalue | ||
| //make this a member function | ||
|
|
@@ -66,6 +67,20 @@ impl<'tcx> GotocCtx<'tcx> { | |
| _ => None, | ||
| } | ||
| } | ||
|
|
||
| /// Store an occurrence of a concurrent construct that was treated as a sequential operation. | ||
| /// | ||
| /// Kani does not currently support concurrency and the compiler assumes that when generating | ||
| /// code for some specialized concurrent constructs that this is the case. We store all types of | ||
| /// operations that had this special handling and print a warning at the end of the compilation. | ||
| pub fn store_concurrent_construct(&mut self, operation_name: &str, loc: Location) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As mentioned, printing the location isn't useful at the moment. A better thing to do would be storing locations from function calls up to here, then print whichever is closest to the user's code. But we don't have anything like that at the moment, right? |
||
| debug!(op=?operation_name, location=?loc.short_string(), "store_seq_construct"); | ||
|
|
||
| // Save this occurrence so we can emit a warning in the compilation report. | ||
| let key: InternedString = operation_name.into(); | ||
| let entry = self.concurrent_constructs.entry(key).or_default(); | ||
| entry.push(loc); | ||
| } | ||
| } | ||
|
|
||
| /// Members traverse path to get to the raw pointer of a box (b.0.pointer.pointer). | ||
|
|
||
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.
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.
This messaging could also be improved. In particular, I think we should avoid using "Kani" in our messages, and say something like "Concurrency is not supported at the moment". But I'm afraid this will break some stuff, so let's not do it here.
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.
Why is that?
Uh oh!
There was an error while loading. Please reload this page.
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.
You're running Kani, so it's odd printing messages that mention Kani in any way when you're already in that context. If I'm not mistaken, the Rust compiler won't use its own name in messages unless it's talking about specific editions (e.g., "this construct isn't supported in Rust 2018"). Otherwise, I feel like it becomes repetitive for users to see messages like "Kani does this" or "Kani does that" (there may be exceptions, of course).