Register member constraints on the final merged hidden type
Previously we did this per hidden type candiate, which didn't always have all the information available.
This commit is contained in:
parent
9110911353
commit
7bce50c01a
13 changed files with 62 additions and 96 deletions
|
@ -723,7 +723,7 @@ impl<'tcx> TypeRelatingDelegate<'tcx> for QueryTypeRelatingDelegate<'_, 'tcx> {
|
|||
true
|
||||
}
|
||||
|
||||
fn constrain_opaque_type(&mut self, a: Ty<'tcx>, b: Ty<'tcx>, a_is_expected: bool) {
|
||||
fn register_opaque_type(&mut self, a: Ty<'tcx>, b: Ty<'tcx>, a_is_expected: bool) {
|
||||
self.obligations.push(self.infcx.opaque_ty_obligation(
|
||||
a,
|
||||
b,
|
||||
|
|
|
@ -90,7 +90,7 @@ pub trait TypeRelatingDelegate<'tcx> {
|
|||
info: ty::VarianceDiagInfo<'tcx>,
|
||||
);
|
||||
|
||||
fn constrain_opaque_type(&mut self, a: Ty<'tcx>, b: Ty<'tcx>, a_is_expected: bool);
|
||||
fn register_opaque_type(&mut self, a: Ty<'tcx>, b: Ty<'tcx>, a_is_expected: bool);
|
||||
|
||||
fn const_equate(&mut self, a: &'tcx ty::Const<'tcx>, b: &'tcx ty::Const<'tcx>);
|
||||
|
||||
|
@ -591,7 +591,7 @@ where
|
|||
(_, &ty::Opaque(..)) => (generalize(a, true)?, b),
|
||||
_ => unreachable!(),
|
||||
};
|
||||
self.delegate.constrain_opaque_type(a, b, true);
|
||||
self.delegate.register_opaque_type(a, b, true);
|
||||
trace!(a = ?a.kind(), b = ?b.kind(), "opaque type instantiated");
|
||||
Ok(a)
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use crate::infer::type_variable::{TypeVariableOrigin, TypeVariableOriginKind};
|
||||
use crate::infer::{InferCtxt, InferOk, InferResult};
|
||||
use crate::infer::{InferCtxt, InferOk};
|
||||
use crate::traits::{self, PredicateObligation, PredicateObligations};
|
||||
use hir::def_id::{DefId, LocalDefId};
|
||||
use hir::OpaqueTyOrigin;
|
||||
|
@ -379,13 +379,13 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
|
|||
/// - `free_region_relations` -- something that can be used to relate
|
||||
/// the free regions (`'a`) that appear in the impl trait.
|
||||
#[instrument(level = "debug", skip(self))]
|
||||
pub fn constrain_opaque_type(
|
||||
pub fn register_member_constraints(
|
||||
&self,
|
||||
param_env: ty::ParamEnv<'tcx>,
|
||||
opaque_type_key: OpaqueTypeKey<'tcx>,
|
||||
concrete_ty: Ty<'tcx>,
|
||||
span: Span,
|
||||
) -> InferResult<'tcx, ()> {
|
||||
) {
|
||||
let def_id = opaque_type_key.def_id;
|
||||
|
||||
let tcx = self.tcx;
|
||||
|
@ -445,7 +445,6 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
|
|||
)
|
||||
},
|
||||
});
|
||||
Ok(InferOk { value: (), obligations: vec![] })
|
||||
}
|
||||
|
||||
pub fn opaque_ty_obligation(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue