1
Fork 0

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

@ -1,6 +1,5 @@
use rustc_hir::{def::DefKind, Body, Item, ItemKind, Node, TyKind};
use rustc_hir::{Path, QPath};
use rustc_infer::infer::type_variable::TypeVariableOrigin;
use rustc_infer::infer::InferCtxt;
use rustc_infer::traits::{Obligation, ObligationCause};
use rustc_middle::ty::{self, Binder, Ty, TyCtxt, TypeFoldable, TypeFolder};
@ -337,7 +336,7 @@ impl<'a, 'tcx, F: FnMut(DefId) -> bool> TypeFolder<TyCtxt<'tcx>>
if let Some(def) = t.ty_adt_def()
&& (self.did_has_local_parent)(def.did())
{
self.infcx.next_ty_var(TypeVariableOrigin { param_def_id: None, span: self.infer_span })
self.infcx.next_ty_var(self.infer_span)
} else {
t.super_fold_with(self)
}