Rollup merge of #104411 - lcnr:bivariance-nll, r=compiler-errors
nll: correctly deal with bivariance fixes #104409 when in a bivariant context, relating stuff should always trivially succeed. Also changes the mir validator to correctly deal with higher ranked regions. r? types cc ``@RalfJung``
This commit is contained in:
commit
00876c68c4
10 changed files with 130 additions and 85 deletions
|
@ -449,8 +449,8 @@ fn check_opaque_meets_bounds<'tcx>(
|
|||
|
||||
let misc_cause = traits::ObligationCause::misc(span, hir_id);
|
||||
|
||||
match infcx.at(&misc_cause, param_env).eq(opaque_ty, hidden_ty) {
|
||||
Ok(infer_ok) => ocx.register_infer_ok_obligations(infer_ok),
|
||||
match ocx.eq(&misc_cause, param_env, opaque_ty, hidden_ty) {
|
||||
Ok(()) => {}
|
||||
Err(ty_err) => {
|
||||
tcx.sess.delay_span_bug(
|
||||
span,
|
||||
|
|
|
@ -402,10 +402,8 @@ pub fn collect_trait_impl_trait_tys<'tcx>(
|
|||
unnormalized_trait_sig.inputs_and_output.iter().chain(trait_sig.inputs_and_output.iter()),
|
||||
);
|
||||
|
||||
match infcx.at(&cause, param_env).eq(trait_return_ty, impl_return_ty) {
|
||||
Ok(infer::InferOk { value: (), obligations }) => {
|
||||
ocx.register_obligations(obligations);
|
||||
}
|
||||
match ocx.eq(&cause, param_env, trait_return_ty, impl_return_ty) {
|
||||
Ok(()) => {}
|
||||
Err(terr) => {
|
||||
let mut diag = struct_span_err!(
|
||||
tcx.sess,
|
||||
|
@ -442,10 +440,8 @@ pub fn collect_trait_impl_trait_tys<'tcx>(
|
|||
// the lifetimes of the return type, but do this after unifying just the
|
||||
// return types, since we want to avoid duplicating errors from
|
||||
// `compare_predicate_entailment`.
|
||||
match infcx.at(&cause, param_env).eq(trait_fty, impl_fty) {
|
||||
Ok(infer::InferOk { value: (), obligations }) => {
|
||||
ocx.register_obligations(obligations);
|
||||
}
|
||||
match ocx.eq(&cause, param_env, trait_fty, impl_fty) {
|
||||
Ok(()) => {}
|
||||
Err(terr) => {
|
||||
// This function gets called during `compare_predicate_entailment` when normalizing a
|
||||
// signature that contains RPITIT. When the method signatures don't match, we have to
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue