Skip to content

Commit

Permalink
Auto merge of #118114 - compiler-errors:closure-kind-fnonce, r=<try>
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
bors committed Nov 21, 2023
2 parents 3a85a5c + 0e9241c commit cfc4c29
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
8 changes: 7 additions & 1 deletion compiler/rustc_trait_selection/src/traits/fulfill.rs
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,13 @@ impl<'a, 'tcx> ObligationProcessor for FulfillProcessor<'a, 'tcx> {
ProcessResult::Error(CodeSelectionError(Unimplemented))
}
}
None => ProcessResult::Unchanged,
None => {
if kind == ty::ClosureKind::FnOnce {
ProcessResult::Changed(vec![])
} else {
ProcessResult::Unchanged
}
}
}
}

Expand Down
8 changes: 7 additions & 1 deletion compiler/rustc_trait_selection/src/traits/select/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -894,7 +894,13 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
Ok(EvaluatedToErr)
}
}
None => Ok(EvaluatedToAmbig),
None => {
if kind == ty::ClosureKind::FnOnce {
Ok(EvaluatedToOk)
} else {
Ok(EvaluatedToAmbig)
}
}
}
}

Expand Down

0 comments on commit cfc4c29

Please sign in to comment.