-
Notifications
You must be signed in to change notification settings - Fork 92
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
Changes from 2 commits
4a4539b
71b1188
9f17da9
6134f1d
5821f87
519ed87
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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 = span.map_or(Location::none(), |s| self.codegen_span(s)); | ||
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 think there is a |
||
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( | ||
|
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!