Skip to content

Commit 70fc114

Browse files
authored
Rollup merge of rust-lang#107401 - lenko-d:remove_the_usize_field_from_CandidateSource_AliasBound, r=compiler-errors
remove the usize field from CandidateSource::AliasBound Fixes [rust-lang#107380](rust-lang#107380)
2 parents 40b63d0 + d3cf813 commit 70fc114

File tree

3 files changed

+5
-8
lines changed

3 files changed

+5
-8
lines changed

compiler/rustc_trait_selection/src/solve/assembly.rs

+3-6
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ pub(super) enum CandidateSource {
7878
/// let _y = x.clone();
7979
/// }
8080
/// ```
81-
AliasBound(usize),
81+
AliasBound,
8282
}
8383

8484
pub(super) trait GoalKind<'tcx>: TypeFoldable<'tcx> + Copy + Eq {
@@ -242,8 +242,6 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
242242
// NOTE: Alternatively we could call `evaluate_goal` here and only have a `Normalized` candidate.
243243
// This doesn't work as long as we use `CandidateSource` in winnowing.
244244
let goal = goal.with(tcx, goal.predicate.with_self_ty(tcx, normalized_ty));
245-
// FIXME: This is broken if we care about the `usize` of `AliasBound` because the self type
246-
// could be normalized to yet another projection with different item bounds.
247245
let normalized_candidates = self.assemble_and_evaluate_candidates(goal);
248246
for mut normalized_candidate in normalized_candidates {
249247
normalized_candidate.result =
@@ -368,15 +366,14 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
368366
ty::Alias(_, alias_ty) => alias_ty,
369367
};
370368

371-
for (i, (assumption, _)) in self
369+
for (assumption, _) in self
372370
.tcx()
373371
.bound_explicit_item_bounds(alias_ty.def_id)
374372
.subst_iter_copied(self.tcx(), alias_ty.substs)
375-
.enumerate()
376373
{
377374
match G::consider_assumption(self, goal, assumption) {
378375
Ok(result) => {
379-
candidates.push(Candidate { source: CandidateSource::AliasBound(i), result })
376+
candidates.push(Candidate { source: CandidateSource::AliasBound, result })
380377
}
381378
Err(NoSolution) => (),
382379
}

compiler/rustc_trait_selection/src/solve/project_goals.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
171171
(CandidateSource::Impl(_), _)
172172
| (CandidateSource::ParamEnv(_), _)
173173
| (CandidateSource::BuiltinImpl, _)
174-
| (CandidateSource::AliasBound(_), _) => unimplemented!(),
174+
| (CandidateSource::AliasBound, _) => unimplemented!(),
175175
}
176176
}
177177
}

compiler/rustc_trait_selection/src/solve/trait_goals.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
322322
match (candidate.source, other.source) {
323323
(CandidateSource::Impl(_), _)
324324
| (CandidateSource::ParamEnv(_), _)
325-
| (CandidateSource::AliasBound(_), _)
325+
| (CandidateSource::AliasBound, _)
326326
| (CandidateSource::BuiltinImpl, _) => unimplemented!(),
327327
}
328328
}

0 commit comments

Comments
 (0)