diff options
| author | Michael Goulet <michael@errs.io> | 2025-06-18 18:00:30 +0000 |
|---|---|---|
| committer | Michael Goulet <michael@errs.io> | 2025-06-25 15:35:18 +0000 |
| commit | c995070b6a312ff9f481d6de55f58bfe16a76bb7 (patch) | |
| tree | a7a8cafbad3fd9a945c7101eeb9552981ea76b5e /compiler | |
| parent | 44254c8cd79810fb2ff575d88e75c979bb7f1fc4 (diff) | |
| download | rust-c995070b6a312ff9f481d6de55f58bfe16a76bb7.tar.gz rust-c995070b6a312ff9f481d6de55f58bfe16a76bb7.zip | |
rename RegionVariableOrigin::MiscVariable to RegionVariableOrigin::Misc
Diffstat (limited to 'compiler')
13 files changed, 20 insertions, 27 deletions
diff --git a/compiler/rustc_borrowck/src/type_check/input_output.rs b/compiler/rustc_borrowck/src/type_check/input_output.rs index 0c46e0c0c22..99392ea1915 100644 --- a/compiler/rustc_borrowck/src/type_check/input_output.rs +++ b/compiler/rustc_borrowck/src/type_check/input_output.rs @@ -66,10 +66,9 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> { Ty::new_tup(self.tcx(), user_provided_sig.inputs()), args.tupled_upvars_ty(), args.coroutine_captures_by_ref_ty(), - self.infcx - .next_region_var(RegionVariableOrigin::MiscVariable(self.body.span), || { - RegionCtxt::Unknown - }), + self.infcx.next_region_var(RegionVariableOrigin::Misc(self.body.span), || { + RegionCtxt::Unknown + }), ); let next_ty_var = || self.infcx.next_ty_var(self.body.span); diff --git a/compiler/rustc_hir_analysis/src/check/check.rs b/compiler/rustc_hir_analysis/src/check/check.rs index 485dd1d2204..f08a2451496 100644 --- a/compiler/rustc_hir_analysis/src/check/check.rs +++ b/compiler/rustc_hir_analysis/src/check/check.rs @@ -312,7 +312,7 @@ fn check_opaque_meets_bounds<'tcx>( // here rather than using ReErased. let hidden_ty = tcx.type_of(def_id.to_def_id()).instantiate(tcx, args); let hidden_ty = fold_regions(tcx, hidden_ty, |re, _dbi| match re.kind() { - ty::ReErased => infcx.next_region_var(RegionVariableOrigin::MiscVariable(span)), + ty::ReErased => infcx.next_region_var(RegionVariableOrigin::Misc(span)), _ => re, }); diff --git a/compiler/rustc_hir_typeck/src/check.rs b/compiler/rustc_hir_typeck/src/check.rs index ac42eebf08c..61239685884 100644 --- a/compiler/rustc_hir_typeck/src/check.rs +++ b/compiler/rustc_hir_typeck/src/check.rs @@ -58,7 +58,7 @@ pub(super) fn check_fn<'a, 'tcx>( let maybe_va_list = fn_sig.c_variadic.then(|| { let span = body.params.last().unwrap().span; let va_list_did = tcx.require_lang_item(LangItem::VaList, span); - let region = fcx.next_region_var(RegionVariableOrigin::MiscVariable(span)); + let region = fcx.next_region_var(RegionVariableOrigin::Misc(span)); tcx.type_of(va_list_did).instantiate(tcx, &[region.into()]) }); diff --git a/compiler/rustc_hir_typeck/src/fn_ctxt/mod.rs b/compiler/rustc_hir_typeck/src/fn_ctxt/mod.rs index c8ebbe27be6..0c6226ce71e 100644 --- a/compiler/rustc_hir_typeck/src/fn_ctxt/mod.rs +++ b/compiler/rustc_hir_typeck/src/fn_ctxt/mod.rs @@ -247,7 +247,7 @@ impl<'tcx> HirTyLowerer<'tcx> for FnCtxt<'_, 'tcx> { RegionInferReason::Param(def) => { RegionVariableOrigin::RegionParameterDefinition(span, def.name) } - _ => RegionVariableOrigin::MiscVariable(span), + _ => RegionVariableOrigin::Misc(span), }; self.next_region_var(v) } diff --git a/compiler/rustc_hir_typeck/src/method/suggest.rs b/compiler/rustc_hir_typeck/src/method/suggest.rs index af1137297aa..d0a48872f75 100644 --- a/compiler/rustc_hir_typeck/src/method/suggest.rs +++ b/compiler/rustc_hir_typeck/src/method/suggest.rs @@ -2352,9 +2352,9 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { if !arg.is_suggestable(self.tcx, true) { has_unsuggestable_args = true; match arg.kind() { - GenericArgKind::Lifetime(_) => self - .next_region_var(RegionVariableOrigin::MiscVariable(DUMMY_SP)) - .into(), + GenericArgKind::Lifetime(_) => { + self.next_region_var(RegionVariableOrigin::Misc(DUMMY_SP)).into() + } GenericArgKind::Type(_) => self.next_ty_var(DUMMY_SP).into(), GenericArgKind::Const(_) => self.next_const_var(DUMMY_SP).into(), } diff --git a/compiler/rustc_infer/src/infer/canonical/mod.rs b/compiler/rustc_infer/src/infer/canonical/mod.rs index 5dffedc7099..79a2aa54ef8 100644 --- a/compiler/rustc_infer/src/infer/canonical/mod.rs +++ b/compiler/rustc_infer/src/infer/canonical/mod.rs @@ -128,10 +128,7 @@ impl<'tcx> InferCtxt<'tcx> { } CanonicalVarKind::Region(ui) => self - .next_region_var_in_universe( - RegionVariableOrigin::MiscVariable(span), - universe_map(ui), - ) + .next_region_var_in_universe(RegionVariableOrigin::Misc(span), universe_map(ui)) .into(), CanonicalVarKind::PlaceholderRegion(ty::PlaceholderRegion { universe, bound }) => { diff --git a/compiler/rustc_infer/src/infer/context.rs b/compiler/rustc_infer/src/infer/context.rs index f7c702d321b..bb9c8850093 100644 --- a/compiler/rustc_infer/src/infer/context.rs +++ b/compiler/rustc_infer/src/infer/context.rs @@ -141,7 +141,7 @@ impl<'tcx> rustc_type_ir::InferCtxtLike for InferCtxt<'tcx> { } fn next_region_infer(&self) -> ty::Region<'tcx> { - self.next_region_var(RegionVariableOrigin::MiscVariable(DUMMY_SP)) + self.next_region_var(RegionVariableOrigin::Misc(DUMMY_SP)) } fn next_ty_infer(&self) -> Ty<'tcx> { diff --git a/compiler/rustc_infer/src/infer/mod.rs b/compiler/rustc_infer/src/infer/mod.rs index c1b486194db..bfec0d12485 100644 --- a/compiler/rustc_infer/src/infer/mod.rs +++ b/compiler/rustc_infer/src/infer/mod.rs @@ -400,7 +400,7 @@ pub enum RegionVariableOrigin { /// Region variables created for ill-categorized reasons. /// /// They mostly indicate places in need of refactoring. - MiscVariable(Span), + Misc(Span), /// Regions created by a `&P` or `[...]` pattern. PatternRegion(Span), @@ -1526,7 +1526,7 @@ impl<'tcx> SubregionOrigin<'tcx> { impl RegionVariableOrigin { pub fn span(&self) -> Span { match *self { - RegionVariableOrigin::MiscVariable(a) + RegionVariableOrigin::Misc(a) | RegionVariableOrigin::PatternRegion(a) | RegionVariableOrigin::BorrowRegion(a) | RegionVariableOrigin::Autoref(a) diff --git a/compiler/rustc_infer/src/infer/opaque_types/mod.rs b/compiler/rustc_infer/src/infer/opaque_types/mod.rs index 220d5e9bda2..220e025c3f7 100644 --- a/compiler/rustc_infer/src/infer/opaque_types/mod.rs +++ b/compiler/rustc_infer/src/infer/opaque_types/mod.rs @@ -262,9 +262,7 @@ impl<'tcx> InferCtxt<'tcx> { .type_of_opaque_hir_typeck(opaque_type_key.def_id) .instantiate(self.tcx, opaque_type_key.args); let actual = ty::fold_regions(tcx, actual, |re, _dbi| match re.kind() { - ty::ReErased => { - self.next_region_var(RegionVariableOrigin::MiscVariable(span)) - } + ty::ReErased => self.next_region_var(RegionVariableOrigin::Misc(span)), _ => re, }); actual diff --git a/compiler/rustc_infer/src/infer/region_constraints/mod.rs b/compiler/rustc_infer/src/infer/region_constraints/mod.rs index b5bf5211dd6..f4cb73685d5 100644 --- a/compiler/rustc_infer/src/infer/region_constraints/mod.rs +++ b/compiler/rustc_infer/src/infer/region_constraints/mod.rs @@ -580,7 +580,7 @@ impl<'tcx> RegionConstraintCollector<'_, 'tcx> { let a_universe = self.universe(a); let b_universe = self.universe(b); let c_universe = cmp::max(a_universe, b_universe); - let c = self.new_region_var(c_universe, RegionVariableOrigin::MiscVariable(origin.span())); + let c = self.new_region_var(c_universe, RegionVariableOrigin::Misc(origin.span())); self.combine_map(t).insert(vars, c); self.undo_log.push(AddCombination(t, vars)); let new_r = ty::Region::new_var(tcx, c); diff --git a/compiler/rustc_infer/src/infer/relate/generalize.rs b/compiler/rustc_infer/src/infer/relate/generalize.rs index 0e17b100276..9e451f16a9d 100644 --- a/compiler/rustc_infer/src/infer/relate/generalize.rs +++ b/compiler/rustc_infer/src/infer/relate/generalize.rs @@ -603,10 +603,9 @@ impl<'tcx> TypeRelation<TyCtxt<'tcx>> for Generalizer<'_, 'tcx> { } } - Ok(self.infcx.next_region_var_in_universe( - RegionVariableOrigin::MiscVariable(self.span), - self.for_universe, - )) + Ok(self + .infcx + .next_region_var_in_universe(RegionVariableOrigin::Misc(self.span), self.for_universe)) } #[instrument(level = "debug", skip(self, c2), ret)] diff --git a/compiler/rustc_trait_selection/src/error_reporting/infer/region.rs b/compiler/rustc_trait_selection/src/error_reporting/infer/region.rs index 5db643ee524..4fab67b01cb 100644 --- a/compiler/rustc_trait_selection/src/error_reporting/infer/region.rs +++ b/compiler/rustc_trait_selection/src/error_reporting/infer/region.rs @@ -1015,7 +1015,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { s }; let var_description = match var_origin { - RegionVariableOrigin::MiscVariable(_) => String::new(), + RegionVariableOrigin::Misc(_) => String::new(), RegionVariableOrigin::PatternRegion(_) => " for pattern".to_string(), RegionVariableOrigin::BorrowRegion(_) => " for borrow expression".to_string(), RegionVariableOrigin::Autoref(_) => " for autoref".to_string(), diff --git a/compiler/rustc_trait_selection/src/solve/delegate.rs b/compiler/rustc_trait_selection/src/solve/delegate.rs index b247c2c2968..d37c954614b 100644 --- a/compiler/rustc_trait_selection/src/solve/delegate.rs +++ b/compiler/rustc_trait_selection/src/solve/delegate.rs @@ -154,7 +154,7 @@ impl<'tcx> rustc_next_trait_solver::delegate::SolverDelegate for SolverDelegate< ) -> ty::GenericArg<'tcx> { match arg.kind() { ty::GenericArgKind::Lifetime(_) => { - self.next_region_var(RegionVariableOrigin::MiscVariable(span)).into() + self.next_region_var(RegionVariableOrigin::Misc(span)).into() } ty::GenericArgKind::Type(_) => self.next_ty_var(span).into(), ty::GenericArgKind::Const(_) => self.next_const_var(span).into(), |
