Skip to content

Commit

Permalink
Prevent move-out on pointer holding structs
Browse files Browse the repository at this point in the history
  • Loading branch information
R1kM committed Aug 29, 2024
1 parent 3205d33 commit 532cc7f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/AstToMiniRust.ml
Original file line number Diff line number Diff line change
Expand Up @@ -828,7 +828,7 @@ and translate_expr_with_type (env: env) (e: Ast.expr) (t_ret: MiniRust.typ): env
let t = translate_type env b.typ in
let is_owned_struct =
match b.typ with
| TQualified lid when Idents.LidSet.mem lid env.heap_structs -> true
| TQualified lid when Idents.LidSet.mem lid env.heap_structs || Idents.LidSet.mem lid env.pointer_holding_structs -> true
| _ -> false
in
(* TODO how does this play out with the new "translate as non-mut by
Expand Down
2 changes: 1 addition & 1 deletion lib/OptimizeMiniRust.ml
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ let rec infer (env: env) (expected: typ) (known: known) (e: expr): known * expr
known, e

| Deref _ ->
failwith "TODO: Deref"
known, e

(* We store here a list of builtins, with the types of their arguments.
Type substitutions are currently not supported, functions with generic
Expand Down

0 comments on commit 532cc7f

Please sign in to comment.