Skip to content

Commit fdbc432

Browse files
committed
Auto merge of #108340 - eggyal:remove_traversal_trait_aliases, r=oli-obk
Remove type-traversal trait aliases #107924 moved the type traversal (folding and visiting) traits into the type library, but created trait aliases in `rustc_middle` to minimise both the API churn for trait consumers and the arising boilerplate. As mentioned in that PR, an alternative approach of defining subtraits with blanket implementations of the respective supertraits was also considered at that time but was ruled out as not adding much value. Unfortunately, it has since emerged that rust-analyzer has difficulty with these trait aliases at present, resulting in a degraded contributor experience (see the recent [r-a has become useless](https://rust-lang.zulipchat.com/#narrow/stream/182449-t-compiler.2Fhelp/topic/r-a.20has.20become.20useless) topic on the #t-compiler/help Zulip stream). This PR removes the trait aliases, and accordingly the underlying type library traits are now used directly; they are parameterised by `TyCtxt<'tcx>` rather than just the `'tcx` lifetime, and imports have been updated to reflect the fact that the trait aliases' explicitly named traits are no longer automatically brought into scope. These changes also roll-back the (no-longer required) workarounds to #107747 that were made in b409329. Since this PR is just a find+replace together with the changes necessary for compilation & tidy to pass, it's currently just one mega-commit. Let me know if you'd like it broken up. r? `@oli-obk`
2 parents b869e84 + a9b2354 commit fdbc432

File tree

192 files changed

+658
-569
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

192 files changed

+658
-569
lines changed

Diff for: compiler/rustc_borrowck/src/constraint_generation.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use rustc_middle::mir::{
99
};
1010
use rustc_middle::ty::subst::SubstsRef;
1111
use rustc_middle::ty::visit::TypeVisitable;
12-
use rustc_middle::ty::{self, RegionVid, Ty};
12+
use rustc_middle::ty::{self, RegionVid, Ty, TyCtxt};
1313

