Skip to content

Commit cfc4c29

Browse files
committed
Auto merge of #118114 - compiler-errors:closure-kind-fnonce, r=<try>
Always make progress on `FnOnce` `ClosureKind` goals in the old solver All closures always implement `FnOnce`. IDK if this is worthwhile, but it does mean goals get flushed sooner.
2 parents 3a85a5c + 0e9241c commit cfc4c29

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

compiler/rustc_trait_selection/src/traits/fulfill.rs

+7-1
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,13 @@ impl<'a, 'tcx> ObligationProcessor for FulfillProcessor<'a, 'tcx> {
420420
ProcessResult::Error(CodeSelectionError(Unimplemented))
421421
}
422422
}
423-
None => ProcessResult::Unchanged,
423+
None => {
424+
if kind == ty::ClosureKind::FnOnce {
425+
ProcessResult::Changed(vec![])
426+
} else {
427+
ProcessResult::Unchanged
428+
}
429+
}
424430
}
425431
}
426432

compiler/rustc_trait_selection/src/traits/select/mod.rs

+7-1
Original file line numberDiff line numberDiff line change
@@ -894,7 +894,13 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
894894
Ok(EvaluatedToErr)
895895
}
896896
}
897-
None => Ok(EvaluatedToAmbig),
897+
None => {
898+
if kind == ty::ClosureKind::FnOnce {
899+
Ok(EvaluatedToOk)
900+
} else {
901+
Ok(EvaluatedToAmbig)
902+
}
903+
}
898904
}
899905
}
900906

0 commit comments

Comments
 (0)