1
Fork 0

Make hidden type registration opt-in, so that each site can be reviewed on its own and we have the right defaults for trait solvers

This commit is contained in:
Oli Scherer 2023-02-10 16:42:53 +00:00
parent bda32a4023
commit 88a7b6803b
15 changed files with 51 additions and 26 deletions

View file

@ -55,7 +55,7 @@ impl<'tcx> InferCtxt<'tcx> {
cause: &'a ObligationCause<'tcx>,
param_env: ty::ParamEnv<'tcx>,
) -> At<'a, 'tcx> {
At { infcx: self, cause, param_env, define_opaque_types: true }
At { infcx: self, cause, param_env, define_opaque_types: false }
}
/// Forks the inference context, creating a new inference context with the same inference

View file

@ -264,7 +264,7 @@ pub struct InferCtxt<'tcx> {
/// short lived InferCtxt within queries. The opaque type obligations are forwarded
/// to the outside until the end up in an `InferCtxt` for typeck or borrowck.
///
/// It is default value is `DefiningAnchor::Error`, this way it is easier to catch errors that
/// Its default value is `DefiningAnchor::Error`, this way it is easier to catch errors that
/// might come up during inference or typeck.
pub defining_use_anchor: DefiningAnchor,

View file

@ -545,8 +545,11 @@ impl<'tcx> InferCtxt<'tcx> {
origin,
);
if let Some(prev) = prev {
obligations =
self.at(&cause, param_env).eq_exp(a_is_expected, prev, hidden_ty)?.obligations;
obligations = self
.at(&cause, param_env)
.define_opaque_types(true)
.eq_exp(a_is_expected, prev, hidden_ty)?
.obligations;
}
let item_bounds = tcx.bound_explicit_item_bounds(def_id.to_def_id());