Skip to content

Commit

Permalink
rust: Include documentation comments for type alias.
Browse files Browse the repository at this point in the history
Includes doc comments for auxiliary type alias
created for one-byte variables.
  • Loading branch information
armfazh committed Sep 20, 2023
1 parent 85e0822 commit 4bd3b0c
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/Stringification/Rust.v
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,12 @@ Module Rust.
""]%string
++ (List.flat_map
(fun bw
=> (if IntSet.mem (int.of_bitwidth false bw) bitwidths_used || IntSet.mem (int.of_bitwidth true bw) bitwidths_used
then [type_prefix ++ int_type_to_string internal_private prefix (int.of_bitwidth false bw) ++ " = u8;"; (* C: typedef unsigned char prefix_uint1 *)
type_prefix ++ int_type_to_string internal_private prefix (int.of_bitwidth true bw) ++ " = i8;" ]%string (* C: typedef signed char prefix_int1 *)
=> let type_suffix (b : bool) := (int.of_bitwidth b bw) in
let typedef_name (b : bool) := int_type_to_string internal_private prefix (type_suffix b) in
let type_comment (name : string) := String.concat String.NewLine (comment_block [( name ++ " represents one byte.")%string]) in
(if IntSet.mem (type_suffix false) bitwidths_used || IntSet.mem (type_suffix true) bitwidths_used
then [type_comment (typedef_name false) ++ String.NewLine ++ type_prefix ++ (typedef_name false) ++ " = u8;"; (* C: typedef unsigned char prefix_uint1 *)
type_comment (typedef_name true ) ++ String.NewLine ++ type_prefix ++ (typedef_name true) ++ " = i8;"]%string (* C: typedef signed char prefix_int1 *)
else []))
[1; 2])
++ (if skip_typedefs
Expand Down

0 comments on commit 4bd3b0c

Please sign in to comment.