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:
commit
0ee258009c
41 changed files with 135 additions and 339 deletions
|
@ -11,7 +11,6 @@ use std::assert_matches::assert_matches;
|
|||
|
||||
use itertools::Itertools;
|
||||
use rustc_hir as hir;
|
||||
use rustc_infer::infer::type_variable::TypeVariableOrigin;
|
||||
use rustc_infer::infer::{BoundRegionConversionTime, RegionVariableOrigin};
|
||||
use rustc_middle::mir::*;
|
||||
use rustc_middle::ty::{self, Ty};
|
||||
|
@ -74,9 +73,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
|
|||
}),
|
||||
);
|
||||
|
||||
let next_ty_var = || {
|
||||
self.infcx.next_ty_var(TypeVariableOrigin { span: body.span, param_def_id: None })
|
||||
};
|
||||
let next_ty_var = || self.infcx.next_ty_var(body.span);
|
||||
let output_ty = Ty::new_coroutine(
|
||||
self.tcx(),
|
||||
self.tcx().coroutine_for_closure(mir_def_id),
|
||||
|
|
|
@ -16,7 +16,6 @@ use rustc_index::{IndexSlice, IndexVec};
|
|||
use rustc_infer::infer::canonical::QueryRegionConstraints;
|
||||
use rustc_infer::infer::outlives::env::RegionBoundPairs;
|
||||
use rustc_infer::infer::region_constraints::RegionConstraintData;
|
||||
use rustc_infer::infer::type_variable::TypeVariableOrigin;
|
||||
use rustc_infer::infer::{
|
||||
BoundRegion, BoundRegionConversionTime, InferCtxt, NllRegionVariableOrigin,
|
||||
};
|
||||
|
@ -2356,10 +2355,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
|
|||
// Types with regions are comparable if they have a common super-type.
|
||||
ty::RawPtr(_, _) | ty::FnPtr(_) => {
|
||||
let ty_right = right.ty(body, tcx);
|
||||
let common_ty = self.infcx.next_ty_var(TypeVariableOrigin {
|
||||
param_def_id: None,
|
||||
span: body.source_info(location).span,
|
||||
});
|
||||
let common_ty = self.infcx.next_ty_var(body.source_info(location).span);
|
||||
self.sub_types(
|
||||
ty_left,
|
||||
common_ty,
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
use rustc_data_structures::fx::FxHashMap;
|
||||
use rustc_errors::ErrorGuaranteed;
|
||||
use rustc_infer::infer::type_variable::TypeVariableOrigin;
|
||||
use rustc_infer::infer::NllRegionVariableOrigin;
|
||||
use rustc_infer::infer::{ObligationEmittingRelation, StructurallyRelateAliases};
|
||||
use rustc_infer::traits::{Obligation, PredicateObligations};
|
||||
|
@ -129,10 +128,7 @@ impl<'me, 'bccx, 'tcx> NllTypeRelating<'me, 'bccx, 'tcx> {
|
|||
// by using `ty_vid rel B` and then finally and end by equating `ty_vid` to
|
||||
// the opaque.
|
||||
let mut enable_subtyping = |ty, opaque_is_expected| {
|
||||
let ty_vid = infcx.next_ty_var_id_in_universe(
|
||||
TypeVariableOrigin { param_def_id: None, span: self.span() },
|
||||
ty::UniverseIndex::ROOT,
|
||||
);
|
||||
let ty_vid = infcx.next_ty_var_id_in_universe(self.span(), ty::UniverseIndex::ROOT);
|
||||
|
||||
let variance = if opaque_is_expected {
|
||||
self.ambient_variance
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue