Skip to content

Commit

Permalink
Fix some bugs in the rust printer
Browse files Browse the repository at this point in the history
  • Loading branch information
W95Psp committed Aug 17, 2023
1 parent e5b3552 commit 4520fc6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
5 changes: 3 additions & 2 deletions engine/lib/print_rust.ml
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ module Raw = struct
let pgeneric_param_kind span (pk : generic_param_kind) =
let ( ! ) = pure span in
match pk with
| GPLifetime _ -> (empty, !": '_")
| GPLifetime _ -> (empty, !": 'unk")
| GPType { default = Some default } -> (empty, !" = " & pty span default)
| GPType { default = None } -> (empty, empty)
| GPConst { typ } -> (!"const ", !":" & pty span typ)
Expand All @@ -361,7 +361,7 @@ module Raw = struct
let pgeneric_constraint span (p : generic_constraint) =
let ( ! ) = pure span in
match p with
| GCLifetime _ -> !"'_: '_"
| GCLifetime _ -> !"'unk: 'unk"
| GCType { typ; implements } ->
pty span typ & !":" & ptrait_ref span implements

Expand Down Expand Up @@ -433,6 +433,7 @@ module Raw = struct
& pgeneric_params generics.params
& pgeneric_constraints e.span generics.constraints
& pvariant_body e.span variant
& if variant.is_record then !"" else !";"
| Type { name; generics; variants : _ } ->
!"enum "
& !(Concrete_ident_view.to_definition_name name)
Expand Down
5 changes: 2 additions & 3 deletions tests/attributes/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
use hax_lib_macros::*;
use serde::Deserialize;

use serde::{Deserialize, Serialize};

#[derive(Serialize, Deserialize, Debug)]
#[derive(Deserialize, Debug)]
pub struct SerdeTest {
foo: u32,
}
Expand Down

0 comments on commit 4520fc6

Please sign in to comment.