Skip to content

Commit ba87e4d

Browse files
committed
Auto merge of rust-lang#115195 - cuviper:beta-next, r=cuviper
[beta] backport and stage0 bump - Bump to released stable compiler - Add projection obligations when comparing impl too rust-lang#115039 r? cuviper
2 parents 680cdf8 + dc84bde commit ba87e4d

File tree

3 files changed

+313
-373
lines changed

3 files changed

+313
-373
lines changed

compiler/rustc_hir_analysis/src/check/compare_impl_item.rs

+8-1
Original file line numberDiff line numberDiff line change
@@ -342,9 +342,16 @@ fn compare_method_predicate_entailment<'tcx>(
342342
continue;
343343
};
344344
for obligation in obligations {
345+
debug!(?obligation);
345346
match obligation.predicate.kind().skip_binder() {
347+
// We need to register Projection oblgiations too, because we may end up with
348+
// an implied `X::Item: 'a`, which gets desugared into `X::Item = ?0`, `?0: 'a`.
349+
// If we only register the region outlives obligation, this leads to an unconstrained var.
350+
// See `implied_bounds_entailment_alias_var` test.
346351
ty::PredicateKind::Clause(
347-
ty::ClauseKind::RegionOutlives(..) | ty::ClauseKind::TypeOutlives(..),
352+
ty::ClauseKind::RegionOutlives(..)
353+
| ty::ClauseKind::TypeOutlives(..)
354+
| ty::ClauseKind::Projection(..),
348355
) => ocx.register_obligation(obligation),
349356
ty::PredicateKind::Clause(ty::ClauseKind::WellFormed(arg)) => {
350357
if wf_args_seen.insert(arg) {

0 commit comments

Comments
 (0)