Skip to content

Commit 7a41522

Browse files
committed
Move ty::CratePredicatesMap to its own little module (cute)
1 parent 5e441b8 commit 7a41522

File tree

3 files changed

+26
-18
lines changed

3 files changed

+26
-18
lines changed

compiler/rustc_middle/src/ty/mod.rs

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -158,10 +158,11 @@ pub use opaque_hidden_type::OpaqueHiddenType;
158158
pub use param_env::{ParamEnv, ParamEnvAnd};
159159
pub use placeholder::{Placeholder, PlaceholderConst, PlaceholderRegion, PlaceholderType};
160160
pub use predicate::{
161-
Clause, CoercePredicate, InstantiatedPredicates, OutlivesPredicate, PolyCoercePredicate,
162-
PolyProjectionPredicate, PolyRegionOutlivesPredicate, PolySubtypePredicate, PolyTraitPredicate,
163-
PolyTypeOutlivesPredicate, Predicate, PredicateKind, ProjectionPredicate,
164-
RegionOutlivesPredicate, SubtypePredicate, ToPredicate, TraitPredicate, TypeOutlivesPredicate,
161+
Clause, CoercePredicate, CratePredicatesMap, InstantiatedPredicates, OutlivesPredicate,
162+
PolyCoercePredicate, PolyProjectionPredicate, PolyRegionOutlivesPredicate,
163+
PolySubtypePredicate, PolyTraitPredicate, PolyTypeOutlivesPredicate, Predicate, PredicateKind,
164+
ProjectionPredicate, RegionOutlivesPredicate, SubtypePredicate, ToPredicate, TraitPredicate,
165+
TypeOutlivesPredicate,
165166
};
166167
pub use resolver_outputs::{ResolverAstLowering, ResolverGlobalCtxt, ResolverOutputs};
167168
pub use symbol_name::SymbolName;
@@ -260,20 +261,6 @@ pub struct CReaderCacheKey {
260261
pub pos: usize,
261262
}
262263

263-
/// The crate outlives map is computed during typeck and contains the
264-
/// outlives of every item in the local crate. You should not use it
265-
/// directly, because to do so will make your pass dependent on the
266-
/// HIR of every item in the local crate. Instead, use
267-
/// `tcx.inferred_outlives_of()` to get the outlives for a *particular*
268-
/// item.
269-
#[derive(HashStable, Debug)]
270-
pub struct CratePredicatesMap<'tcx> {
271-
/// For each struct with outlive bounds, maps to a vector of the
272-
/// predicate of its outlive bounds. If an item has no outlives
273-
/// bounds, it will have no entry.
274-
pub predicates: FxHashMap<DefId, &'tcx [(Clause<'tcx>, Span)]>,
275-
}
276-
277264
const TAG_MASK: usize = 0b11;
278265
const TYPE_TAG: usize = 0b00;
279266
const CONST_TAG: usize = 0b01;

compiler/rustc_middle/src/ty/predicate.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ use crate::ty::{
1212

1313
mod clause;
1414
mod coerce_predicate;
15+
mod crate_predicates_map;
1516
mod instantiated_predicates;
1617
mod outlives_predicate;
1718
mod projection_predicate;
@@ -21,6 +22,7 @@ mod trait_predicate;
2122

2223
pub use clause::Clause;
2324
pub use coerce_predicate::{CoercePredicate, PolyCoercePredicate};
25+
pub use crate_predicates_map::CratePredicatesMap;
2426
pub use instantiated_predicates::InstantiatedPredicates;
2527
pub use outlives_predicate::{
2628
OutlivesPredicate, PolyRegionOutlivesPredicate, PolyTypeOutlivesPredicate,
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
use rustc_data_structures::fx::FxHashMap;
2+
use rustc_hir::def_id::DefId;
3+
use rustc_span::Span;
4+
5+
use crate::ty::Clause;
6+
7+
/// The crate outlives map is computed during typeck and contains the
8+
/// outlives of every item in the local crate. You should not use it
9+
/// directly, because to do so will make your pass dependent on the
10+
/// HIR of every item in the local crate. Instead, use
11+
/// `tcx.inferred_outlives_of()` to get the outlives for a *particular*
12+
/// item.
13+
#[derive(HashStable, Debug)]
14+
pub struct CratePredicatesMap<'tcx> {
15+
/// For each struct with outlive bounds, maps to a vector of the
16+
/// predicate of its outlive bounds. If an item has no outlives
17+
/// bounds, it will have no entry.
18+
pub predicates: FxHashMap<DefId, &'tcx [(Clause<'tcx>, Span)]>,
19+
}

0 commit comments

Comments
 (0)