Skip to content

Commit 91d07bb

Browse files
committed
<Self as Buildable>::Base -> B/T (whatever type param is)
1 parent d82c093 commit 91d07bb

File tree

3 files changed

+7
-10
lines changed

3 files changed

+7
-10
lines changed

src/builder/cfg.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ impl<B: HugrMut> CFGBuilder<B> {
129129
inputs: SimpleRow,
130130
predicate_variants: Vec<ClassicRow>,
131131
other_outputs: SimpleRow,
132-
) -> Result<BlockBuilder<&mut <Self as Buildable>::Base>, BuildError> {
132+
) -> Result<BlockBuilder<&mut B>, BuildError> {
133133
self.any_block_builder(inputs, predicate_variants, other_outputs, false)
134134
}
135135

@@ -139,7 +139,7 @@ impl<B: HugrMut> CFGBuilder<B> {
139139
predicate_variants: Vec<ClassicRow>,
140140
other_outputs: SimpleRow,
141141
entry: bool,
142-
) -> Result<BlockBuilder<&mut <Self as Buildable>::Base>, BuildError> {
142+
) -> Result<BlockBuilder<&mut B>, BuildError> {
143143
let op = OpType::BasicBlock(BasicBlock::DFB {
144144
inputs: inputs.clone(),
145145
other_outputs: other_outputs.clone(),
@@ -173,7 +173,7 @@ impl<B: HugrMut> CFGBuilder<B> {
173173
inputs: SimpleRow,
174174
outputs: SimpleRow,
175175
n_cases: usize,
176-
) -> Result<BlockBuilder<&mut <Self as Buildable>::Base>, BuildError> {
176+
) -> Result<BlockBuilder<&mut B>, BuildError> {
177177
self.block_builder(inputs, vec![type_row![]; n_cases], outputs)
178178
}
179179

@@ -188,7 +188,7 @@ impl<B: HugrMut> CFGBuilder<B> {
188188
&mut self,
189189
predicate_variants: Vec<ClassicRow>,
190190
other_outputs: SimpleRow,
191-
) -> Result<BlockBuilder<&mut <Self as Buildable>::Base>, BuildError> {
191+
) -> Result<BlockBuilder<&mut B>, BuildError> {
192192
let inputs = self
193193
.inputs
194194
.take()
@@ -206,7 +206,7 @@ impl<B: HugrMut> CFGBuilder<B> {
206206
&mut self,
207207
outputs: SimpleRow,
208208
n_cases: usize,
209-
) -> Result<BlockBuilder<&mut <Self as Buildable>::Base>, BuildError> {
209+
) -> Result<BlockBuilder<&mut B>, BuildError> {
210210
self.entry_builder(vec![type_row![]; n_cases], outputs)
211211
}
212212

src/builder/conditional.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,7 @@ impl<B: HugrMut> ConditionalBuilder<B> {
9999
///
100100
/// This function will return an error if the case has already been built,
101101
/// `case` is not a valid index or if there is an error adding nodes.
102-
pub fn case_builder(
103-
&mut self,
104-
case: usize,
105-
) -> Result<CaseBuilder<&mut <Self as Buildable>::Base>, BuildError> {
102+
pub fn case_builder(&mut self, case: usize) -> Result<CaseBuilder<&mut B>, BuildError> {
106103
let conditional = self.conditional_node;
107104
let control_op = self.hugr().get_optype(self.conditional_node).clone();
108105

src/builder/module.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ impl<T: HugrMut> ModuleBuilder<T> {
7070
pub fn define_declaration(
7171
&mut self,
7272
f_id: &FuncID<false>,
73-
) -> Result<FunctionBuilder<&mut <Self as Buildable>::Base>, BuildError> {
73+
) -> Result<FunctionBuilder<&mut T>, BuildError> {
7474
let f_node = f_id.node();
7575
let (signature, name) = if let OpType::FuncDecl(ops::FuncDecl { signature, name }) =
7676
self.hugr().get_optype(f_node)

0 commit comments

Comments
 (0)