This commit is contained in:
lcnr 2020-10-24 09:27:15 +02:00 committed by Bastian Kauschke
parent 80acfea5a7
commit a6cbd64dae
19 changed files with 87 additions and 105 deletions

View file

@ -671,9 +671,9 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
}
}
OutputTypeParameterMismatch(ref found_trait_ref, ref expected_trait_ref, _) => {
let found_trait_ref = self.resolve_vars_if_possible(*found_trait_ref);
let expected_trait_ref = self.resolve_vars_if_possible(*expected_trait_ref);
OutputTypeParameterMismatch(found_trait_ref, expected_trait_ref, _) => {
let found_trait_ref = self.resolve_vars_if_possible(found_trait_ref);
let expected_trait_ref = self.resolve_vars_if_possible(expected_trait_ref);
if expected_trait_ref.self_ty().references_error() {
return;

View file

@ -365,7 +365,7 @@ impl<'a, 'b, 'tcx> TypeFolder<'tcx> for AssocTypeNormalizer<'a, 'b, 'tcx> {
}
}
ty::Projection(ref data) if !data.has_escaping_bound_vars() => {
ty::Projection(data) if !data.has_escaping_bound_vars() => {
// This is kind of hacky -- we need to be able to
// handle normalization within binders because
// otherwise we wind up a need to normalize when doing
@ -381,7 +381,7 @@ impl<'a, 'b, 'tcx> TypeFolder<'tcx> for AssocTypeNormalizer<'a, 'b, 'tcx> {
let normalized_ty = normalize_projection_type(
self.selcx,
self.param_env,
*data,
data,
self.cause.clone(),
self.depth,
&mut self.obligations,

View file

@ -43,7 +43,7 @@ impl<'cx, 'tcx> AtExt<'tcx> for At<'cx, 'tcx> {
let c_ty = self.infcx.canonicalize_query(self.param_env.and(ty), &mut orig_values);
let span = self.cause.span;
debug!("c_ty = {:?}", c_ty);
if let Ok(result) = &tcx.dropck_outlives(c_ty) {
if let Ok(result) = tcx.dropck_outlives(c_ty) {
if result.is_proven() {
if let Ok(InferOk { value, obligations }) =
self.infcx.instantiate_query_response_and_region_obligations(

View file

@ -145,7 +145,7 @@ impl<'cx, 'tcx> TypeFolder<'tcx> for QueryNormalizer<'cx, 'tcx> {
}
}
ty::Projection(ref data) if !data.has_escaping_bound_vars() => {
ty::Projection(data) if !data.has_escaping_bound_vars() => {
// This is kind of hacky -- we need to be able to
// handle normalization within binders because
// otherwise we wind up a need to normalize when doing
@ -165,7 +165,7 @@ impl<'cx, 'tcx> TypeFolder<'tcx> for QueryNormalizer<'cx, 'tcx> {
// so we cannot canonicalize it.
let c_data = self
.infcx
.canonicalize_hr_query_hack(self.param_env.and(*data), &mut orig_values);
.canonicalize_hr_query_hack(self.param_env.and(data), &mut orig_values);
debug!("QueryNormalizer: c_data = {:#?}", c_data);
debug!("QueryNormalizer: orig_values = {:#?}", orig_values);
match tcx.normalize_projection_ty(c_data) {
@ -180,7 +180,7 @@ impl<'cx, 'tcx> TypeFolder<'tcx> for QueryNormalizer<'cx, 'tcx> {
self.cause,
self.param_env,
&orig_values,
&result,
result,
) {
Ok(InferOk { value: result, obligations }) => {
debug!("QueryNormalizer: result = {:#?}", result);

View file

@ -68,7 +68,7 @@ impl<'cx, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'cx, 'tcx> {
&ObligationCause::misc(span, body_id),
param_env,
&orig_values,
&result,
result,
);
debug!("implied_outlives_bounds for {:?}: {:#?}", ty, result);
let result = match result {

View file

@ -81,16 +81,14 @@ pub trait QueryTypeOp<'tcx>: fmt::Debug + Sized + TypeFoldable<'tcx> + 'tcx {
// like the subtype query, which go awry around
// `'static` otherwise.
let mut canonical_var_values = OriginalQueryValues::default();
let canonical_self =
infcx.canonicalize_hr_query_hack(query_key.clone(), &mut canonical_var_values);
let old_param_env = query_key.param_env;
let canonical_self = infcx.canonicalize_hr_query_hack(query_key, &mut canonical_var_values);
let canonical_result = Self::perform_query(infcx.tcx, canonical_self)?;
let param_env = query_key.param_env;
let InferOk { value, obligations } = infcx
.instantiate_nll_query_response_and_region_obligations(
&ObligationCause::dummy(),
param_env,
old_param_env,
&canonical_var_values,
canonical_result,
output_query_region_constraints,