Skip to content

Commit 83b16ea

Browse files
committed
Remove typed-builder dependency
Requires removing #[non_exhaustive] from DataDef, FunctionDef, and FunctionBlock. This means that if the IR format changes, adding new fields would break the API. Alternatively we could leave the #[non_exhaustive] attribute while removing the builder. However, this would make these types impossible to construct outside of the crate and reduce the usefuleness of the Display impls.
1 parent 56b4514 commit 83b16ea

File tree

3 files changed

+4
-22
lines changed

3 files changed

+4
-22
lines changed

Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ ordered-float = "5"
1515
unicode-ident = "1"
1616
paste3 = "1"
1717
arrayvec = "0.7"
18-
typed-builder = "0.23"
1918
smol_str = "0.3"
2019
line-index = "0.1"
2120
text-size = "1"

src/ast/data.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,11 @@ use std::fmt::{self, Display, Formatter, Write};
88
use crate::print::{IndentedPrinter, impl_display_via_print};
99
use chumsky::prelude::*;
1010

11-
#[derive(Debug, Eq, PartialEq, Hash, Clone, typed_builder::TypedBuilder)]
12-
#[non_exhaustive]
11+
#[derive(Debug, Eq, PartialEq, Hash, Clone)]
1312
pub struct DataDef {
14-
#[builder(default)]
1513
pub span: Span,
16-
#[builder(default)]
1714
pub linkage: Linkage,
1815
pub name: GlobalName,
19-
#[builder(default, setter(strip_option))]
2016
pub align: Option<AlignSpec>,
2117
pub fields: Vec<DataField>,
2218
}

src/ast/functions.rs

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,12 @@ mod parse;
1515
#[cfg(test)]
1616
mod test;
1717

18-
#[derive(Clone, Debug, Eq, PartialEq, Hash, typed_builder::TypedBuilder)]
19-
#[non_exhaustive]
18+
#[derive(Clone, Debug, Eq, PartialEq, Hash)]
2019
pub struct FunctionDef {
21-
#[builder(default)]
2220
pub span: Span,
23-
#[builder(default)]
2421
pub linkage: Linkage,
25-
#[builder(default, setter(strip_option, into))]
2622
pub return_type: Option<AbiType>,
2723
pub name: GlobalName,
28-
#[builder(default, mutators(
29-
fn add_param(&mut self, param: impl Into<ParamDef>) {
30-
self.params.push(param.into());
31-
}
32-
))]
3324
pub params: Vec<ParamDef>,
3425
pub body: FunctionBody,
3526
}
@@ -181,15 +172,11 @@ impl FunctionBody {
181172
}
182173
}
183174
impl_display_via_print!(FunctionBody);
184-
#[derive(Clone, Debug, Eq, PartialEq, Hash, typed_builder::TypedBuilder)]
185-
#[non_exhaustive]
175+
#[derive(Clone, Debug, Eq, PartialEq, Hash)]
186176
pub struct FunctionBlock {
187-
#[builder(default)]
188177
pub span: Span,
189178
pub label: BlockName,
190-
#[builder(default)]
191179
pub phis: Vec<PhiInstruction>,
192-
#[builder(default)]
193180
pub instructions: Vec<RegularInstruction>,
194181
pub terminator: Option<JumpInstruction>,
195182
}
@@ -211,7 +198,7 @@ impl FunctionBlock {
211198
}
212199
}
213200
impl_display_via_print!(FunctionBlock);
214-
#[derive(Clone, Debug, Eq, PartialEq, Hash, typed_builder::TypedBuilder)]
201+
#[derive(Clone, Debug, Eq, PartialEq, Hash)]
215202
pub struct PhiInstruction {
216203
pub span: Span,
217204
pub dest_info: InsnDestInfo,

0 commit comments

Comments
 (0)