Skip to content

Commit

Permalink
Rollup merge of rust-lang#104701 - compiler-errors:rpitit-remove-reem…
Browse files Browse the repository at this point in the history
…pty-hack, r=TaKO8Ki

Remove a lifetime resolution hack from `compare_predicate_entailment`

This is not needed anymore, probably due to rust-lang#102334 equating the function signatures fully in `collect_trait_impl_trait_tys`. Also, the assertion in in rust-lang#102903 makes sure that this is actually fixed, so I'm pretty confident this isn't needed.
  • Loading branch information
Dylan-DPC authored Nov 22, 2022
2 parents d29491a + 1c1778d commit b12d31f
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions compiler/rustc_hir_analysis/src/check/compare_method.rs
Original file line number Diff line number Diff line change
Expand Up @@ -288,17 +288,7 @@ fn compare_predicate_entailment<'tcx>(
// type would be more appropriate. In other places we have a `Vec<Span>`
// corresponding to their `Vec<Predicate>`, but we don't have that here.
// Fixing this would improve the output of test `issue-83765.rs`.
let mut result = ocx.sup(&cause, param_env, trait_fty, impl_fty);

// HACK(RPITIT): #101614. When we are trying to infer the hidden types for
// RPITITs, we need to equate the output tys instead of just subtyping. If
// we just use `sup` above, we'll end up `&'static str <: _#1t`, which causes
// us to infer `_#1t = #'_#2r str`, where `'_#2r` is unconstrained, which gets
// fixed up to `ReEmpty`, and which is certainly not what we want.
if trait_fty.has_infer_types() {
result =
result.and_then(|()| ocx.eq(&cause, param_env, trait_sig.output(), impl_sig.output()));
}
let result = ocx.sup(&cause, param_env, trait_fty, impl_fty);

if let Err(terr) = result {
debug!(?terr, "sub_types failed: impl ty {:?}, trait ty {:?}", impl_fty, trait_fty);
Expand Down

0 comments on commit b12d31f

Please sign in to comment.