Try not to make obligations in handle_opaque_type

This commit is contained in:
Michael Goulet 2024-06-07 11:51:03 -04:00
parent 4efb13b0c2
commit e4be97cfe7
6 changed files with 74 additions and 91 deletions

View file

@ -961,15 +961,15 @@ impl<'tcx> EvalCtxt<'_, InferCtxt<'tcx>> {
param_env: ty::ParamEnv<'tcx>,
hidden_ty: Ty<'tcx>,
) -> Result<(), NoSolution> {
let mut obligations = Vec::new();
let mut goals = Vec::new();
self.infcx.insert_hidden_type(
opaque_type_key,
&ObligationCause::dummy(),
DUMMY_SP,
param_env,
hidden_ty,
&mut obligations,
&mut goals,
)?;
self.add_goals(GoalSource::Misc, obligations.into_iter().map(|o| o.into()));
self.add_goals(GoalSource::Misc, goals);
Ok(())
}
@ -980,16 +980,15 @@ impl<'tcx> EvalCtxt<'_, InferCtxt<'tcx>> {
param_env: ty::ParamEnv<'tcx>,
hidden_ty: Ty<'tcx>,
) {
let mut obligations = Vec::new();
let mut goals = Vec::new();
self.infcx.add_item_bounds_for_hidden_type(
opaque_def_id,
opaque_args,
ObligationCause::dummy(),
param_env,
hidden_ty,
&mut obligations,
&mut goals,
);
self.add_goals(GoalSource::Misc, obligations.into_iter().map(|o| o.into()));
self.add_goals(GoalSource::Misc, goals);
}
// Do something for each opaque/hidden pair defined with `def_id` in the