Consider Copy/Clone too

This commit is contained in:
Michael Goulet 2025-04-18 17:26:30 +00:00
parent 1727badf77
commit 7c1661f945
2 changed files with 18 additions and 1 deletions

View File

@ -208,6 +208,7 @@ where
}
}
// TODO:
if let ty::CoroutineWitness(def_id, _) = goal.predicate.self_ty().kind() {
match ecx.typing_mode() {
TypingMode::Analysis { stalled_generators, defining_opaque_types: _ } => {
@ -274,6 +275,22 @@ where
return Err(NoSolution);
}
// TODO:
if let ty::CoroutineWitness(def_id, _) = goal.predicate.self_ty().kind() {
match ecx.typing_mode() {
TypingMode::Analysis { stalled_generators, defining_opaque_types: _ } => {
if def_id.as_local().is_some_and(|def_id| stalled_generators.contains(&def_id))
{
return ecx.forced_ambiguity(MaybeCause::Ambiguity);
}
}
TypingMode::Coherence
| TypingMode::PostAnalysis
| TypingMode::Borrowck { defining_opaque_types: _ }
| TypingMode::PostBorrowckAnalysis { defined_opaque_types: _ } => {}
}
}
ecx.probe_and_evaluate_goal_for_constituent_tys(
CandidateSource::BuiltinImpl(BuiltinImplSource::Misc),
goal,

View File

@ -34,7 +34,7 @@ impl<'tcx> InferCtxt<'tcx> {
// FIXME(#132279): This should be removed as it causes us to incorrectly
// handle opaques in their defining scope.
if !(param_env, ty).has_infer() {
if !self.next_trait_solver() && !(param_env, ty).has_infer() {
return self.tcx.type_is_copy_modulo_regions(self.typing_env(param_env), ty);
}