Skip to content

Commit 56a0aec

Browse files
committed
Move subst_and_normalize_erasing_regionsto rustc::ty.
1 parent a80bff8 commit 56a0aec

File tree

2 files changed

+24
-26
lines changed

2 files changed

+24
-26
lines changed

src/librustc/traits/codegen/mod.rs

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ use crate::traits::{
88
FulfillmentContext, Obligation, ObligationCause, SelectionContext, TraitEngine, Vtable,
99
};
1010
use crate::ty::fold::TypeFoldable;
11-
use crate::ty::subst::{Subst, SubstsRef};
1211
use crate::ty::{self, TyCtxt};
1312

1413
/// Attempts to resolve an obligation to a vtable. The result is
@@ -76,31 +75,6 @@ pub fn codegen_fulfill_obligation<'tcx>(
7675
})
7776
}
7877

79-
impl<'tcx> TyCtxt<'tcx> {
80-
/// Monomorphizes a type from the AST by first applying the
81-
/// in-scope substitutions and then normalizing any associated
82-
/// types.
83-
pub fn subst_and_normalize_erasing_regions<T>(
84-
self,
85-
param_substs: SubstsRef<'tcx>,
86-
param_env: ty::ParamEnv<'tcx>,
87-
value: &T,
88-
) -> T
89-
where
90-
T: TypeFoldable<'tcx>,
91-
{
92-
debug!(
93-
"subst_and_normalize_erasing_regions(\
94-
param_substs={:?}, \
95-
value={:?}, \
96-
param_env={:?})",
97-
param_substs, value, param_env,
98-
);
99-
let substituted = value.subst(self, param_substs);
100-
self.normalize_erasing_regions(param_env, substituted)
101-
}
102-
}
103-
10478
// # Global Cache
10579

10680
impl<'a, 'tcx> InferCtxt<'a, 'tcx> {

src/librustc/ty/normalize_erasing_regions.rs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
//! within. (This underlying query is what is cached.)
99
1010
use crate::ty::fold::{TypeFoldable, TypeFolder};
11+
use crate::ty::subst::{Subst, SubstsRef};
1112
use crate::ty::{self, Ty, TyCtxt};
1213

1314
impl<'tcx> TyCtxt<'tcx> {
@@ -60,6 +61,29 @@ impl<'tcx> TyCtxt<'tcx> {
6061
let value = self.erase_late_bound_regions(value);
6162
self.normalize_erasing_regions(param_env, value)
6263
}
64+
65+
/// Monomorphizes a type from the AST by first applying the
66+
/// in-scope substitutions and then normalizing any associated
67+
/// types.
68+
pub fn subst_and_normalize_erasing_regions<T>(
69+
self,
70+
param_substs: SubstsRef<'tcx>,
71+
param_env: ty::ParamEnv<'tcx>,
72+
value: &T,
73+
) -> T
74+
where
75+
T: TypeFoldable<'tcx>,
76+
{
77+
debug!(
78+
"subst_and_normalize_erasing_regions(\
79+
param_substs={:?}, \
80+
value={:?}, \
81+
param_env={:?})",
82+
param_substs, value, param_env,
83+
);
84+
let substituted = value.subst(self, param_substs);
85+
self.normalize_erasing_regions(param_env, substituted)
86+
}
6387
}
6488

6589
struct NormalizeAfterErasingRegionsFolder<'tcx> {

0 commit comments

Comments
 (0)