Inline and remove InferCtxtBuilder::with_defining_opaque_types.

It has a single use.
This commit is contained in:
Nicholas Nethercote 2024-10-02 08:41:38 +10:00
parent 0ca4784c45
commit deeb0c5cf3

View File

@ -569,14 +569,6 @@ pub fn with_opaque_type_inference(mut self, defining_anchor: LocalDefId) -> Self
self
}
pub fn with_defining_opaque_types(
mut self,
defining_opaque_types: &'tcx ty::List<LocalDefId>,
) -> Self {
self.defining_opaque_types = defining_opaque_types;
self
}
pub fn with_next_trait_solver(mut self, next_trait_solver: bool) -> Self {
self.next_trait_solver = next_trait_solver;
self
@ -605,14 +597,15 @@ pub fn skip_leak_check(mut self, skip_leak_check: bool) -> Self {
/// the bound values in `C` to their instantiated values in `V`
/// (in other words, `S(C) = V`).
pub fn build_with_canonical<T>(
self,
mut self,
span: Span,
canonical: &Canonical<'tcx, T>,
) -> (InferCtxt<'tcx>, T, CanonicalVarValues<'tcx>)
where
T: TypeFoldable<TyCtxt<'tcx>>,
{
let infcx = self.with_defining_opaque_types(canonical.defining_opaque_types).build();
self.defining_opaque_types = canonical.defining_opaque_types;
let infcx = self.build();
let (value, args) = infcx.instantiate_canonical(span, canonical);
(infcx, value, args)
}