-
Notifications
You must be signed in to change notification settings - Fork 84
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
Complete and replace the unsized pointer cast implementation #88
Conversation
compiler/rustc_codegen_llvm/src/gotoc/cbmc/goto_program/expr.rs
Outdated
Show resolved
Hide resolved
4644144
to
bf29c3e
Compare
64c7e01
to
363f180
Compare
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 still think the from_iter
approach is cleaner for constructing BTrees. But otherwise, the PR looks good to go :)
// TODO: Accept a Struct type, too, and not just a StructTag assumed below. | ||
assert!(self.is_struct_tag()); | ||
|
||
let mut types: BTreeMap<String, Type> = BTreeMap::new(); |
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.
Did you decide not to do the from_iter
approach?
let mut map: BTreeMap<String, Ty<'tcx>> = BTreeMap::new(); | ||
map.extend( | ||
fields.iter().map(|field| { | ||
(field.ident.name.to_string(), field.ty(self.tcx, adt_substs)) | ||
}), | ||
); | ||
map |
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.
BtreeMap::from_iter(fields.iter().map(...));
* Complete and replace the unsized pointer cast implementation * Respond to code review of unsized pointer cast implementation Co-authored-by: Mark R. Tuttle <mrtuttle@amazon.com>
* Complete and replace the unsized pointer cast implementation * Respond to code review of unsized pointer cast implementation Co-authored-by: Mark R. Tuttle <mrtuttle@amazon.com>
* Complete and replace the unsized pointer cast implementation * Respond to code review of unsized pointer cast implementation Co-authored-by: Mark R. Tuttle <mrtuttle@amazon.com>
* Complete and replace the unsized pointer cast implementation * Respond to code review of unsized pointer cast implementation Co-authored-by: Mark R. Tuttle <mrtuttle@amazon.com>
* Complete and replace the unsized pointer cast implementation * Respond to code review of unsized pointer cast implementation Co-authored-by: Mark R. Tuttle <mrtuttle@amazon.com>
* Complete and replace the unsized pointer cast implementation * Respond to code review of unsized pointer cast implementation Co-authored-by: Mark R. Tuttle <mrtuttle@amazon.com>
* Complete and replace the unsized pointer cast implementation * Respond to code review of unsized pointer cast implementation Co-authored-by: Mark R. Tuttle <mrtuttle@amazon.com>
* Complete and replace the unsized pointer cast implementation * Respond to code review of unsized pointer cast implementation Co-authored-by: Mark R. Tuttle <mrtuttle@amazon.com>
* Complete and replace the unsized pointer cast implementation * Respond to code review of unsized pointer cast implementation Co-authored-by: Mark R. Tuttle <mrtuttle@amazon.com>
* Complete and replace the unsized pointer cast implementation * Respond to code review of unsized pointer cast implementation Co-authored-by: Mark R. Tuttle <mrtuttle@amazon.com>
* Complete and replace the unsized pointer cast implementation * Respond to code review of unsized pointer cast implementation Co-authored-by: Mark R. Tuttle <mrtuttle@amazon.com>
* Complete and replace the unsized pointer cast implementation * Respond to code review of unsized pointer cast implementation Co-authored-by: Mark R. Tuttle <mrtuttle@amazon.com>
* Complete and replace the unsized pointer cast implementation * Respond to code review of unsized pointer cast implementation Co-authored-by: Mark R. Tuttle <mrtuttle@amazon.com>
* Complete and replace the unsized pointer cast implementation * Respond to code review of unsized pointer cast implementation Co-authored-by: Mark R. Tuttle <mrtuttle@amazon.com>
* Complete and replace the unsized pointer cast implementation * Respond to code review of unsized pointer cast implementation Co-authored-by: Mark R. Tuttle <mrtuttle@amazon.com>
* Complete and replace the unsized pointer cast implementation * Respond to code review of unsized pointer cast implementation Co-authored-by: Mark R. Tuttle <mrtuttle@amazon.com>
…hecking#88) * Complete and replace the unsized pointer cast implementation * Respond to code review of unsized pointer cast implementation Co-authored-by: Mark R. Tuttle <mrtuttle@amazon.com>
…hecking#88) * Complete and replace the unsized pointer cast implementation * Respond to code review of unsized pointer cast implementation Co-authored-by: Mark R. Tuttle <mrtuttle@amazon.com>
…hecking#88) * Complete and replace the unsized pointer cast implementation * Respond to code review of unsized pointer cast implementation Co-authored-by: Mark R. Tuttle <mrtuttle@amazon.com>
* Complete and replace the unsized pointer cast implementation * Respond to code review of unsized pointer cast implementation Co-authored-by: Mark R. Tuttle <mrtuttle@amazon.com>
…hecking#88) * Complete and replace the unsized pointer cast implementation * Respond to code review of unsized pointer cast implementation Co-authored-by: Mark R. Tuttle <mrtuttle@amazon.com>
Resolved issues:
resolves #33 (but see below)
Description of changes:
This pull requests gives a complete implementation of casting a sized pointer to an unsized pointer. This replaces the existing code in
codegen_pointer_cast
for the casePointerCast::Unsize
.Warning: This required removing one test in the regression test
rust-tests/cbmc-reg/Closure/main.rs
. See the issue Casting unit to a trait object for a discussion of the issue.Warning: There is still an issue described in issue #87 with the regression test motivated by the issue #33 motivating this work on
codegen_pointer_cast
, but the issue has moved out ofcodegen_pointer_cast
and intocodegen_misc_cast
.This replaces pull request #84
Call-outs:
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.