Rollup merge of #124955 - nnethercote:next_ty_var, r=lcnr

Use fewer origins when creating type variables.

To reduce lots of repetitive boilerplate code. Details in the individual commit messages.

r? ``@lcnr``
This commit is contained in:
Matthias Krüger 2024-05-10 07:30:22 +02:00 committed by GitHub
commit 0ee258009c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
41 changed files with 135 additions and 339 deletions

View file

@ -9,7 +9,6 @@ use rustc_hir::def::{DefKind, Res};
use rustc_hir::intravisit;
use rustc_hir::{GenericParamKind, ImplItemKind};
use rustc_infer::infer::outlives::env::OutlivesEnvironment;
use rustc_infer::infer::type_variable::TypeVariableOrigin;
use rustc_infer::infer::{self, InferCtxt, TyCtxtInferExt};
use rustc_infer::traits::{util, FulfillmentError};
use rustc_middle::ty::error::{ExpectedFound, TypeError};
@ -800,10 +799,7 @@ impl<'tcx> TypeFolder<TyCtxt<'tcx>> for ImplTraitInTraitCollector<'_, 'tcx> {
bug!("FIXME(RPITIT): error here");
}
// Replace with infer var
let infer_ty = self
.ocx
.infcx
.next_ty_var(TypeVariableOrigin { span: self.span, param_def_id: None });
let infer_ty = self.ocx.infcx.next_ty_var(self.span);
self.types.insert(proj.def_id, (infer_ty, proj.args));
// Recurse into bounds
for (pred, pred_span) in self