Skip to content

Commit 226358e

Browse files
committed
rename ParameterEnvironment to ParamEnv
1 parent ca65a8a commit 226358e

File tree

22 files changed

+91
-91
lines changed

22 files changed

+91
-91
lines changed

src/librustc/dep_graph/dep_node.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ pub enum DepNode<D: Clone + Debug> {
163163
// not a hotspot.
164164
ProjectionCache { def_ids: Vec<D> },
165165

166-
ParameterEnvironment(D),
166+
ParamEnv(D),
167167
DescribeDef(D),
168168
DefSpan(D),
169169
Stability(D),
@@ -293,7 +293,7 @@ impl<D: Clone + Debug> DepNode<D> {
293293
let def_ids: Option<Vec<E>> = def_ids.iter().map(op).collect();
294294
def_ids.map(|d| ProjectionCache { def_ids: d })
295295
}
296-
ParameterEnvironment(ref d) => op(d).map(ParameterEnvironment),
296+
ParamEnv(ref d) => op(d).map(ParamEnv),
297297
DescribeDef(ref d) => op(d).map(DescribeDef),
298298
DefSpan(ref d) => op(d).map(DefSpan),
299299
Stability(ref d) => op(d).map(Stability),

src/librustc/infer/mod.rs

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ use middle::lang_items;
2828
use mir::tcx::LvalueTy;
2929
use ty::subst::{Kind, Subst, Substs};
3030
use ty::{TyVid, IntVid, FloatVid};
31-
use ty::{self, ParameterEnvironment, Ty, TyCtxt};
31+
use ty::{self, ParamEnv, Ty, TyCtxt};
3232
use ty::error::{ExpectedFound, TypeError, UnconstrainedNumeric};
3333
use ty::fold::{TypeFoldable, TypeFolder, TypeVisitor};
3434
use ty::relate::{Relate, RelateResult, TypeRelation};
@@ -161,7 +161,7 @@ pub struct InferCtxt<'a, 'gcx: 'a+'tcx, 'tcx: 'a> {
161161
// For region variables.
162162
region_vars: RegionVarBindings<'a, 'gcx, 'tcx>,
163163

164-
pub parameter_environment: ty::ParameterEnvironment<'gcx>,
164+
pub parameter_environment: ty::ParamEnv<'gcx>,
165165

166166
/// Caches the results of trait selection. This cache is used
167167
/// for things that have to do with the parameters in scope.
@@ -406,41 +406,41 @@ pub trait InferEnv<'a, 'tcx> {
406406
fn to_parts(self, tcx: TyCtxt<'a, 'tcx, 'tcx>)
407407
-> (Option<&'a ty::TypeckTables<'tcx>>,
408408
Option<ty::TypeckTables<'tcx>>,
409-
Option<ty::ParameterEnvironment<'tcx>>);
409+
Option<ty::ParamEnv<'tcx>>);
410410
}
411411

412412
impl<'a, 'tcx> InferEnv<'a, 'tcx> for () {
413413
fn to_parts(self, _: TyCtxt<'a, 'tcx, 'tcx>)
414414
-> (Option<&'a ty::TypeckTables<'tcx>>,
415415
Option<ty::TypeckTables<'tcx>>,
416-
Option<ty::ParameterEnvironment<'tcx>>) {
416+
Option<ty::ParamEnv<'tcx>>) {
417417
(None, None, None)
418418
}
419419
}
420420

421-
impl<'a, 'tcx> InferEnv<'a, 'tcx> for ty::ParameterEnvironment<'tcx> {
421+
impl<'a, 'tcx> InferEnv<'a, 'tcx> for ty::ParamEnv<'tcx> {
422422
fn to_parts(self, _: TyCtxt<'a, 'tcx, 'tcx>)
423423
-> (Option<&'a ty::TypeckTables<'tcx>>,
424424
Option<ty::TypeckTables<'tcx>>,
425-
Option<ty::ParameterEnvironment<'tcx>>) {
425+
Option<ty::ParamEnv<'tcx>>) {
426426
(None, None, Some(self))
427427
}
428428
}
429429

430-
impl<'a, 'tcx> InferEnv<'a, 'tcx> for (&'a ty::TypeckTables<'tcx>, ty::ParameterEnvironment<'tcx>) {
430+
impl<'a, 'tcx> InferEnv<'a, 'tcx> for (&'a ty::TypeckTables<'tcx>, ty::ParamEnv<'tcx>) {
431431
fn to_parts(self, _: TyCtxt<'a, 'tcx, 'tcx>)
432432
-> (Option<&'a ty::TypeckTables<'tcx>>,
433433
Option<ty::TypeckTables<'tcx>>,
434-
Option<ty::ParameterEnvironment<'tcx>>) {
434+
Option<ty::ParamEnv<'tcx>>) {
435435
(Some(self.0), None, Some(self.1))
436436
}
437437
}
438438

439-
impl<'a, 'tcx> InferEnv<'a, 'tcx> for (ty::TypeckTables<'tcx>, ty::ParameterEnvironment<'tcx>) {
439+
impl<'a, 'tcx> InferEnv<'a, 'tcx> for (ty::TypeckTables<'tcx>, ty::ParamEnv<'tcx>) {
440440
fn to_parts(self, _: TyCtxt<'a, 'tcx, 'tcx>)
441441
-> (Option<&'a ty::TypeckTables<'tcx>>,
442442
Option<ty::TypeckTables<'tcx>>,
443-
Option<ty::ParameterEnvironment<'tcx>>) {
443+
Option<ty::ParamEnv<'tcx>>) {
444444
(None, Some(self.0), Some(self.1))
445445
}
446446
}
@@ -449,7 +449,7 @@ impl<'a, 'tcx> InferEnv<'a, 'tcx> for hir::BodyId {
449449
fn to_parts(self, tcx: TyCtxt<'a, 'tcx, 'tcx>)
450450
-> (Option<&'a ty::TypeckTables<'tcx>>,
451451
Option<ty::TypeckTables<'tcx>>,
452-
Option<ty::ParameterEnvironment<'tcx>>) {
452+
Option<ty::ParamEnv<'tcx>>) {
453453
let def_id = tcx.hir.body_owner_def_id(self);
454454
(Some(tcx.typeck_tables_of(def_id)),
455455
None,
@@ -465,7 +465,7 @@ pub struct InferCtxtBuilder<'a, 'gcx: 'a+'tcx, 'tcx: 'a> {
465465
arena: DroplessArena,
466466
fresh_tables: Option<RefCell<ty::TypeckTables<'tcx>>>,
467467
tables: Option<&'a ty::TypeckTables<'gcx>>,
468-
param_env: Option<ty::ParameterEnvironment<'gcx>>,
468+
param_env: Option<ty::ParamEnv<'gcx>>,
469469
projection_mode: Reveal,
470470
}
471471

@@ -526,7 +526,7 @@ impl<'a, 'gcx, 'tcx> InferCtxtBuilder<'a, 'gcx, 'tcx> {
526526
let tables = tables.map(InferTables::Interned).unwrap_or_else(|| {
527527
fresh_tables.as_ref().map_or(InferTables::Missing, InferTables::InProgress)
528528
});
529-
let param_env = param_env.take().unwrap_or_else(|| ParameterEnvironment::empty());
529+
let param_env = param_env.take().unwrap_or_else(|| ParamEnv::empty());
530530
global_tcx.enter_local(arena, |tcx| f(InferCtxt {
531531
tcx: tcx,
532532
tables: tables,
@@ -648,7 +648,7 @@ impl<'a, 'tcx> TyCtxt<'a, 'tcx, 'tcx> {
648648
}
649649

650650
pub fn normalize_associated_type_in_env<T>(
651-
self, value: &T, env: ty::ParameterEnvironment<'tcx>
651+
self, value: &T, env: ty::ParamEnv<'tcx>
652652
) -> T
653653
where T: TransNormalize<'tcx>
654654
{
@@ -1672,7 +1672,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
16721672
self.tables.borrow().upvar_capture_map.get(&upvar_id).cloned()
16731673
}
16741674

1675-
pub fn param_env(&self) -> ty::ParameterEnvironment<'gcx> {
1675+
pub fn param_env(&self) -> ty::ParamEnv<'gcx> {
16761676
self.parameter_environment
16771677
}
16781678

src/librustc/traits/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,7 @@ before, and hence the cache lookup would succeed, yielding
418418
One subtle interaction is that the results of trait lookup will vary
419419
depending on what where clauses are in scope. Therefore, we actually
420420
have *two* caches, a local and a global cache. The local cache is
421-
attached to the `ParameterEnvironment` and the global cache attached
421+
attached to ParamEnv` and the global cache attached
422422
to the `tcx`. We use the local cache whenever the result might depend
423423
on the where clauses that are in scope. The determination of which
424424
cache to use is done by the method `pick_candidate_cache` in

src/librustc/traits/mod.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -437,9 +437,9 @@ pub fn type_known_to_meet_bound<'a, 'gcx, 'tcx>(infcx: &InferCtxt<'a, 'gcx, 'tcx
437437
/// Normalizes the parameter environment, reporting errors if they occur.
438438
pub fn normalize_param_env_or_error<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
439439
region_context: DefId,
440-
unnormalized_env: ty::ParameterEnvironment<'tcx>,
440+
unnormalized_env: ty::ParamEnv<'tcx>,
441441
cause: ObligationCause<'tcx>)
442-
-> ty::ParameterEnvironment<'tcx>
442+
-> ty::ParamEnv<'tcx>
443443
{
444444
// I'm not wild about reporting errors here; I'd prefer to
445445
// have the errors get reported at a defined place (e.g.,
@@ -477,15 +477,15 @@ pub fn normalize_param_env_or_error<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
477477
debug!("normalize_param_env_or_error: elaborated-predicates={:?}",
478478
predicates);
479479

480-
let elaborated_env = ty::ParameterEnvironment::new(tcx.intern_predicates(&predicates));
480+
let elaborated_env = ty::ParamEnv::new(tcx.intern_predicates(&predicates));
481481

482482
tcx.infer_ctxt(elaborated_env, Reveal::UserFacing).enter(|infcx| {
483483
let predicates = match fully_normalize(
484484
&infcx, cause,
485485
// You would really want to pass infcx.parameter_environment.caller_bounds here,
486486
// but that is an interned slice, and fully_normalize takes &T and returns T, so
487487
// without further refactoring, a slice can't be used. Luckily, we still have the
488-
// predicate vector from which we created the ParameterEnvironment in infcx, so we
488+
// predicate vector from which we created the ParamEnv in infcx, so we
489489
// can pass that instead. It's roundabout and a bit brittle, but this code path
490490
// ought to be refactored anyway, and until then it saves us from having to copy.
491491
&predicates,
@@ -528,7 +528,7 @@ pub fn normalize_param_env_or_error<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
528528
debug!("normalize_param_env_or_error: resolved predicates={:?}",
529529
predicates);
530530

531-
ty::ParameterEnvironment::new(tcx.intern_predicates(&predicates))
531+
ty::ParamEnv::new(tcx.intern_predicates(&predicates))
532532
})
533533
}
534534

src/librustc/traits/select.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
315315
self.infcx.tcx
316316
}
317317

318-
pub fn param_env(&self) -> ty::ParameterEnvironment<'gcx> {
318+
pub fn param_env(&self) -> ty::ParamEnv<'gcx> {
319319
self.infcx.param_env()
320320
}
321321

src/librustc/ty/maps.rs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ impl Key for (MirSuite, MirPassIndex, DefId) {
136136
}
137137
}
138138

139-
impl<'tcx, T: Clone + Hash + Eq + Debug> Key for ty::ParameterEnvironmentAnd<'tcx, T> {
139+
impl<'tcx, T: Clone + Hash + Eq + Debug> Key for ty::ParamEnvAnd<'tcx, T> {
140140
fn map_crate(&self) -> CrateNum {
141141
LOCAL_CRATE
142142
}
@@ -254,25 +254,25 @@ impl<M: DepTrackingMapConfig<Key=DefId>> QueryDescription for M {
254254
}
255255

256256
impl<'tcx> QueryDescription for queries::is_copy_raw<'tcx> {
257-
fn describe(_tcx: TyCtxt, env: ty::ParameterEnvironmentAnd<'tcx, Ty<'tcx>>) -> String {
257+
fn describe(_tcx: TyCtxt, env: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> String {
258258
format!("computing whether `{}` is `Copy`", env.value)
259259
}
260260
}
261261

262262
impl<'tcx> QueryDescription for queries::is_sized_raw<'tcx> {
263-
fn describe(_tcx: TyCtxt, env: ty::ParameterEnvironmentAnd<'tcx, Ty<'tcx>>) -> String {
263+
fn describe(_tcx: TyCtxt, env: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> String {
264264
format!("computing whether `{}` is `Sized`", env.value)
265265
}
266266
}
267267

268268
impl<'tcx> QueryDescription for queries::is_freeze_raw<'tcx> {
269-
fn describe(_tcx: TyCtxt, env: ty::ParameterEnvironmentAnd<'tcx, Ty<'tcx>>) -> String {
269+
fn describe(_tcx: TyCtxt, env: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> String {
270270
format!("computing whether `{}` is freeze", env.value)
271271
}
272272
}
273273

274274
impl<'tcx> QueryDescription for queries::needs_drop_raw<'tcx> {
275-
fn describe(_tcx: TyCtxt, env: ty::ParameterEnvironmentAnd<'tcx, Ty<'tcx>>) -> String {
275+
fn describe(_tcx: TyCtxt, env: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> String {
276276
format!("computing whether `{}` needs drop", env.value)
277277
}
278278
}
@@ -890,14 +890,14 @@ define_maps! { <'tcx>
890890
[] specialization_graph_of: SpecializationGraph(DefId) -> Rc<specialization_graph::Graph>,
891891
[] is_object_safe: ObjectSafety(DefId) -> bool,
892892

893-
[] parameter_environment: ParameterEnvironment(DefId) -> ty::ParameterEnvironment<'tcx>,
893+
[] parameter_environment: ParamEnv(DefId) -> ty::ParamEnv<'tcx>,
894894

895895
// Trait selection queries. These are best used by invoking `ty.moves_by_default()`,
896896
// `ty.is_copy()`, etc, since that will prune the environment where possible.
897-
[] is_copy_raw: is_copy_dep_node(ty::ParameterEnvironmentAnd<'tcx, Ty<'tcx>>) -> bool,
898-
[] is_sized_raw: is_sized_dep_node(ty::ParameterEnvironmentAnd<'tcx, Ty<'tcx>>) -> bool,
899-
[] is_freeze_raw: is_freeze_dep_node(ty::ParameterEnvironmentAnd<'tcx, Ty<'tcx>>) -> bool,
900-
[] needs_drop_raw: needs_drop_dep_node(ty::ParameterEnvironmentAnd<'tcx, Ty<'tcx>>) -> bool,
897+
[] is_copy_raw: is_copy_dep_node(ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> bool,
898+
[] is_sized_raw: is_sized_dep_node(ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> bool,
899+
[] is_freeze_raw: is_freeze_dep_node(ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> bool,
900+
[] needs_drop_raw: needs_drop_dep_node(ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> bool,
901901
}
902902

903903
fn coherent_trait_dep_node((_, def_id): (CrateNum, DefId)) -> DepNode<DefId> {
@@ -942,22 +942,22 @@ fn relevant_trait_impls_for((def_id, _): (DefId, SimplifiedType)) -> DepNode<Def
942942
DepNode::TraitImpls(def_id)
943943
}
944944

945-
fn is_copy_dep_node<'tcx>(_: ty::ParameterEnvironmentAnd<'tcx, Ty<'tcx>>) -> DepNode<DefId> {
945+
fn is_copy_dep_node<'tcx>(_: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> DepNode<DefId> {
946946
let krate_def_id = DefId::local(CRATE_DEF_INDEX);
947947
DepNode::IsCopy(krate_def_id)
948948
}
949949

950-
fn is_sized_dep_node<'tcx>(_: ty::ParameterEnvironmentAnd<'tcx, Ty<'tcx>>) -> DepNode<DefId> {
950+
fn is_sized_dep_node<'tcx>(_: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> DepNode<DefId> {
951951
let krate_def_id = DefId::local(CRATE_DEF_INDEX);
952952
DepNode::IsSized(krate_def_id)
953953
}
954954

955-
fn is_freeze_dep_node<'tcx>(_: ty::ParameterEnvironmentAnd<'tcx, Ty<'tcx>>) -> DepNode<DefId> {
955+
fn is_freeze_dep_node<'tcx>(_: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> DepNode<DefId> {
956956
let krate_def_id = DefId::local(CRATE_DEF_INDEX);
957957
DepNode::IsSized(krate_def_id)
958958
}
959959

960-
fn needs_drop_dep_node<'tcx>(_: ty::ParameterEnvironmentAnd<'tcx, Ty<'tcx>>) -> DepNode<DefId> {
960+
fn needs_drop_dep_node<'tcx>(_: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> DepNode<DefId> {
961961
let krate_def_id = DefId::local(CRATE_DEF_INDEX);
962962
DepNode::NeedsDrop(krate_def_id)
963963
}

src/librustc/ty/mod.rs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1238,18 +1238,18 @@ impl<'tcx> InstantiatedPredicates<'tcx> {
12381238
}
12391239
}
12401240

1241-
/// When type checking, we use the `ParameterEnvironment` to track
1241+
/// When type checking, we use the `ParamEnv` to track
12421242
/// details about the set of where-clauses that are in scope at this
12431243
/// particular point.
12441244
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
1245-
pub struct ParameterEnvironment<'tcx> {
1245+
pub struct ParamEnv<'tcx> {
12461246
/// Obligations that the caller must satisfy. This is basically
12471247
/// the set of bounds on the in-scope type parameters, translated
12481248
/// into Obligations, and elaborated and normalized.
12491249
pub caller_bounds: &'tcx Slice<ty::Predicate<'tcx>>,
12501250
}
12511251

1252-
impl<'tcx> ParameterEnvironment<'tcx> {
1252+
impl<'tcx> ParamEnv<'tcx> {
12531253
/// Creates a suitable environment in which to perform trait
12541254
/// queries on the given value. This will either be `self` *or*
12551255
/// the empty environment, depending on whether `value` references
@@ -1265,30 +1265,30 @@ impl<'tcx> ParameterEnvironment<'tcx> {
12651265
/// effectively, when type-checking the body of said
12661266
/// function. This preserves existing behavior in any
12671267
/// case. --nmatsakis
1268-
pub fn and<T: TypeFoldable<'tcx>>(self, value: T) -> ParameterEnvironmentAnd<'tcx, T> {
1268+
pub fn and<T: TypeFoldable<'tcx>>(self, value: T) -> ParamEnvAnd<'tcx, T> {
12691269
assert!(!value.needs_infer());
12701270
if value.has_param_types() || value.has_self_ty() {
1271-
ParameterEnvironmentAnd {
1271+
ParamEnvAnd {
12721272
param_env: self,
12731273
value: value,
12741274
}
12751275
} else {
1276-
ParameterEnvironmentAnd {
1277-
param_env: ParameterEnvironment::empty(),
1276+
ParamEnvAnd {
1277+
param_env: ParamEnv::empty(),
12781278
value: value,
12791279
}
12801280
}
12811281
}
12821282
}
12831283

12841284
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
1285-
pub struct ParameterEnvironmentAnd<'tcx, T> {
1286-
pub param_env: ParameterEnvironment<'tcx>,
1285+
pub struct ParamEnvAnd<'tcx, T> {
1286+
pub param_env: ParamEnv<'tcx>,
12871287
pub value: T,
12881288
}
12891289

1290-
impl<'tcx, T> ParameterEnvironmentAnd<'tcx, T> {
1291-
pub fn into_parts(self) -> (ParameterEnvironment<'tcx>, T) {
1290+
impl<'tcx, T> ParamEnvAnd<'tcx, T> {
1291+
pub fn into_parts(self) -> (ParamEnv<'tcx>, T) {
12921292
(self.param_env, self.value)
12931293
}
12941294
}
@@ -2517,10 +2517,10 @@ fn trait_of_item<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> Option
25172517
})
25182518
}
25192519

2520-
/// See `ParameterEnvironment` struct def'n for details.
2520+
/// See `ParamEnv` struct def'n for details.
25212521
fn parameter_environment<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
25222522
def_id: DefId)
2523-
-> ParameterEnvironment<'tcx> {
2523+
-> ParamEnv<'tcx> {
25242524
// Compute the bounds on Self and the type parameters.
25252525

25262526
let bounds = tcx.predicates_of(def_id).instantiate_identity(tcx);
@@ -2538,7 +2538,7 @@ fn parameter_environment<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
25382538
// are any errors at that point, so after type checking you can be
25392539
// sure that this will succeed without errors anyway.
25402540

2541-
let unnormalized_env = ty::ParameterEnvironment::new(tcx.intern_predicates(&predicates));
2541+
let unnormalized_env = ty::ParamEnv::new(tcx.intern_predicates(&predicates));
25422542

25432543
let body_id = tcx.hir.as_local_node_id(def_id).map_or(DUMMY_NODE_ID, |id| {
25442544
tcx.hir.maybe_body_owned_by(id).map_or(id, |body| body.node_id)

0 commit comments

Comments
 (0)