From 3e3e70d529d8c7d7c4d7bc4fefc9f109393b9245 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:19:43 +0200 Subject: Merging upstream version 1.69.0+dfsg1. Signed-off-by: Daniel Baumann --- .../src/infer/region_constraints/leak_check.rs | 10 +++++----- compiler/rustc_infer/src/infer/region_constraints/mod.rs | 16 +++++++++------- 2 files changed, 14 insertions(+), 12 deletions(-) (limited to 'compiler/rustc_infer/src/infer/region_constraints') diff --git a/compiler/rustc_infer/src/infer/region_constraints/leak_check.rs b/compiler/rustc_infer/src/infer/region_constraints/leak_check.rs index c46edc33f..e413b2bb5 100644 --- a/compiler/rustc_infer/src/infer/region_constraints/leak_check.rs +++ b/compiler/rustc_infer/src/infer/region_constraints/leak_check.rs @@ -280,7 +280,7 @@ impl<'me, 'tcx> LeakCheck<'me, 'tcx> { placeholder1: ty::PlaceholderRegion, placeholder2: ty::PlaceholderRegion, ) -> TypeError<'tcx> { - self.error(placeholder1, self.tcx.mk_region(ty::RePlaceholder(placeholder2))) + self.error(placeholder1, self.tcx.mk_re_placeholder(placeholder2)) } fn error( @@ -413,19 +413,19 @@ impl<'tcx> MiniGraph<'tcx> { for undo_entry in undo_log { match undo_entry { &AddConstraint(Constraint::VarSubVar(a, b)) => { - each_edge(tcx.mk_region(ReVar(a)), tcx.mk_region(ReVar(b))); + each_edge(tcx.mk_re_var(a), tcx.mk_re_var(b)); } &AddConstraint(Constraint::RegSubVar(a, b)) => { - each_edge(a, tcx.mk_region(ReVar(b))); + each_edge(a, tcx.mk_re_var(b)); } &AddConstraint(Constraint::VarSubReg(a, b)) => { - each_edge(tcx.mk_region(ReVar(a)), b); + each_edge(tcx.mk_re_var(a), b); } &AddConstraint(Constraint::RegSubReg(a, b)) => { each_edge(a, b); } &AddGiven(a, b) => { - each_edge(a, tcx.mk_region(ReVar(b))); + each_edge(a, tcx.mk_re_var(b)); } &AddVerify(i) => span_bug!( verifys[i].origin.span(), diff --git a/compiler/rustc_infer/src/infer/region_constraints/mod.rs b/compiler/rustc_infer/src/infer/region_constraints/mod.rs index 0428481b7..872f61747 100644 --- a/compiler/rustc_infer/src/infer/region_constraints/mod.rs +++ b/compiler/rustc_infer/src/infer/region_constraints/mod.rs @@ -249,7 +249,7 @@ pub enum VerifyBound<'tcx> { /// in that case we can show `'b: 'c`. But if `'?x` winds up being something /// else, the bound isn't relevant. /// -/// In the [`VerifyBound`], this struct is enclosed in `Binder to account +/// In the [`VerifyBound`], this struct is enclosed in `Binder` to account /// for cases like /// /// ```rust @@ -651,7 +651,7 @@ impl<'tcx> RegionConstraintCollector<'_, 'tcx> { let unified_region = self.unification_table().probe_value(rid); unified_region.0.unwrap_or_else(|| { let root = self.unification_table().find(rid).vid; - tcx.reuse_or_mk_region(region, ty::ReVar(root)) + tcx.mk_re_var(root) }) } _ => region, @@ -675,7 +675,7 @@ impl<'tcx> RegionConstraintCollector<'_, 'tcx> { ) -> Region<'tcx> { let vars = TwoRegions { a, b }; if let Some(&c) = self.combine_map(t).get(&vars) { - return tcx.mk_region(ReVar(c)); + return tcx.mk_re_var(c); } let a_universe = self.universe(a); let b_universe = self.universe(b); @@ -683,7 +683,7 @@ impl<'tcx> RegionConstraintCollector<'_, 'tcx> { let c = self.new_region_var(c_universe, MiscVariable(origin.span())); self.combine_map(t).insert(vars, c); self.undo_log.push(AddCombination(t, vars)); - let new_r = tcx.mk_region(ReVar(c)); + let new_r = tcx.mk_re_var(c); for old_r in [a, b] { match t { Glb => self.make_subregion(origin.clone(), new_r, old_r), @@ -696,9 +696,11 @@ impl<'tcx> RegionConstraintCollector<'_, 'tcx> { pub fn universe(&self, region: Region<'tcx>) -> ty::UniverseIndex { match *region { - ty::ReStatic | ty::ReErased | ty::ReFree(..) | ty::ReEarlyBound(..) => { - ty::UniverseIndex::ROOT - } + ty::ReStatic + | ty::ReErased + | ty::ReFree(..) + | ty::ReEarlyBound(..) + | ty::ReError(_) => ty::UniverseIndex::ROOT, ty::RePlaceholder(placeholder) => placeholder.universe, ty::ReVar(vid) => self.var_universe(vid), ty::ReLateBound(..) => bug!("universe(): encountered bound region {:?}", region), -- cgit v1.2.3