Skip to content

Commit 8b1c02d

Browse files
Record more kinds of things as impl where bounds
1 parent 8fc8fa5 commit 8b1c02d

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
@@ -59,15 +59,15 @@ pub(super) trait GoalKind<'tcx>:
5959
/// goal by equating it with the assumption.
6060
fn probe_and_consider_implied_clause(
6161
ecx: &mut EvalCtxt<'_, 'tcx>,
62-
source: CandidateSource,
62+
parent_source: CandidateSource,
6363
goal: Goal<'tcx, Self>,
6464
assumption: ty::Clause<'tcx>,
65-
requirements: impl IntoIterator<Item = Goal<'tcx, ty::Predicate<'tcx>>>,
65+
requirements: impl IntoIterator<Item = (GoalSource, Goal<'tcx, ty::Predicate<'tcx>>)>,
6666
) -> Result<Candidate<'tcx>, NoSolution> {
67-
Self::probe_and_match_goal_against_assumption(ecx, source, goal, assumption, |ecx| {
68-
// FIXME(-Znext-solver=coinductive): check whether this should be
69-
// `GoalSource::ImplWhereBound` for any caller.
70-
ecx.add_goals(GoalSource::Misc, requirements);
67+
Self::probe_and_match_goal_against_assumption(ecx, parent_source, goal, assumption, |ecx| {
68+
for (nested_source, goal) in requirements {
69+
ecx.add_goal(nested_source, goal);
70+
}
7171
ecx.evaluate_added_goals_and_make_canonical_response(Certainty::Yes)
7272
})
7373
}
@@ -86,9 +86,8 @@ pub(super) trait GoalKind<'tcx>:
8686
let ty::Dynamic(bounds, _, _) = *goal.predicate.self_ty().kind() else {
8787
bug!("expected object type in `probe_and_consider_object_bound_candidate`");
8888
};
89-
// FIXME(-Znext-solver=coinductive): Should this be `GoalSource::ImplWhereBound`?
9089
ecx.add_goals(
91-
GoalSource::Misc,
90+
GoalSource::ImplWhereBound,
9291
structural_traits::predicates_for_object_candidate(
9392
ecx,
9493
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)