Browse Source

Update rustfmt to 0.8.4; (#81)

pull/3/head
Benjamin Bouvier 8 years ago
committed by Jakob Stoklund Olesen
parent
commit
a2fd9cf0cc
  1. 2
      check-rustfmt.sh
  2. 4
      lib/cretonne/src/binemit/relaxation.rs
  3. 3
      lib/cretonne/src/dominator_tree.rs
  4. 4
      lib/cretonne/src/entity_list.rs
  5. 3
      lib/cretonne/src/ir/builder.rs
  6. 20
      lib/cretonne/src/ir/dfg.rs
  7. 30
      lib/cretonne/src/ir/instructions.rs
  8. 3
      lib/cretonne/src/ir/layout.rs
  9. 4
      lib/cretonne/src/isa/encoding.rs
  10. 12
      lib/cretonne/src/iterators.rs
  11. 12
      lib/cretonne/src/legalizer/boundary.rs
  12. 28
      lib/cretonne/src/regalloc/allocatable_set.rs
  13. 8
      lib/cretonne/src/regalloc/diversion.rs
  14. 3
      lib/cretonne/src/regalloc/solver.rs
  15. 32
      lib/cretonne/src/verifier/mod.rs
  16. 6
      lib/filecheck/src/checker.rs
  17. 16
      lib/reader/src/lexer.rs
  18. 98
      lib/reader/src/parser.rs
  19. 4
      src/filetest/concurrent.rs
  20. 4
      src/filetest/runner.rs

2
check-rustfmt.sh

@ -15,7 +15,7 @@
# With the --install option, also tries to install the right version. # With the --install option, also tries to install the right version.
# This version should always be bumped to the newest version available. # This version should always be bumped to the newest version available.
VERS="0.8.3" VERS="0.8.4"
if cargo install --list | grep -q "^rustfmt v$VERS"; then if cargo install --list | grep -q "^rustfmt v$VERS"; then
exit 0 exit 0

4
lib/cretonne/src/binemit/relaxation.rs

@ -97,9 +97,7 @@ pub fn relax_branches(func: &mut Function, isa: &TargetIsa) {
/// existing `fallthrough` instructions are correct. /// existing `fallthrough` instructions are correct.
fn fallthroughs(func: &mut Function) { fn fallthroughs(func: &mut Function) {
for (ebb, succ) in func.layout.ebbs().adjacent_pairs() { for (ebb, succ) in func.layout.ebbs().adjacent_pairs() {
let term = func.layout let term = func.layout.last_inst(ebb).expect("EBB has no terminator.");
.last_inst(ebb)
.expect("EBB has no terminator.");
if let InstructionData::Jump { if let InstructionData::Jump {
ref mut opcode, ref mut opcode,
destination, destination,

3
lib/cretonne/src/dominator_tree.rs

@ -88,8 +88,7 @@ impl DominatorTree {
// Run a finger up the dominator tree from b until we see a. // Run a finger up the dominator tree from b until we see a.
// Do nothing if b is unreachable. // Do nothing if b is unreachable.
while rpo_a < self.nodes[ebb_b].rpo_number { while rpo_a < self.nodes[ebb_b].rpo_number {
b = self.idom(ebb_b) b = self.idom(ebb_b).expect("Shouldn't meet unreachable here.");
.expect("Shouldn't meet unreachable here.");
ebb_b = layout.inst_ebb(b).expect("Dominator got removed."); ebb_b = layout.inst_ebb(b).expect("Dominator got removed.");
} }

4
lib/cretonne/src/entity_list.rs

@ -135,9 +135,7 @@ impl<T: EntityRef> ListPool<T> {
// The `wrapping_sub` handles the special case 0, which is the empty list. This way, the // The `wrapping_sub` handles the special case 0, which is the empty list. This way, the
// cost of the bounds check that we have to pay anyway is co-opted to handle the special // cost of the bounds check that we have to pay anyway is co-opted to handle the special
// case of the empty list. // case of the empty list.
self.data self.data.get(idx.wrapping_sub(1)).map(|len| len.index())
.get(idx.wrapping_sub(1))
.map(|len| len.index())
} }
/// Allocate a storage block with a size given by `sclass`. /// Allocate a storage block with a size given by `sclass`.

3
lib/cretonne/src/ir/builder.rs

@ -132,8 +132,7 @@ impl<'c, 'fc, 'fd, Array> InstBuilderBase<'fd> for InsertReuseBuilder<'c, 'fc, '
let inst = self.dfg.make_inst(data); let inst = self.dfg.make_inst(data);
// Make an `Interator<Item = Option<Value>>`. // Make an `Interator<Item = Option<Value>>`.
let ru = self.reuse.as_ref().iter().cloned(); let ru = self.reuse.as_ref().iter().cloned();
self.dfg self.dfg.make_inst_results_reusing(inst, ctrl_typevar, ru);
.make_inst_results_reusing(inst, ctrl_typevar, ru);
self.pos.insert_inst(inst); self.pos.insert_inst(inst);
(inst, self.dfg) (inst, self.dfg)
} }

20
lib/cretonne/src/ir/dfg.rs

@ -316,37 +316,25 @@ impl DataFlowGraph {
/// Get the fixed value arguments on `inst` as a slice. /// Get the fixed value arguments on `inst` as a slice.
pub fn inst_fixed_args(&self, inst: Inst) -> &[Value] { pub fn inst_fixed_args(&self, inst: Inst) -> &[Value] {
let fixed_args = self[inst] let fixed_args = self[inst].opcode().constraints().fixed_value_arguments();
.opcode()
.constraints()
.fixed_value_arguments();
&self.inst_args(inst)[..fixed_args] &self.inst_args(inst)[..fixed_args]
} }
/// Get the fixed value arguments on `inst` as a mutable slice. /// Get the fixed value arguments on `inst` as a mutable slice.
pub fn inst_fixed_args_mut(&mut self, inst: Inst) -> &mut [Value] { pub fn inst_fixed_args_mut(&mut self, inst: Inst) -> &mut [Value] {
let fixed_args = self[inst] let fixed_args = self[inst].opcode().constraints().fixed_value_arguments();
.opcode()
.constraints()
.fixed_value_arguments();
&mut self.inst_args_mut(inst)[..fixed_args] &mut self.inst_args_mut(inst)[..fixed_args]
} }
/// Get the variable value arguments on `inst` as a slice. /// Get the variable value arguments on `inst` as a slice.
pub fn inst_variable_args(&self, inst: Inst) -> &[Value] { pub fn inst_variable_args(&self, inst: Inst) -> &[Value] {
let fixed_args = self[inst] let fixed_args = self[inst].opcode().constraints().fixed_value_arguments();
.opcode()
.constraints()
.fixed_value_arguments();
&self.inst_args(inst)[fixed_args..] &self.inst_args(inst)[fixed_args..]
} }
/// Get the variable value arguments on `inst` as a mutable slice. /// Get the variable value arguments on `inst` as a mutable slice.
pub fn inst_variable_args_mut(&mut self, inst: Inst) -> &mut [Value] { pub fn inst_variable_args_mut(&mut self, inst: Inst) -> &mut [Value] {
let fixed_args = self[inst] let fixed_args = self[inst].opcode().constraints().fixed_value_arguments();
.opcode()
.constraints()
.fixed_value_arguments();
&mut self.inst_args_mut(inst)[fixed_args..] &mut self.inst_args_mut(inst)[fixed_args..]
} }

30
lib/cretonne/src/ir/instructions.rs

@ -288,20 +288,20 @@ impl InstructionData {
pub fn analyze_branch<'a>(&'a self, pool: &'a ValueListPool) -> BranchInfo<'a> { pub fn analyze_branch<'a>(&'a self, pool: &'a ValueListPool) -> BranchInfo<'a> {
match self { match self {
&InstructionData::Jump { &InstructionData::Jump {
destination, destination,
ref args, ref args,
.. ..
} => BranchInfo::SingleDest(destination, &args.as_slice(pool)), } => BranchInfo::SingleDest(destination, &args.as_slice(pool)),
&InstructionData::Branch { &InstructionData::Branch {
destination, destination,
ref args, ref args,
.. ..
} => BranchInfo::SingleDest(destination, &args.as_slice(pool)[1..]), } => BranchInfo::SingleDest(destination, &args.as_slice(pool)[1..]),
&InstructionData::BranchIcmp { &InstructionData::BranchIcmp {
destination, destination,
ref args, ref args,
.. ..
} => BranchInfo::SingleDest(destination, &args.as_slice(pool)[2..]), } => BranchInfo::SingleDest(destination, &args.as_slice(pool)[2..]),
&InstructionData::BranchTable { table, .. } => BranchInfo::Table(table), &InstructionData::BranchTable { table, .. } => BranchInfo::Table(table),
_ => BranchInfo::NotABranch, _ => BranchInfo::NotABranch,
} }
@ -595,11 +595,7 @@ impl OperandConstraint {
Same => Bound(ctrl_type), Same => Bound(ctrl_type),
LaneOf => Bound(ctrl_type.lane_type()), LaneOf => Bound(ctrl_type.lane_type()),
AsBool => Bound(ctrl_type.as_bool()), AsBool => Bound(ctrl_type.as_bool()),
HalfWidth => { HalfWidth => Bound(ctrl_type.half_width().expect("invalid type for half_width")),
Bound(ctrl_type
.half_width()
.expect("invalid type for half_width"))
}
DoubleWidth => { DoubleWidth => {
Bound(ctrl_type Bound(ctrl_type
.double_width() .double_width()

3
lib/cretonne/src/ir/layout.rs

@ -467,8 +467,7 @@ impl Layout {
/// Remove `inst` from the layout. /// Remove `inst` from the layout.
pub fn remove_inst(&mut self, inst: Inst) { pub fn remove_inst(&mut self, inst: Inst) {
let ebb = self.inst_ebb(inst) let ebb = self.inst_ebb(inst).expect("Instruction already removed.");
.expect("Instruction already removed.");
// Clear the `inst` node and extract links. // Clear the `inst` node and extract links.
let prev; let prev;
let next; let next;

4
lib/cretonne/src/isa/encoding.rs

@ -130,8 +130,6 @@ impl EncInfo {
/// ///
/// This will never return `None` for a legal branch encoding. /// This will never return `None` for a legal branch encoding.
pub fn branch_range(&self, enc: Encoding) -> Option<BranchRange> { pub fn branch_range(&self, enc: Encoding) -> Option<BranchRange> {
self.sizing self.sizing.get(enc.recipe()).and_then(|s| s.branch_range)
.get(enc.recipe())
.and_then(|s| s.branch_range)
} }
} }

12
lib/cretonne/src/iterators.rs

@ -65,17 +65,9 @@ mod tests {
.adjacent_pairs() .adjacent_pairs()
.collect::<Vec<_>>(), .collect::<Vec<_>>(),
vec![(2, 3), (3, 4)]); vec![(2, 3), (3, 4)]);
assert_eq!([3, 4] assert_eq!([3, 4].iter().cloned().adjacent_pairs().collect::<Vec<_>>(),
.iter()
.cloned()
.adjacent_pairs()
.collect::<Vec<_>>(),
vec![(3, 4)]); vec![(3, 4)]);
assert_eq!([4] assert_eq!([4].iter().cloned().adjacent_pairs().collect::<Vec<_>>(),
.iter()
.cloned()
.adjacent_pairs()
.collect::<Vec<_>>(),
vec![]); vec![]);
assert_eq!([] assert_eq!([]
.iter() .iter()

12
lib/cretonne/src/legalizer/boundary.rs

@ -251,9 +251,7 @@ fn convert_from_abi<GetArg>(dfg: &mut DataFlowGraph,
assert!(!ty.is_int()); assert!(!ty.is_int());
let abi_ty = Type::int(ty.bits()).expect("Invalid type for conversion"); let abi_ty = Type::int(ty.bits()).expect("Invalid type for conversion");
let arg = convert_from_abi(dfg, pos, abi_ty, None, get_arg); let arg = convert_from_abi(dfg, pos, abi_ty, None, get_arg);
dfg.ins(pos) dfg.ins(pos).with_results([into_result]).bitcast(ty, arg)
.with_results([into_result])
.bitcast(ty, arg)
} }
// ABI argument is a sign-extended version of the value we want. // ABI argument is a sign-extended version of the value we want.
ValueConversion::Sext(abi_ty) => { ValueConversion::Sext(abi_ty) => {
@ -261,18 +259,14 @@ fn convert_from_abi<GetArg>(dfg: &mut DataFlowGraph,
// TODO: Currently, we don't take advantage of the ABI argument being sign-extended. // TODO: Currently, we don't take advantage of the ABI argument being sign-extended.
// We could insert an `assert_sreduce` which would fold with a following `sextend` of // We could insert an `assert_sreduce` which would fold with a following `sextend` of
// this value. // this value.
dfg.ins(pos) dfg.ins(pos).with_results([into_result]).ireduce(ty, arg)
.with_results([into_result])
.ireduce(ty, arg)
} }
ValueConversion::Uext(abi_ty) => { ValueConversion::Uext(abi_ty) => {
let arg = convert_from_abi(dfg, pos, abi_ty, None, get_arg); let arg = convert_from_abi(dfg, pos, abi_ty, None, get_arg);
// TODO: Currently, we don't take advantage of the ABI argument being sign-extended. // TODO: Currently, we don't take advantage of the ABI argument being sign-extended.
// We could insert an `assert_ureduce` which would fold with a following `uextend` of // We could insert an `assert_ureduce` which would fold with a following `uextend` of
// this value. // this value.
dfg.ins(pos) dfg.ins(pos).with_results([into_result]).ireduce(ty, arg)
.with_results([into_result])
.ireduce(ty, arg)
} }
} }
} }

28
lib/cretonne/src/regalloc/allocatable_set.rs

@ -137,21 +137,21 @@ mod tests {
// Register classes for testing. // Register classes for testing.
const GPR: RegClass = &RegClassData { const GPR: RegClass = &RegClassData {
name: "GPR", name: "GPR",
index: 0, index: 0,
width: 1, width: 1,
first: 28, first: 28,
subclasses: 0, subclasses: 0,
mask: [0xf0000000, 0x0000000f, 0], mask: [0xf0000000, 0x0000000f, 0],
}; };
const DPR: RegClass = &RegClassData { const DPR: RegClass = &RegClassData {
name: "DPR", name: "DPR",
index: 0, index: 0,
width: 2, width: 2,
first: 28, first: 28,
subclasses: 0, subclasses: 0,
mask: [0x50000000, 0x0000000a, 0], mask: [0x50000000, 0x0000000a, 0],
}; };
#[test] #[test]
fn put_and_take() { fn put_and_take() {

8
lib/cretonne/src/regalloc/diversion.rs

@ -100,10 +100,10 @@ mod tests {
divs.regmove(v1, 10, 12); divs.regmove(v1, 10, 12);
assert_eq!(divs.diversion(v1), assert_eq!(divs.diversion(v1),
Some(&Diversion { Some(&Diversion {
value: v1, value: v1,
from: 10, from: 10,
to: 12, to: 12,
})); }));
assert_eq!(divs.diversion(v2), None); assert_eq!(divs.diversion(v2), None);
divs.regmove(v1, 12, 11); divs.regmove(v1, 12, 11);

3
lib/cretonne/src/regalloc/solver.rs

@ -414,8 +414,7 @@ impl Solver {
if self.inputs_done { if self.inputs_done {
self.regs_out.free(constraint, from); self.regs_out.free(constraint, from);
} }
self.vars self.vars.push(Variable::new_live(value, constraint, from));
.push(Variable::new_live(value, constraint, from));
} }
/// Check for conflicts between fixed input assignments and existing live values. /// Check for conflicts between fixed input assignments and existing live values.

32
lib/cretonne/src/verifier/mod.rs

@ -234,20 +234,20 @@ impl<'a> Verifier<'a> {
self.verify_value_list(inst, args)?; self.verify_value_list(inst, args)?;
} }
&Jump { &Jump {
destination, destination,
ref args, ref args,
.. ..
} | } |
&Branch { &Branch {
destination, destination,
ref args, ref args,
.. ..
} | } |
&BranchIcmp { &BranchIcmp {
destination, destination,
ref args, ref args,
.. ..
} => { } => {
self.verify_ebb(inst, destination)?; self.verify_ebb(inst, destination)?;
self.verify_value_list(inst, args)?; self.verify_value_list(inst, args)?;
} }
@ -381,8 +381,7 @@ impl<'a> Verifier<'a> {
ebb); ebb);
} }
// The defining EBB dominates the instruction using this value. // The defining EBB dominates the instruction using this value.
if !self.domtree if !self.domtree.ebb_dominates(ebb, loc_inst, &self.func.layout) {
.ebb_dominates(ebb, loc_inst, &self.func.layout) {
return err!(loc_inst, "uses value arg from non-dominating {}", ebb); return err!(loc_inst, "uses value arg from non-dominating {}", ebb);
} }
} }
@ -639,10 +638,7 @@ impl<'a> Verifier<'a> {
return err!(ebb, "cfg had unexpected successor(s) {:?}", excess_succs); return err!(ebb, "cfg had unexpected successor(s) {:?}", excess_succs);
} }
expected_preds.extend(self.cfg expected_preds.extend(self.cfg.get_predecessors(ebb).iter().map(|&(_, inst)| inst));
.get_predecessors(ebb)
.iter()
.map(|&(_, inst)| inst));
got_preds.extend(cfg.get_predecessors(ebb).iter().map(|&(_, inst)| inst)); got_preds.extend(cfg.get_predecessors(ebb).iter().map(|&(_, inst)| inst));
let missing_preds: Vec<Inst> = expected_preds.difference(&got_preds).cloned().collect(); let missing_preds: Vec<Inst> = expected_preds.difference(&got_preds).cloned().collect();

6
lib/filecheck/src/checker.rs

@ -416,11 +416,9 @@ mod tests {
Ok(true)); Ok(true));
assert_eq!(b.directive("regex: X = tommy").map_err(e2s), assert_eq!(b.directive("regex: X = tommy").map_err(e2s),
Err("expected '=' after variable 'X' in regex: X = tommy".to_string())); Err("expected '=' after variable 'X' in regex: X = tommy".to_string()));
assert_eq!(b.directive("[arm]not: patt $x $(y) here") assert_eq!(b.directive("[arm]not: patt $x $(y) here").map_err(e2s),
.map_err(e2s),
Ok(true)); Ok(true));
assert_eq!(b.directive("[x86]sameln: $x $(y=[^]]*) there") assert_eq!(b.directive("[x86]sameln: $x $(y=[^]]*) there").map_err(e2s),
.map_err(e2s),
Ok(true)); Ok(true));
// Windows line ending sneaking in. // Windows line ending sneaking in.
assert_eq!(b.directive("regex: Y=foo\r").map_err(e2s), Ok(true)); assert_eq!(b.directive("regex: Y=foo\r").map_err(e2s), Ok(true));

16
lib/reader/src/lexer.rs

@ -296,7 +296,7 @@ impl<'a> Lexer<'a> {
token(split_entity_name(text) token(split_entity_name(text)
.and_then(|(prefix, number)| { .and_then(|(prefix, number)| {
Self::numbered_entity(prefix, number) Self::numbered_entity(prefix, number)
.or_else(|| Self::value_type(text, prefix, number)) .or_else(|| Self::value_type(text, prefix, number))
}) })
.unwrap_or(Token::Identifier(text)), .unwrap_or(Token::Identifier(text)),
loc) loc)
@ -413,14 +413,14 @@ impl<'a> Lexer<'a> {
Some('%') => Some(self.scan_name()), Some('%') => Some(self.scan_name()),
Some('#') => Some(self.scan_hex_sequence()), Some('#') => Some(self.scan_hex_sequence()),
Some(ch) if ch.is_whitespace() => { Some(ch) if ch.is_whitespace() => {
self.next_ch(); self.next_ch();
continue; continue;
} }
_ => { _ => {
// Skip invalid char, return error. // Skip invalid char, return error.
self.next_ch(); self.next_ch();
Some(error(Error::InvalidChar, loc)) Some(error(Error::InvalidChar, loc))
} }
}; };
} }
} }

98
lib/reader/src/parser.rs

@ -29,12 +29,7 @@ use sourcemap::{SourceMap, MutableSourceMap};
/// ///
/// Any test commands or ISA declarations are ignored. /// Any test commands or ISA declarations are ignored.
pub fn parse_functions(text: &str) -> Result<Vec<Function>> { pub fn parse_functions(text: &str) -> Result<Vec<Function>> {
parse_test(text).map(|file| { parse_test(text).map(|file| file.functions.into_iter().map(|(func, _)| func).collect())
file.functions
.into_iter()
.map(|(func, _)| func)
.collect()
})
} }
/// Parse the entire `text` as a test case file. /// Parse the entire `text` as a test case file.
@ -753,9 +748,7 @@ impl<'a> Parser<'a> {
sig.return_types = self.parse_argument_list(unique_isa)?; sig.return_types = self.parse_argument_list(unique_isa)?;
} }
if sig.argument_types if sig.argument_types.iter().all(|a| a.location.is_assigned()) {
.iter()
.all(|a| a.location.is_assigned()) {
sig.compute_argument_bytes(); sig.compute_argument_bytes();
} }
@ -1319,48 +1312,50 @@ impl<'a> Parser<'a> {
inst_data: &InstructionData) inst_data: &InstructionData)
-> Result<Type> { -> Result<Type> {
let constraints = opcode.constraints(); let constraints = opcode.constraints();
let ctrl_type = let ctrl_type = match explicit_ctrl_type {
match explicit_ctrl_type { Some(t) => t,
Some(t) => t, None => {
None => { if constraints.use_typevar_operand() {
if constraints.use_typevar_operand() { // This is an opcode that supports type inference, AND there was no
// This is an opcode that supports type inference, AND there was no // explicit type specified. Look up `ctrl_value` to see if it was defined
// explicit type specified. Look up `ctrl_value` to see if it was defined // already.
// already. // TBD: If it is defined in another block, the type should have been
// TBD: If it is defined in another block, the type should have been // specified explicitly. It is unfortunate that the correctness of IL
// specified explicitly. It is unfortunate that the correctness of IL // depends on the layout of the blocks.
// depends on the layout of the blocks. let ctrl_src_value = inst_data
let ctrl_src_value = inst_data .typevar_operand(&ctx.function.dfg.value_lists)
.typevar_operand(&ctx.function.dfg.value_lists) .expect("Constraints <-> Format inconsistency");
.expect("Constraints <-> Format inconsistency"); ctx.function
ctx.function.dfg.value_type(match ctx.map.get_value(ctrl_src_value) { .dfg
Some(v) => v, .value_type(match ctx.map.get_value(ctrl_src_value) {
None => { Some(v) => v,
if let Some(v) = ctx.aliases None => {
.get(&ctrl_src_value) if let Some(v) = ctx.aliases
.and_then(|&(aliased, _)| ctx.map.get_value(aliased)) .get(&ctrl_src_value)
{ .and_then(|&(aliased, _)| {
v ctx.map.get_value(aliased)
} else { }) {
return err!(self.loc, v
"cannot determine type of operand {}", } else {
ctrl_src_value); return err!(self.loc,
} "cannot determine type of operand {}",
} ctrl_src_value);
}) }
} else if constraints.is_polymorphic() { }
// This opcode does not support type inference, so the explicit type })
// variable is required. } else if constraints.is_polymorphic() {
return err!(self.loc, // This opcode does not support type inference, so the explicit type
"type variable required for polymorphic opcode, e.g. '{}.{}'", // variable is required.
opcode, return err!(self.loc,
constraints.ctrl_typeset().unwrap().example()); "type variable required for polymorphic opcode, e.g. '{}.{}'",
} else { opcode,
// This is a non-polymorphic opcode. No typevar needed. constraints.ctrl_typeset().unwrap().example());
VOID } else {
} // This is a non-polymorphic opcode. No typevar needed.
VOID
} }
}; }
};
// Verify that `ctrl_type` is valid for the controlling type variable. We don't want to // Verify that `ctrl_type` is valid for the controlling type variable. We don't want to
// attempt deriving types from an incorrect basis. // attempt deriving types from an incorrect basis.
@ -1616,8 +1611,7 @@ impl<'a> Parser<'a> {
InstructionFormat::BranchTable => { InstructionFormat::BranchTable => {
let arg = self.match_value("expected SSA value operand")?; let arg = self.match_value("expected SSA value operand")?;
self.match_token(Token::Comma, "expected ',' between operands")?; self.match_token(Token::Comma, "expected ',' between operands")?;
let table = self.match_jt() let table = self.match_jt().and_then(|num| ctx.get_jt(num, &self.loc))?;
.and_then(|num| ctx.get_jt(num, &self.loc))?;
InstructionData::BranchTable { opcode, arg, table } InstructionData::BranchTable { opcode, arg, table }
} }
InstructionFormat::StackLoad => { InstructionFormat::StackLoad => {

4
src/filetest/concurrent.rs

@ -119,9 +119,7 @@ fn worker_thread(thread_num: usize,
// Tell them we're starting this job. // Tell them we're starting this job.
// The receiver should always be present for this as long as we have jobs. // The receiver should always be present for this as long as we have jobs.
replies replies.send(Reply::Starting { jobid, thread_num }).unwrap();
.send(Reply::Starting { jobid, thread_num })
.unwrap();
let result = catch_unwind(|| runone::run(path.as_path())).unwrap_or_else(|e| { let result = catch_unwind(|| runone::run(path.as_path())).unwrap_or_else(|e| {
// The test panicked, leaving us a `Box<Any>`. // The test panicked, leaving us a `Box<Any>`.

4
src/filetest/runner.rs

@ -207,9 +207,7 @@ impl TestRunner {
} }
// Check for any asynchronous replies without blocking. // Check for any asynchronous replies without blocking.
while let Some(reply) = self.threads while let Some(reply) = self.threads.as_mut().and_then(ConcurrentRunner::try_get) {
.as_mut()
.and_then(ConcurrentRunner::try_get) {
self.handle_reply(reply); self.handle_reply(reply);
} }
} }

Loading…
Cancel
Save