1414
use crate::{
1515
borrow_set::BorrowSet, facts::AllFacts, location::LocationTable, nll::ToRegionVid,
@@ -165,7 +165,7 @@ impl<'cx, 'tcx> ConstraintGeneration<'cx, 'tcx> {
165165
/// `location`.
166166
fn add_regular_live_constraint<T>(&mut self, live_ty: T, location: Location)
167167
where
168-
T: TypeVisitable<'tcx>,
168+
T: TypeVisitable<TyCtxt<'tcx>>,
169169
{
170170
debug!("add_regular_live_constraint(live_ty={:?}, location={:?})", live_ty, location);
171171

Diff for: compiler/rustc_borrowck/src/diagnostics/bound_region_errors.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ impl<'tcx> ToUniverseInfo<'tcx>
106106
}
107107
}
108108

109-
impl<'tcx, T: Copy + fmt::Display + TypeFoldable<'tcx> + 'tcx> ToUniverseInfo<'tcx>
109+
impl<'tcx, T: Copy + fmt::Display + TypeFoldable<TyCtxt<'tcx>> + 'tcx> ToUniverseInfo<'tcx>
110110
for Canonical<'tcx, ty::ParamEnvAnd<'tcx, type_op::Normalize<T>>>
111111
{
112112
fn to_universe_info(self, base_universe: ty::UniverseIndex) -> UniverseInfo<'tcx> {
@@ -258,7 +258,7 @@ struct NormalizeQuery<'tcx, T> {
258258

259259
impl<'tcx, T> TypeOpInfo<'tcx> for NormalizeQuery<'tcx, T>
260260
where
261-
T: Copy + fmt::Display + TypeFoldable<'tcx> + 'tcx,
261+
T: Copy + fmt::Display + TypeFoldable<TyCtxt<'tcx>> + 'tcx,
262262
{
263263
fn fallback_error(
264264
&self,

Diff for: compiler/rustc_borrowck/src/region_infer/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use rustc_middle::mir::{
1717
};
1818
use rustc_middle::traits::ObligationCause;
1919
use rustc_middle::traits::ObligationCauseCode;
20-
use rustc_middle::ty::{self, RegionVid, Ty, TyCtxt, TypeFoldable};
20+
use rustc_middle::ty::{self, RegionVid, Ty, TyCtxt, TypeFoldable, TypeVisitableExt};
2121
use rustc_span::Span;
2222

2323
use crate::{
@@ -1366,7 +1366,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
13661366
/// we use this kind of hacky solution.
13671367
fn normalize_to_scc_representatives<T>(&self, tcx: TyCtxt<'tcx>, value: T) -> T
13681368
where
1369-
T: TypeFoldable<'tcx>,
1369+
T: TypeFoldable<TyCtxt<'tcx>>,
13701370
{
13711371
tcx.fold_regions(value, |r, _db| {
13721372
let vid = self.to_region_vid(r);

Diff for: compiler/rustc_borrowck/src/region_infer/opaque_types.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use rustc_infer::infer::TyCtxtInferExt as _;
66
use rustc_infer::infer::{DefiningAnchor, InferCtxt};
77
use rustc_infer::traits::{Obligation, ObligationCause};
88
use rustc_middle::ty::subst::{GenericArgKind, InternalSubsts};
9-
use rustc_middle::ty::visit::TypeVisitable;
9+
use rustc_middle::ty::visit::TypeVisitableExt;
1010
use rustc_middle::ty::{self, OpaqueHiddenType, OpaqueTypeKey, Ty, TyCtxt, TypeFoldable};
1111
use rustc_span::Span;
1212
use rustc_trait_selection::traits::error_reporting::TypeErrCtxtExt as _;
@@ -178,7 +178,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
178178
/// region names in error messages.
179179
pub(crate) fn name_regions<T>(&self, tcx: TyCtxt<'tcx>, ty: T) -> T
180180
where
181-
T: TypeFoldable<'tcx>,
181+
T: TypeFoldable<TyCtxt<'tcx>>,
182182
{
183183
tcx.fold_regions(ty, |region, _| match *region {
184184
ty::ReVar(vid) => {

Diff for: compiler/rustc_borrowck/src/renumber.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ pub(crate) fn renumber_regions<'tcx, T, F>(
3838
get_ctxt_fn: F,
3939
) -> T
4040
where
41-
T: TypeFoldable<'tcx>,
41+
T: TypeFoldable<TyCtxt<'tcx>>,
4242
F: Fn() -> RegionCtxt,
4343
{
4444
infcx.tcx.fold_regions(value, |_region, _depth| {
@@ -89,7 +89,7 @@ struct NllVisitor<'a, 'tcx> {
8989
impl<'a, 'tcx> NllVisitor<'a, 'tcx> {
9090
fn renumber_regions<T, F>(&mut self, value: T, region_ctxt_fn: F) -> T
9191
where
92-
T: TypeFoldable<'tcx>,
92+
T: TypeFoldable<TyCtxt<'tcx>>,
9393
F: Fn() -> RegionCtxt,
9494
{
9595
renumber_regions(self.infcx, value, region_ctxt_fn)

Diff for: compiler/rustc_borrowck/src/type_check/canonical.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use std::fmt;
22

33
use rustc_infer::infer::{canonical::Canonical, InferOk};
44
use rustc_middle::mir::ConstraintCategory;
5-
use rustc_middle::ty::{self, ToPredicate, Ty, TypeFoldable};
5+
use rustc_middle::ty::{self, ToPredicate, Ty, TyCtxt, TypeFoldable};
66
use rustc_span::def_id::DefId;
77
use rustc_span::Span;
88
use rustc_trait_selection::traits::query::type_op::{self, TypeOpOutput};
@@ -66,7 +66,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
6666
canonical: &Canonical<'tcx, T>,
6767
) -> T
6868
where
69-
T: TypeFoldable<'tcx>,
69+
T: TypeFoldable<TyCtxt<'tcx>>,
7070
{
7171
let old_universe = self.infcx.universe();
7272

Diff for: compiler/rustc_borrowck/src/type_check/constraint_conversion.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ use rustc_infer::infer::region_constraints::{GenericKind, VerifyBound};
66
use rustc_infer::infer::{self, InferCtxt, SubregionOrigin};
77
use rustc_middle::mir::{ClosureOutlivesSubject, ClosureRegionRequirements, ConstraintCategory};
88
use rustc_middle::ty::subst::GenericArgKind;
9-
use rustc_middle::ty::TypeFoldable;
109
use rustc_middle::ty::{self, TyCtxt};
10+
use rustc_middle::ty::{TypeFoldable, TypeVisitableExt};
1111
use rustc_span::{Span, DUMMY_SP};
1212

1313
use crate::{
@@ -171,7 +171,7 @@ impl<'a, 'tcx> ConstraintConversion<'a, 'tcx> {
171171
///
172172
/// FIXME: This should get removed once higher ranked region obligations
173173
/// are dealt with during trait solving.
174-
fn replace_placeholders_with_nll<T: TypeFoldable<'tcx>>(&mut self, value: T) -> T {
174+
fn replace_placeholders_with_nll<T: TypeFoldable<TyCtxt<'tcx>>>(&mut self, value: T) -> T {
175175
if value.has_placeholders() {
176176
self.tcx.fold_regions(value, |r, _| match *r {
177177
ty::RePlaceholder(placeholder) => {

Diff for: compiler/rustc_borrowck/src/type_check/liveness/trace.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use rustc_index::bit_set::HybridBitSet;
33
use rustc_index::interval::IntervalSet;
44
use rustc_infer::infer::canonical::QueryRegionConstraints;
55
use rustc_middle::mir::{BasicBlock, Body, ConstraintCategory, Local, Location};
6-
use rustc_middle::ty::{Ty, TypeVisitable};
6+
use rustc_middle::ty::{Ty, TyCtxt, TypeVisitable, TypeVisitableExt};
77
use rustc_trait_selection::traits::query::dropck_outlives::DropckOutlivesResult;
88
use rustc_trait_selection::traits::query::type_op::outlives::DropckOutlives;
99
use rustc_trait_selection::traits::query::type_op::{TypeOp, TypeOpOutput};
@@ -477,7 +477,7 @@ impl<'tcx> LivenessContext<'_, '_, '_, 'tcx> {
477477
/// points `live_at`.
478478
fn add_use_live_facts_for(
479479
&mut self,
480-
value: impl TypeVisitable<'tcx>,
480+
value: impl TypeVisitable<TyCtxt<'tcx>>,
481481
live_at: &IntervalSet<PointIndex>,
482482
) {
483483
debug!("add_use_live_facts_for(value={:?})", value);
@@ -542,7 +542,7 @@ impl<'tcx> LivenessContext<'_, '_, '_, 'tcx> {
542542
fn make_all_regions_live(
543543
elements: &RegionValueElements,
544544
typeck: &mut TypeChecker<'_, 'tcx>,
545-
value: impl TypeVisitable<'tcx>,
545+
value: impl TypeVisitable<TyCtxt<'tcx>>,
546546
live_at: &IntervalSet<PointIndex>,
547547
) {
548548
debug!("make_all_regions_live(value={:?})", value);

Diff for: compiler/rustc_borrowck/src/type_check/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ use rustc_middle::mir::*;
3030
use rustc_middle::ty::adjustment::PointerCast;
3131
use rustc_middle::ty::cast::CastTy;
3232
use rustc_middle::ty::subst::{SubstsRef, UserSubsts};
33-
use rustc_middle::ty::visit::TypeVisitable;
33+
use rustc_middle::ty::visit::TypeVisitableExt;
3434
use rustc_middle::ty::{
3535
self, Binder, CanonicalUserTypeAnnotation, CanonicalUserTypeAnnotations, Dynamic,
3636
OpaqueHiddenType, OpaqueTypeKey, RegionVid, Ty, TyCtxt, UserType, UserTypeAnnotationIndex,

Diff for: compiler/rustc_borrowck/src/universal_regions.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -728,7 +728,7 @@ trait InferCtxtExt<'tcx> {
728728
value: T,
729729
) -> T
730730
where
731-
T: TypeFoldable<'tcx>;
731+
T: TypeFoldable<TyCtxt<'tcx>>;
732732

733733
fn replace_bound_regions_with_nll_infer_vars<T>(
734734
&self,
@@ -738,7 +738,7 @@ trait InferCtxtExt<'tcx> {
738738
indices: &mut UniversalRegionIndices<'tcx>,
739739
) -> T
740740
where
741-
T: TypeFoldable<'tcx>;
741+
T: TypeFoldable<TyCtxt<'tcx>>;
742742

743743
fn replace_late_bound_regions_with_nll_infer_vars_in_recursive_scope(
744744
&self,
@@ -761,7 +761,7 @@ impl<'cx, 'tcx> InferCtxtExt<'tcx> for BorrowckInferCtxt<'cx, 'tcx> {
761761
value: T,
762762
) -> T
763763
where
764-
T: TypeFoldable<'tcx>,
764+
T: TypeFoldable<TyCtxt<'tcx>>,
765765
{
766766
self.infcx.tcx.fold_regions(value, |region, _depth| {
767767
let name = match region.get_name() {
@@ -785,7 +785,7 @@ impl<'cx, 'tcx> InferCtxtExt<'tcx> for BorrowckInferCtxt<'cx, 'tcx> {
785785
indices: &mut UniversalRegionIndices<'tcx>,
786786
) -> T
787787
where
788-
T: TypeFoldable<'tcx>,
788+
T: TypeFoldable<TyCtxt<'tcx>>,
789789
{
790790
let (value, _map) = self.tcx.replace_late_bound_regions(value, |br| {
791791
debug!(?br);
@@ -906,7 +906,7 @@ impl<'tcx> UniversalRegionIndices<'tcx> {
906906
/// returned by `to_region_vid`.
907907
pub fn fold_to_region_vids<T>(&self, tcx: TyCtxt<'tcx>, value: T) -> T
908908
where
909-
T: TypeFoldable<'tcx>,
909+
T: TypeFoldable<TyCtxt<'tcx>>,
910910
{
911911
tcx.fold_regions(value, |region, _| tcx.mk_re_var(self.to_region_vid(region)))
912912
}

Diff for: compiler/rustc_codegen_cranelift/src/common.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,7 @@ impl<'tcx> HasTargetSpec for FunctionCx<'_, '_, 'tcx> {
374374
impl<'tcx> FunctionCx<'_, '_, 'tcx> {
375375
pub(crate) fn monomorphize<T>(&self, value: T) -> T
376376
where
377-
T: TypeFoldable<'tcx> + Copy,
377+
T: TypeFoldable<TyCtxt<'tcx>> + Copy,
378378
{
379379
self.instance.subst_mir_and_normalize_erasing_regions(
380380
self.tcx,

Diff for: compiler/rustc_codegen_cranelift/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ mod prelude {
8686
pub(crate) use rustc_middle::ty::layout::{self, LayoutOf, TyAndLayout};
8787
pub(crate) use rustc_middle::ty::{
8888
self, FloatTy, Instance, InstanceDef, IntTy, ParamEnv, Ty, TyCtxt, TypeAndMut,
89-
TypeFoldable, UintTy,
89+
TypeFoldable, TypeVisitableExt, UintTy,
9090
};
9191
pub(crate) use rustc_target::abi::{Abi, Scalar, Size, VariantIdx};
9292

Diff for: compiler/rustc_codegen_gcc/src/callee.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use gccjit::{FunctionType, RValue};
22
use rustc_codegen_ssa::traits::BaseTypeMethods;
3-
use rustc_middle::ty::{self, Instance, TypeVisitable};
3+
use rustc_middle::ty::{self, Instance, TypeVisitableExt};
44
use rustc_middle::ty::layout::{FnAbiOf, HasTyCtxt};
55

66
use crate::abi::FnAbiGccExt;

Diff for: compiler/rustc_codegen_gcc/src/mono_item.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use rustc_codegen_ssa::traits::PreDefineMethods;
22
use rustc_middle::middle::codegen_fn_attrs::CodegenFnAttrFlags;
33
use rustc_middle::mir::mono::{Linkage, Visibility};
4-
use rustc_middle::ty::{self, Instance, TypeVisitable};
4+
use rustc_middle::ty::{self, Instance, TypeVisitableExt};
55
use rustc_middle::ty::layout::{FnAbiOf, LayoutOf};
66
use rustc_span::def_id::DefId;
77

Diff for: compiler/rustc_codegen_gcc/src/type_of.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use std::fmt::Write;
33
use gccjit::{Struct, Type};
44
use crate::rustc_codegen_ssa::traits::{BaseTypeMethods, DerivedTypeMethods, LayoutTypeMethods};
55
use rustc_middle::bug;
6-
use rustc_middle::ty::{self, Ty, TypeVisitable};
6+
use rustc_middle::ty::{self, Ty, TypeVisitableExt};
77
use rustc_middle::ty::layout::{FnAbiOf, LayoutOf, TyAndLayout};
88
use rustc_middle::ty::print::with_no_trimmed_paths;
99
use rustc_target::abi::{self, Abi, F32, F64, FieldsShape, Int, Integer, Pointer, PointeeInfo, Size, TyAbiInterface, Variants};

Diff for: compiler/rustc_codegen_llvm/src/callee.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use crate::value::Value;
1313
use rustc_codegen_ssa::traits::*;
1414

1515
use rustc_middle::ty::layout::{FnAbiOf, HasTyCtxt};
16-
use rustc_middle::ty::{self, Instance, TypeVisitable};
16+
use rustc_middle::ty::{self, Instance, TypeVisitableExt};
1717

1818
/// Codegens a reference to a fn/method item, monomorphizing and
1919
/// inlining as it goes.

Diff for: compiler/rustc_codegen_llvm/src/debuginfo/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ use rustc_index::vec::IndexVec;
2727
use rustc_middle::mir;
2828
use rustc_middle::ty::layout::LayoutOf;
2929
use rustc_middle::ty::subst::{GenericArgKind, SubstsRef};
30-
use rustc_middle::ty::{self, Instance, ParamEnv, Ty, TypeVisitable};
30+
use rustc_middle::ty::{self, Instance, ParamEnv, Ty, TypeVisitableExt};
3131
use rustc_session::config::{self, DebugInfo};
3232
use rustc_session::Session;
3333
use rustc_span::symbol::Symbol;

Diff for: compiler/rustc_codegen_llvm/src/mono_item.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use rustc_hir::def_id::{DefId, LOCAL_CRATE};
99
pub use rustc_middle::mir::mono::MonoItem;
1010
use rustc_middle::mir::mono::{Linkage, Visibility};
1111
use rustc_middle::ty::layout::{FnAbiOf, LayoutOf};
12-
use rustc_middle::ty::{self, Instance, TypeVisitable};
12+
use rustc_middle::ty::{self, Instance, TypeVisitableExt};
1313
use rustc_session::config::CrateType;
1414
use rustc_target::spec::RelocModel;
1515

Diff for: compiler/rustc_codegen_llvm/src/type_of.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use rustc_codegen_ssa::traits::*;
55
use rustc_middle::bug;
66
use rustc_middle::ty::layout::{FnAbiOf, LayoutOf, TyAndLayout};
77
use rustc_middle::ty::print::{with_no_trimmed_paths, with_no_visible_paths};
8-
use rustc_middle::ty::{self, Ty, TypeVisitable};
8+
use rustc_middle::ty::{self, Ty, TypeVisitableExt};
99
use rustc_target::abi::{Abi, Align, FieldsShape};
1010
use rustc_target::abi::{Int, Pointer, F32, F64};
1111
use rustc_target::abi::{PointeeInfo, Scalar, Size, TyAbiInterface, Variants};

Diff for: compiler/rustc_codegen_ssa/src/mir/block.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use rustc_index::vec::Idx;
1616
use rustc_middle::mir::{self, AssertKind, SwitchTargets};
1717
use rustc_middle::ty::layout::{HasTyCtxt, LayoutOf};
1818
use rustc_middle::ty::print::{with_no_trimmed_paths, with_no_visible_paths};
19-
use rustc_middle::ty::{self, Instance, Ty, TypeVisitable};
19+
use rustc_middle::ty::{self, Instance, Ty, TypeVisitableExt};
2020
use rustc_session::config::OptLevel;
2121
use rustc_span::source_map::Span;
2222
use rustc_span::{sym, Symbol};

Diff for: compiler/rustc_codegen_ssa/src/mir/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use crate::traits::*;
33
use rustc_middle::mir;
44
use rustc_middle::mir::interpret::ErrorHandled;
55
use rustc_middle::ty::layout::{FnAbiOf, HasTyCtxt, TyAndLayout};
6-
use rustc_middle::ty::{self, Instance, Ty, TypeFoldable};
6+
use rustc_middle::ty::{self, Instance, Ty, TyCtxt, TypeFoldable, TypeVisitableExt};
77
use rustc_target::abi::call::{FnAbi, PassMode};
88

99
use std::iter;
@@ -105,7 +105,7 @@ pub struct FunctionCx<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> {
105105
impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
106106
pub fn monomorphize<T>(&self, value: T) -> T
107107
where
108-
T: Copy + TypeFoldable<'tcx>,
108+
T: Copy + TypeFoldable<TyCtxt<'tcx>>,
109109
{
110110
debug!("monomorphize: self.instance={:?}", self.instance);
111111
self.instance.subst_mir_and_normalize_erasing_regions(

Diff for: compiler/rustc_const_eval/src/interpret/eval_context.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -489,7 +489,9 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
489489

490490
/// Call this on things you got out of the MIR (so it is as generic as the current
491491
/// stack frame), to bring it into the proper environment for this interpreter.
492-
pub(super) fn subst_from_current_frame_and_normalize_erasing_regions<T: TypeFoldable<'tcx>>(
492+
pub(super) fn subst_from_current_frame_and_normalize_erasing_regions<
493+
T: TypeFoldable<TyCtxt<'tcx>>,
494+
>(
493495
&self,
494496
value: T,
495497
) -> Result<T, InterpError<'tcx>> {
@@ -498,7 +500,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
498500

499501
/// Call this on things you got out of the MIR (so it is as generic as the provided
500502
/// stack frame), to bring it into the proper environment for this interpreter.
501-
pub(super) fn subst_from_frame_and_normalize_erasing_regions<T: TypeFoldable<'tcx>>(
503+
pub(super) fn subst_from_frame_and_normalize_erasing_regions<T: TypeFoldable<TyCtxt<'tcx>>>(
502504
&self,
503505
frame: &Frame<'mir, 'tcx, M::Provenance, M::FrameExtra>,
504506
value: T,

Diff for: compiler/rustc_const_eval/src/interpret/util.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
use rustc_middle::mir::interpret::InterpResult;
2-
use rustc_middle::ty::{self, ir::TypeVisitor, Ty, TyCtxt, TypeSuperVisitable, TypeVisitable};
2+
use rustc_middle::ty::{
3+
self, Ty, TyCtxt, TypeSuperVisitable, TypeVisitable, TypeVisitableExt, TypeVisitor,
4+
};
35
use std::ops::ControlFlow;
46

57
/// Checks whether a type contains generic parameters which require substitution.
@@ -9,7 +11,7 @@ use std::ops::ControlFlow;
911
/// case these parameters are unused.
1012
pub(crate) fn ensure_monomorphic_enough<'tcx, T>(tcx: TyCtxt<'tcx>, ty: T) -> InterpResult<'tcx>
1113
where
12-
T: TypeVisitable<'tcx>,
14+
T: TypeVisitable<TyCtxt<'tcx>>,
1315
{
1416
debug!("ensure_monomorphic_enough: ty={:?}", ty);
1517
if !ty.needs_subst() {

Diff for: compiler/rustc_const_eval/src/transform/check_consts/check.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use rustc_middle::mir::visit::{MutatingUseContext, NonMutatingUseContext, PlaceC
1010
use rustc_middle::mir::*;
1111
use rustc_middle::ty::subst::{GenericArgKind, InternalSubsts};
1212
use rustc_middle::ty::{self, adjustment::PointerCast, Instance, InstanceDef, Ty, TyCtxt};
13-
use rustc_middle::ty::{Binder, TraitRef, TypeVisitable};
13+
use rustc_middle::ty::{Binder, TraitRef, TypeVisitableExt};
1414
use rustc_mir_dataflow::{self, Analysis};
1515
use rustc_span::{sym, Span, Symbol};
1616
use rustc_trait_selection::traits::error_reporting::TypeErrCtxtExt as _;

Diff for: compiler/rustc_const_eval/src/transform/promote_consts.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ use rustc_middle::mir::traversal::ReversePostorderIter;
1818
use rustc_middle::mir::visit::{MutVisitor, MutatingUseContext, PlaceContext, Visitor};
1919
use rustc_middle::mir::*;
2020
use rustc_middle::ty::subst::InternalSubsts;
21-
use rustc_middle::ty::{self, List, TyCtxt, TypeVisitable};
21+
use rustc_middle::ty::{self, List, TyCtxt, TypeVisitableExt};
2222
use rustc_span::Span;
2323

2424
use rustc_index::vec::{Idx, IndexVec};

Diff for: compiler/rustc_const_eval/src/transform/validate.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use rustc_middle::mir::{
1313
RetagKind, RuntimePhase, Rvalue, SourceScope, Statement, StatementKind, Terminator,
1414
TerminatorKind, UnOp, START_BLOCK,
1515
};
16-
use rustc_middle::ty::{self, InstanceDef, ParamEnv, Ty, TyCtxt, TypeVisitable};
16+
use rustc_middle::ty::{self, InstanceDef, ParamEnv, Ty, TyCtxt, TypeVisitableExt};
1717
use rustc_mir_dataflow::impls::MaybeStorageLive;
1818
use rustc_mir_dataflow::storage::always_storage_live_locals;
1919
use rustc_mir_dataflow::{Analysis, ResultsCursor};

Diff for: compiler/rustc_hir_analysis/src/astconv/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ use rustc_middle::middle::stability::AllowUnstable;
3535
use rustc_middle::ty::subst::{self, GenericArgKind, InternalSubsts, SubstsRef};
3636
use rustc_middle::ty::DynKind;
3737
use rustc_middle::ty::GenericParamDefKind;
38-
use rustc_middle::ty::{self, Const, DefIdTree, IsSuggestable, Ty, TyCtxt, TypeVisitable};
38+
use rustc_middle::ty::{self, Const, DefIdTree, IsSuggestable, Ty, TyCtxt, TypeVisitableExt};
3939
use rustc_session::lint::builtin::{AMBIGUOUS_ASSOCIATED_ITEMS, BARE_TRAIT_OBJECTS};
4040
use rustc_span::edit_distance::find_best_match_for_name;
4141
use rustc_span::edition::Edition;

Diff for: compiler/rustc_hir_analysis/src/autoderef.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use crate::traits::query::evaluate_obligation::InferCtxtExt;
33
use crate::traits::NormalizeExt;
44
use crate::traits::{self, TraitEngine, TraitEngineExt};
55
use rustc_infer::infer::InferCtxt;
6-
use rustc_middle::ty::TypeVisitable;
6+
use rustc_middle::ty::TypeVisitableExt;
77
use rustc_middle::ty::{self, Ty, TyCtxt};
88
use rustc_session::Limit;
99
use rustc_span::def_id::LocalDefId;

0 commit comments

Comments
 (0)