-
Notifications
You must be signed in to change notification settings - Fork 95
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
Update toolchain to 2022-07-05 #1340
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
4a4539b
Update toolchain to 2022-07-05
celinval 71b1188
Codegen unimplemented for unsupported constant slices
celinval 9f17da9
Fix copyright check
celinval 6134f1d
Use codegen_option_span instead
celinval 5821f87
Merge branch 'main' into issue-1336-toolchain
celinval 519ed87
Merge branch 'main' into issue-1336-toolchain
celinval 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 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 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 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 |
---|---|---|
|
@@ -57,7 +57,7 @@ impl<'tcx> GotocCtx<'tcx> { | |
debug!("found literal: {:?}", lit); | ||
let lit = self.monomorphize(lit); | ||
|
||
match lit.val() { | ||
match lit.kind() { | ||
// evaluate constant if it has no been evaluated yet | ||
ConstKind::Unevaluated(unevaluated) => { | ||
debug!("The literal was a Unevaluated"); | ||
|
@@ -68,14 +68,15 @@ impl<'tcx> GotocCtx<'tcx> { | |
self.codegen_const_value(const_val, lit.ty(), span) | ||
} | ||
|
||
ConstKind::Value(v) => { | ||
debug!("The literal was a ConstValue {:?}", v); | ||
self.codegen_const_value(v, lit.ty(), span) | ||
ConstKind::Value(valtree) => { | ||
let value = self.tcx.valtree_to_const_val((lit.ty(), valtree)); | ||
debug!("The literal was a ConstValue {:?}", value); | ||
self.codegen_const_value(value, lit.ty(), span) | ||
} | ||
_ => { | ||
unreachable!( | ||
"monomorphized item shouldn't have this constant value: {:?}", | ||
lit.val() | ||
lit.kind() | ||
) | ||
} | ||
} | ||
|
@@ -104,8 +105,6 @@ impl<'tcx> GotocCtx<'tcx> { | |
ty::Slice(slice_ty) => { | ||
if let Uint(UintTy::U8) = slice_ty.kind() { | ||
// The case where we have a slice of u8 is easy enough: make an array of u8 | ||
// TODO: Handle cases with larger int types by making an array of bytes, | ||
// then using byte-extract on it. | ||
let slice = | ||
data.inspect_with_uninit_and_ptr_outside_interpreter(start..end); | ||
let vec_of_bytes: Vec<Expr> = slice | ||
|
@@ -123,12 +122,22 @@ impl<'tcx> GotocCtx<'tcx> { | |
len_expr, | ||
&self.symbol_table, | ||
); | ||
} else { | ||
// TODO: Handle cases with other types such as tuples and larger integers. | ||
let loc = self.codegen_span_option(span.cloned()); | ||
let typ = self.codegen_ty(lit_ty); | ||
return self.codegen_unimplemented( | ||
"Constant slice value with 2+ bytes", | ||
typ, | ||
loc, | ||
"https://github.com/model-checking/kani/issues/1339", | ||
); | ||
} | ||
} | ||
_ => {} | ||
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. What does this do? 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. I believe this is a no-op. In this case, the |
||
} | ||
} | ||
unimplemented!("\nv {:?}\nlit_ty {:?}\nspan {:?}", v, lit_ty, span); | ||
unimplemented!("\nv {:?}\nlit_ty {:?}\nspan {:?}", v, lit_ty.kind(), span); | ||
} | ||
|
||
pub fn codegen_const_value( | ||
|
This file contains 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 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 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 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 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 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
Oops, something went wrong.
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.
Idle comment: I copied this file (with minor changes) from cranelift. After I did so, I heard that it got updated/simplified.
It's been on my todo list to look into whether I should re-copy it.
I notice that rust-lang/rust#97485 exists though, and that might ultimately let us just delete this file. I'll track that 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.
That would be great!