Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions c2rust-analyze/src/borrowck/type_check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -210,18 +210,14 @@ impl<'tcx> TypeChecker<'tcx, '_> {
ref func,
ref args,
destination,
target,
target: _,
..
} => {
let func_ty = func.ty(self.local_decls, *self.ltcx);
eprintln!("callee = {:?}", util::ty_callee(*self.ltcx, func_ty));
match util::ty_callee(*self.ltcx, func_ty) {
Some(Callee::PtrOffset { .. }) => {
// We handle this like a pointer assignment.

// `target` must be `Some` because the function doesn't diverge.
// TODO(kkysen) I kept the `.unwrap()` so that the behavior is identical. Do we need this?
target.unwrap();
let pl_lty = self.visit_place(destination);
assert!(args.len() == 2);
let rv_lty = self.visit_operand(&args[0]);
Expand Down
6 changes: 1 addition & 5 deletions c2rust-analyze/src/dataflow/type_check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -196,18 +196,14 @@ impl<'tcx> TypeChecker<'tcx, '_> {
ref func,
ref args,
destination,
target,
target: _,
..
} => {
let func_ty = func.ty(self.mir, tcx);
eprintln!("callee = {:?}", util::ty_callee(tcx, func_ty));
match util::ty_callee(tcx, func_ty) {
Some(Callee::PtrOffset { .. }) => {
// We handle this like a pointer assignment.

// `target` must be `Some` because the function doesn't diverge.
// TODO(kkysen) I kept the `.unwrap()` so that the behavior is identical. Do we need this?
target.unwrap();
let ctx = PlaceContext::MutatingUse(MutatingUseContext::Store);
let pl_lty = self.visit_place(destination, ctx);
assert!(args.len() == 2);
Expand Down
4 changes: 1 addition & 3 deletions c2rust-analyze/src/expr_rewrite.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,16 +164,14 @@ impl<'a, 'tcx> ExprRewriteVisitor<'a, 'tcx> {
ref func,
ref args,
destination,
target,
target: _,
..
} => {
let func_ty = func.ty(self.mir, tcx);
let pl_ty = self.acx.type_of(destination);

if let Some(callee) = util::ty_callee(tcx, func_ty) {
// Special cases for particular functions.
// TODO(kkysen) I kept the `.unwrap()` so that the behavior is identical. Do we need this?
target.unwrap();
match callee {
Callee::PtrOffset { .. } => {
self.visit_ptr_offset(&args[0], pl_ty);
Expand Down