Skip to content

Commit 7cf9dae

Browse files
committed
transpile: operators: propagate expected type to rhs
1 parent 79a07c9 commit 7cf9dae

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

c2rust-transpile/src/translator/operators.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ impl<'c> Translation<'c> {
289289
.ok_or_else(|| format_err!("bad initial lhs type"))?;
290290

291291
// First, translate the rhs. Then, if it must match the lhs but doesn't, add a cast.
292-
let mut rhs_translation = self.convert_expr(ctx.used(), rhs, None)?;
292+
let mut rhs_translation = self.convert_expr(ctx.used(), rhs, Some(rhs_type_id))?;
293293
let lhs_rhs_types_must_match = (|| {
294294
let lhs_resolved = self.ast_context.resolve_type_id(lhs_type_id.ctype);
295295
let rhs_resolved = self.ast_context.resolve_type_id(rhs_type_id.ctype);

0 commit comments

Comments
 (0)