Skip to content

Commit 48b88b4

Browse files
committed
section_mangler: Derive Clone on SectionMangler
1 parent 6f310be commit 48b88b4

File tree

1 file changed

+6
-6
lines changed
  • compiler/section_mangler/src

1 file changed

+6
-6
lines changed

compiler/section_mangler/src/lib.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,20 +49,20 @@ mod parser;
4949
/// The main builder type of this crate. Use it to create mangling contexts, in
5050
/// order to encode and decode binary type information.
5151
// TODO: Add example code for using this builder
52-
#[derive(Debug, PartialEq)]
52+
#[derive(Debug, PartialEq, Clone)]
5353
pub enum SectionMangler {
5454
Function(FunctionMangler),
5555
Variable(VariableMangler),
5656
}
5757

58-
#[derive(Debug, PartialEq)]
58+
#[derive(Debug, PartialEq, Clone)]
5959
pub struct FunctionMangler {
6060
name: String,
6161
parameters: Vec<FunctionArgument>,
6262
return_type: Option<Type>,
6363
}
6464

65-
#[derive(Debug, PartialEq)]
65+
#[derive(Debug, PartialEq, Clone)]
6666
pub struct VariableMangler {
6767
name: String,
6868
ty: Type,
@@ -116,7 +116,7 @@ impl SectionMangler {
116116
// NOTE: This is called `variable_linkage` in the `MemberInfo` struct.
117117

118118
/// We have to encode this because if it changes, the function needs to be reloaded - this is an ABI breakage
119-
#[derive(Debug, PartialEq)]
119+
#[derive(Debug, PartialEq, Clone)]
120120
pub enum FunctionArgument {
121121
ByValue(Type),
122122
ByRef(Type),
@@ -133,7 +133,7 @@ impl fmt::Display for FunctionArgument {
133133
}
134134

135135
// TODO: Do we have to encode this? Does that affect ABI? Probably
136-
#[derive(Debug, PartialEq)]
136+
#[derive(Debug, PartialEq, Clone)]
137137
pub enum StringEncoding {
138138
// TODO: Should we encode this differently? this could cause problems compared to encoding unsigned types
139139
/// Encoded as `8u`
@@ -153,7 +153,7 @@ impl fmt::Display for StringEncoding {
153153

154154
// This maps directly to the [`DataTypeInformation`] enum in RuSTy - we simply remove some fields and add the ability to encode/decode serialize/deserialize
155155
// TODO: Do we have to handle Generic?
156-
#[derive(Debug, PartialEq)]
156+
#[derive(Debug, PartialEq, Clone)]
157157
pub enum Type {
158158
/// Encoded as `v`
159159
Void,

0 commit comments

Comments
 (0)