Skip to content

Commit 382d0f7

Browse files
Record more kinds of things as impl where bounds
1 parent 6e3808e commit 382d0f7

File tree

3 files changed

+13
-12
lines changed

3 files changed

+13
-12
lines changed

compiler/rustc_trait_selection/src/solve/assembly/mod.rs

+7-8
Original file line numberDiff line numberDiff line change
@@ -58,15 +58,15 @@ pub(super) trait GoalKind<'tcx>:
5858
/// goal by equating it with the assumption.
5959
fn probe_and_consider_implied_clause(
6060
ecx: &mut EvalCtxt<'_, 'tcx>,
61-
source: CandidateSource,
61+
parent_source: CandidateSource,
6262
goal: Goal<'tcx, Self>,
6363
assumption: ty::Clause<'tcx>,
64-
requirements: impl IntoIterator<Item = Goal<'tcx, ty::Predicate<'tcx>>>,
64+
requirements: impl IntoIterator<Item = (GoalSource, Goal<'tcx, ty::Predicate<'tcx>>)>,
6565
) -> Result<Candidate<'tcx>, NoSolution> {
66-
Self::probe_and_match_goal_against_assumption(ecx, source, goal, assumption, |ecx| {
67-
// FIXME(-Znext-solver=coinductive): check whether this should be
68-
// `GoalSource::ImplWhereBound` for any caller.
69-
ecx.add_goals(GoalSource::Misc, requirements);
66+
Self::probe_and_match_goal_against_assumption(ecx, parent_source, goal, assumption, |ecx| {
67+
for (nested_source, goal) in requirements {
68+
ecx.add_goal(nested_source, goal);
69+
}
7070
ecx.evaluate_added_goals_and_make_canonical_response(Certainty::Yes)
7171
})
7272
}
@@ -85,9 +85,8 @@ pub(super) trait GoalKind<'tcx>:
8585
let ty::Dynamic(bounds, _, _) = *goal.predicate.self_ty().kind() else {
8686
bug!("expected object type in `probe_and_consider_object_bound_candidate`");
8787
};
88-
// FIXME(-Znext-solver=coinductive): Should this be `GoalSource::ImplWhereBound`?
8988
ecx.add_goals(
90-
GoalSource::Misc,
89+
GoalSource::ImplWhereBound,
9190
structural_traits::predicates_for_object_candidate(
9291
ecx,
9392
goal.param_env,

compiler/rustc_trait_selection/src/solve/normalizes_to/mod.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ impl<'tcx> assembly::GoalKind<'tcx> for NormalizesTo<'tcx> {
389389
CandidateSource::BuiltinImpl(BuiltinImplSource::Misc),
390390
goal,
391391
pred,
392-
[goal.with(tcx, output_is_sized_pred)],
392+
[(GoalSource::ImplWhereBound, goal.with(tcx, output_is_sized_pred))],
393393
)
394394
}
395395

@@ -473,7 +473,8 @@ impl<'tcx> assembly::GoalKind<'tcx> for NormalizesTo<'tcx> {
473473
pred,
474474
[goal.with(tcx, output_is_sized_pred)]
475475
.into_iter()
476-
.chain(nested_preds.into_iter().map(|pred| goal.with(tcx, pred))),
476+
.chain(nested_preds.into_iter().map(|pred| goal.with(tcx, pred)))
477+
.map(|goal| (GoalSource::ImplWhereBound, goal)),
477478
)
478479
}
479480

compiler/rustc_trait_selection/src/solve/trait_goals.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ impl<'tcx> assembly::GoalKind<'tcx> for TraitPredicate<'tcx> {
321321
CandidateSource::BuiltinImpl(BuiltinImplSource::Misc),
322322
goal,
323323
pred,
324-
[goal.with(tcx, output_is_sized_pred)],
324+
[(GoalSource::ImplWhereBound, goal.with(tcx, output_is_sized_pred))],
325325
)
326326
}
327327

@@ -367,7 +367,8 @@ impl<'tcx> assembly::GoalKind<'tcx> for TraitPredicate<'tcx> {
367367
pred,
368368
[goal.with(tcx, output_is_sized_pred)]
369369
.into_iter()
370-
.chain(nested_preds.into_iter().map(|pred| goal.with(tcx, pred))),
370+
.chain(nested_preds.into_iter().map(|pred| goal.with(tcx, pred)))
371+
.map(|goal| (GoalSource::ImplWhereBound, goal)),
371372
)
372373
}
373374

0 commit comments

Comments
 (0)