From 226358e2fb2541678c21bdddc603311863a5ab93 Mon Sep 17 00:00:00 2001 From: Niko Matsakis Date: Mon, 15 May 2017 17:57:30 -0400 Subject: [PATCH] rename `ParameterEnvironment` to `ParamEnv` --- src/librustc/dep_graph/dep_node.rs | 4 +-- src/librustc/infer/mod.rs | 30 +++++++++---------- src/librustc/traits/README.md | 2 +- src/librustc/traits/mod.rs | 10 +++---- src/librustc/traits/select.rs | 2 +- src/librustc/ty/maps.rs | 28 ++++++++--------- src/librustc/ty/mod.rs | 28 ++++++++--------- src/librustc/ty/util.rs | 24 +++++++-------- src/librustc_borrowck/borrowck/check_loans.rs | 2 +- .../borrowck/mir/elaborate_drops.rs | 4 +-- .../borrowck/mir/gather_moves.rs | 10 +++---- src/librustc_borrowck/borrowck/mir/mod.rs | 2 +- src/librustc_borrowck/borrowck/mod.rs | 2 +- src/librustc_const_eval/check_match.rs | 2 +- src/librustc_lint/builtin.rs | 2 +- src/librustc_mir/shim.rs | 4 +-- src/librustc_mir/transform/inline.rs | 2 +- src/librustc_mir/transform/qualify_consts.rs | 6 ++-- src/librustc_mir/util/elaborate_drops.rs | 2 +- src/librustc_passes/consts.rs | 6 ++-- src/librustc_trans/context.rs | 8 ++--- src/librustc_typeck/check/compare_method.rs | 2 +- 22 files changed, 91 insertions(+), 91 deletions(-) diff --git a/src/librustc/dep_graph/dep_node.rs b/src/librustc/dep_graph/dep_node.rs index 12a3e5bfaa0..291d0d7c937 100644 --- a/src/librustc/dep_graph/dep_node.rs +++ b/src/librustc/dep_graph/dep_node.rs @@ -163,7 +163,7 @@ pub enum DepNode { // not a hotspot. ProjectionCache { def_ids: Vec }, - ParameterEnvironment(D), + ParamEnv(D), DescribeDef(D), DefSpan(D), Stability(D), @@ -293,7 +293,7 @@ pub fn map_def(&self, mut op: OP) -> Option> let def_ids: Option> = def_ids.iter().map(op).collect(); def_ids.map(|d| ProjectionCache { def_ids: d }) } - ParameterEnvironment(ref d) => op(d).map(ParameterEnvironment), + ParamEnv(ref d) => op(d).map(ParamEnv), DescribeDef(ref d) => op(d).map(DescribeDef), DefSpan(ref d) => op(d).map(DefSpan), Stability(ref d) => op(d).map(Stability), diff --git a/src/librustc/infer/mod.rs b/src/librustc/infer/mod.rs index 7dcad0122e8..090ad4c2661 100644 --- a/src/librustc/infer/mod.rs +++ b/src/librustc/infer/mod.rs @@ -28,7 +28,7 @@ use mir::tcx::LvalueTy; use ty::subst::{Kind, Subst, Substs}; use ty::{TyVid, IntVid, FloatVid}; -use ty::{self, ParameterEnvironment, Ty, TyCtxt}; +use ty::{self, ParamEnv, Ty, TyCtxt}; use ty::error::{ExpectedFound, TypeError, UnconstrainedNumeric}; use ty::fold::{TypeFoldable, TypeFolder, TypeVisitor}; use ty::relate::{Relate, RelateResult, TypeRelation}; @@ -161,7 +161,7 @@ pub struct InferCtxt<'a, 'gcx: 'a+'tcx, 'tcx: 'a> { // For region variables. region_vars: RegionVarBindings<'a, 'gcx, 'tcx>, - pub parameter_environment: ty::ParameterEnvironment<'gcx>, + pub parameter_environment: ty::ParamEnv<'gcx>, /// Caches the results of trait selection. This cache is used /// for things that have to do with the parameters in scope. @@ -406,41 +406,41 @@ pub trait InferEnv<'a, 'tcx> { fn to_parts(self, tcx: TyCtxt<'a, 'tcx, 'tcx>) -> (Option<&'a ty::TypeckTables<'tcx>>, Option>, - Option>); + Option>); } impl<'a, 'tcx> InferEnv<'a, 'tcx> for () { fn to_parts(self, _: TyCtxt<'a, 'tcx, 'tcx>) -> (Option<&'a ty::TypeckTables<'tcx>>, Option>, - Option>) { + Option>) { (None, None, None) } } -impl<'a, 'tcx> InferEnv<'a, 'tcx> for ty::ParameterEnvironment<'tcx> { +impl<'a, 'tcx> InferEnv<'a, 'tcx> for ty::ParamEnv<'tcx> { fn to_parts(self, _: TyCtxt<'a, 'tcx, 'tcx>) -> (Option<&'a ty::TypeckTables<'tcx>>, Option>, - Option>) { + Option>) { (None, None, Some(self)) } } -impl<'a, 'tcx> InferEnv<'a, 'tcx> for (&'a ty::TypeckTables<'tcx>, ty::ParameterEnvironment<'tcx>) { +impl<'a, 'tcx> InferEnv<'a, 'tcx> for (&'a ty::TypeckTables<'tcx>, ty::ParamEnv<'tcx>) { fn to_parts(self, _: TyCtxt<'a, 'tcx, 'tcx>) -> (Option<&'a ty::TypeckTables<'tcx>>, Option>, - Option>) { + Option>) { (Some(self.0), None, Some(self.1)) } } -impl<'a, 'tcx> InferEnv<'a, 'tcx> for (ty::TypeckTables<'tcx>, ty::ParameterEnvironment<'tcx>) { +impl<'a, 'tcx> InferEnv<'a, 'tcx> for (ty::TypeckTables<'tcx>, ty::ParamEnv<'tcx>) { fn to_parts(self, _: TyCtxt<'a, 'tcx, 'tcx>) -> (Option<&'a ty::TypeckTables<'tcx>>, Option>, - Option>) { + Option>) { (None, Some(self.0), Some(self.1)) } } @@ -449,7 +449,7 @@ impl<'a, 'tcx> InferEnv<'a, 'tcx> for hir::BodyId { fn to_parts(self, tcx: TyCtxt<'a, 'tcx, 'tcx>) -> (Option<&'a ty::TypeckTables<'tcx>>, Option>, - Option>) { + Option>) { let def_id = tcx.hir.body_owner_def_id(self); (Some(tcx.typeck_tables_of(def_id)), None, @@ -465,7 +465,7 @@ pub struct InferCtxtBuilder<'a, 'gcx: 'a+'tcx, 'tcx: 'a> { arena: DroplessArena, fresh_tables: Option>>, tables: Option<&'a ty::TypeckTables<'gcx>>, - param_env: Option>, + param_env: Option>, projection_mode: Reveal, } @@ -526,7 +526,7 @@ pub fn enter(&'tcx mut self, f: F) -> R let tables = tables.map(InferTables::Interned).unwrap_or_else(|| { fresh_tables.as_ref().map_or(InferTables::Missing, InferTables::InProgress) }); - let param_env = param_env.take().unwrap_or_else(|| ParameterEnvironment::empty()); + let param_env = param_env.take().unwrap_or_else(|| ParamEnv::empty()); global_tcx.enter_local(arena, |tcx| f(InferCtxt { tcx: tcx, tables: tables, @@ -648,7 +648,7 @@ pub fn normalize_associated_type(self, value: &T) -> T } pub fn normalize_associated_type_in_env( - self, value: &T, env: ty::ParameterEnvironment<'tcx> + self, value: &T, env: ty::ParamEnv<'tcx> ) -> T where T: TransNormalize<'tcx> { @@ -1672,7 +1672,7 @@ pub fn upvar_capture(&self, upvar_id: ty::UpvarId) -> Option ty::ParameterEnvironment<'gcx> { + pub fn param_env(&self) -> ty::ParamEnv<'gcx> { self.parameter_environment } diff --git a/src/librustc/traits/README.md b/src/librustc/traits/README.md index ff72f9dd07e..2e941902031 100644 --- a/src/librustc/traits/README.md +++ b/src/librustc/traits/README.md @@ -418,7 +418,7 @@ before, and hence the cache lookup would succeed, yielding One subtle interaction is that the results of trait lookup will vary depending on what where clauses are in scope. Therefore, we actually have *two* caches, a local and a global cache. The local cache is -attached to the `ParameterEnvironment` and the global cache attached +attached to ParamEnv` and the global cache attached to the `tcx`. We use the local cache whenever the result might depend on the where clauses that are in scope. The determination of which cache to use is done by the method `pick_candidate_cache` in diff --git a/src/librustc/traits/mod.rs b/src/librustc/traits/mod.rs index 9e3381d8450..fd6efa9fd06 100644 --- a/src/librustc/traits/mod.rs +++ b/src/librustc/traits/mod.rs @@ -437,9 +437,9 @@ pub fn type_known_to_meet_bound<'a, 'gcx, 'tcx>(infcx: &InferCtxt<'a, 'gcx, 'tcx /// Normalizes the parameter environment, reporting errors if they occur. pub fn normalize_param_env_or_error<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, region_context: DefId, - unnormalized_env: ty::ParameterEnvironment<'tcx>, + unnormalized_env: ty::ParamEnv<'tcx>, cause: ObligationCause<'tcx>) - -> ty::ParameterEnvironment<'tcx> + -> ty::ParamEnv<'tcx> { // I'm not wild about reporting errors here; I'd prefer to // have the errors get reported at a defined place (e.g., @@ -477,7 +477,7 @@ pub fn normalize_param_env_or_error<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, debug!("normalize_param_env_or_error: elaborated-predicates={:?}", predicates); - let elaborated_env = ty::ParameterEnvironment::new(tcx.intern_predicates(&predicates)); + let elaborated_env = ty::ParamEnv::new(tcx.intern_predicates(&predicates)); tcx.infer_ctxt(elaborated_env, Reveal::UserFacing).enter(|infcx| { let predicates = match fully_normalize( @@ -485,7 +485,7 @@ pub fn normalize_param_env_or_error<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, // You would really want to pass infcx.parameter_environment.caller_bounds here, // but that is an interned slice, and fully_normalize takes &T and returns T, so // without further refactoring, a slice can't be used. Luckily, we still have the - // predicate vector from which we created the ParameterEnvironment in infcx, so we + // predicate vector from which we created the ParamEnv in infcx, so we // can pass that instead. It's roundabout and a bit brittle, but this code path // ought to be refactored anyway, and until then it saves us from having to copy. &predicates, @@ -528,7 +528,7 @@ pub fn normalize_param_env_or_error<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, debug!("normalize_param_env_or_error: resolved predicates={:?}", predicates); - ty::ParameterEnvironment::new(tcx.intern_predicates(&predicates)) + ty::ParamEnv::new(tcx.intern_predicates(&predicates)) }) } diff --git a/src/librustc/traits/select.rs b/src/librustc/traits/select.rs index 5be07e712b6..7366ed45f31 100644 --- a/src/librustc/traits/select.rs +++ b/src/librustc/traits/select.rs @@ -315,7 +315,7 @@ pub fn tcx(&self) -> TyCtxt<'cx, 'gcx, 'tcx> { self.infcx.tcx } - pub fn param_env(&self) -> ty::ParameterEnvironment<'gcx> { + pub fn param_env(&self) -> ty::ParamEnv<'gcx> { self.infcx.param_env() } diff --git a/src/librustc/ty/maps.rs b/src/librustc/ty/maps.rs index 5f2bc03ed9e..63f3f2ee2d2 100644 --- a/src/librustc/ty/maps.rs +++ b/src/librustc/ty/maps.rs @@ -136,7 +136,7 @@ fn default_span(&self, tcx: TyCtxt) -> Span { } } -impl<'tcx, T: Clone + Hash + Eq + Debug> Key for ty::ParameterEnvironmentAnd<'tcx, T> { +impl<'tcx, T: Clone + Hash + Eq + Debug> Key for ty::ParamEnvAnd<'tcx, T> { fn map_crate(&self) -> CrateNum { LOCAL_CRATE } @@ -254,25 +254,25 @@ impl> QueryDescription for M { } impl<'tcx> QueryDescription for queries::is_copy_raw<'tcx> { - fn describe(_tcx: TyCtxt, env: ty::ParameterEnvironmentAnd<'tcx, Ty<'tcx>>) -> String { + fn describe(_tcx: TyCtxt, env: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> String { format!("computing whether `{}` is `Copy`", env.value) } } impl<'tcx> QueryDescription for queries::is_sized_raw<'tcx> { - fn describe(_tcx: TyCtxt, env: ty::ParameterEnvironmentAnd<'tcx, Ty<'tcx>>) -> String { + fn describe(_tcx: TyCtxt, env: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> String { format!("computing whether `{}` is `Sized`", env.value) } } impl<'tcx> QueryDescription for queries::is_freeze_raw<'tcx> { - fn describe(_tcx: TyCtxt, env: ty::ParameterEnvironmentAnd<'tcx, Ty<'tcx>>) -> String { + fn describe(_tcx: TyCtxt, env: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> String { format!("computing whether `{}` is freeze", env.value) } } impl<'tcx> QueryDescription for queries::needs_drop_raw<'tcx> { - fn describe(_tcx: TyCtxt, env: ty::ParameterEnvironmentAnd<'tcx, Ty<'tcx>>) -> String { + fn describe(_tcx: TyCtxt, env: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> String { format!("computing whether `{}` needs drop", env.value) } } @@ -890,14 +890,14 @@ fn default() -> Self { [] specialization_graph_of: SpecializationGraph(DefId) -> Rc, [] is_object_safe: ObjectSafety(DefId) -> bool, - [] parameter_environment: ParameterEnvironment(DefId) -> ty::ParameterEnvironment<'tcx>, + [] parameter_environment: ParamEnv(DefId) -> ty::ParamEnv<'tcx>, // Trait selection queries. These are best used by invoking `ty.moves_by_default()`, // `ty.is_copy()`, etc, since that will prune the environment where possible. - [] is_copy_raw: is_copy_dep_node(ty::ParameterEnvironmentAnd<'tcx, Ty<'tcx>>) -> bool, - [] is_sized_raw: is_sized_dep_node(ty::ParameterEnvironmentAnd<'tcx, Ty<'tcx>>) -> bool, - [] is_freeze_raw: is_freeze_dep_node(ty::ParameterEnvironmentAnd<'tcx, Ty<'tcx>>) -> bool, - [] needs_drop_raw: needs_drop_dep_node(ty::ParameterEnvironmentAnd<'tcx, Ty<'tcx>>) -> bool, + [] is_copy_raw: is_copy_dep_node(ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> bool, + [] is_sized_raw: is_sized_dep_node(ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> bool, + [] is_freeze_raw: is_freeze_dep_node(ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> bool, + [] needs_drop_raw: needs_drop_dep_node(ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> bool, } fn coherent_trait_dep_node((_, def_id): (CrateNum, DefId)) -> DepNode { @@ -942,22 +942,22 @@ fn relevant_trait_impls_for((def_id, _): (DefId, SimplifiedType)) -> DepNode(_: ty::ParameterEnvironmentAnd<'tcx, Ty<'tcx>>) -> DepNode { +fn is_copy_dep_node<'tcx>(_: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> DepNode { let krate_def_id = DefId::local(CRATE_DEF_INDEX); DepNode::IsCopy(krate_def_id) } -fn is_sized_dep_node<'tcx>(_: ty::ParameterEnvironmentAnd<'tcx, Ty<'tcx>>) -> DepNode { +fn is_sized_dep_node<'tcx>(_: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> DepNode { let krate_def_id = DefId::local(CRATE_DEF_INDEX); DepNode::IsSized(krate_def_id) } -fn is_freeze_dep_node<'tcx>(_: ty::ParameterEnvironmentAnd<'tcx, Ty<'tcx>>) -> DepNode { +fn is_freeze_dep_node<'tcx>(_: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> DepNode { let krate_def_id = DefId::local(CRATE_DEF_INDEX); DepNode::IsSized(krate_def_id) } -fn needs_drop_dep_node<'tcx>(_: ty::ParameterEnvironmentAnd<'tcx, Ty<'tcx>>) -> DepNode { +fn needs_drop_dep_node<'tcx>(_: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> DepNode { let krate_def_id = DefId::local(CRATE_DEF_INDEX); DepNode::NeedsDrop(krate_def_id) } diff --git a/src/librustc/ty/mod.rs b/src/librustc/ty/mod.rs index 357944c6a9e..ec49d7ff2c6 100644 --- a/src/librustc/ty/mod.rs +++ b/src/librustc/ty/mod.rs @@ -1238,18 +1238,18 @@ pub fn is_empty(&self) -> bool { } } -/// When type checking, we use the `ParameterEnvironment` to track +/// When type checking, we use the `ParamEnv` to track /// details about the set of where-clauses that are in scope at this /// particular point. #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)] -pub struct ParameterEnvironment<'tcx> { +pub struct ParamEnv<'tcx> { /// Obligations that the caller must satisfy. This is basically /// the set of bounds on the in-scope type parameters, translated /// into Obligations, and elaborated and normalized. pub caller_bounds: &'tcx Slice>, } -impl<'tcx> ParameterEnvironment<'tcx> { +impl<'tcx> ParamEnv<'tcx> { /// Creates a suitable environment in which to perform trait /// queries on the given value. This will either be `self` *or* /// the empty environment, depending on whether `value` references @@ -1265,16 +1265,16 @@ impl<'tcx> ParameterEnvironment<'tcx> { /// effectively, when type-checking the body of said /// function. This preserves existing behavior in any /// case. --nmatsakis - pub fn and>(self, value: T) -> ParameterEnvironmentAnd<'tcx, T> { + pub fn and>(self, value: T) -> ParamEnvAnd<'tcx, T> { assert!(!value.needs_infer()); if value.has_param_types() || value.has_self_ty() { - ParameterEnvironmentAnd { + ParamEnvAnd { param_env: self, value: value, } } else { - ParameterEnvironmentAnd { - param_env: ParameterEnvironment::empty(), + ParamEnvAnd { + param_env: ParamEnv::empty(), value: value, } } @@ -1282,13 +1282,13 @@ pub fn and>(self, value: T) -> ParameterEnvironmentAnd<'tc } #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)] -pub struct ParameterEnvironmentAnd<'tcx, T> { - pub param_env: ParameterEnvironment<'tcx>, +pub struct ParamEnvAnd<'tcx, T> { + pub param_env: ParamEnv<'tcx>, pub value: T, } -impl<'tcx, T> ParameterEnvironmentAnd<'tcx, T> { - pub fn into_parts(self) -> (ParameterEnvironment<'tcx>, T) { +impl<'tcx, T> ParamEnvAnd<'tcx, T> { + pub fn into_parts(self) -> (ParamEnv<'tcx>, T) { (self.param_env, self.value) } } @@ -2517,10 +2517,10 @@ fn trait_of_item<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> Option }) } -/// See `ParameterEnvironment` struct def'n for details. +/// See `ParamEnv` struct def'n for details. fn parameter_environment<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) - -> ParameterEnvironment<'tcx> { + -> ParamEnv<'tcx> { // Compute the bounds on Self and the type parameters. let bounds = tcx.predicates_of(def_id).instantiate_identity(tcx); @@ -2538,7 +2538,7 @@ fn parameter_environment<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, // are any errors at that point, so after type checking you can be // sure that this will succeed without errors anyway. - let unnormalized_env = ty::ParameterEnvironment::new(tcx.intern_predicates(&predicates)); + let unnormalized_env = ty::ParamEnv::new(tcx.intern_predicates(&predicates)); let body_id = tcx.hir.as_local_node_id(def_id).map_or(DUMMY_NODE_ID, |id| { tcx.hir.maybe_body_owned_by(id).map_or(id, |body| body.node_id) diff --git a/src/librustc/ty/util.rs b/src/librustc/ty/util.rs index 0c2f4efccd5..d18b0a69ade 100644 --- a/src/librustc/ty/util.rs +++ b/src/librustc/ty/util.rs @@ -16,7 +16,7 @@ use ich::{StableHashingContext, NodeIdHashingMode}; use traits::{self, Reveal}; use ty::{self, Ty, TyCtxt, TypeFoldable}; -use ty::ParameterEnvironment; +use ty::ParamEnv; use ty::fold::TypeVisitor; use ty::layout::{Layout, LayoutError}; use ty::subst::{Subst, Kind}; @@ -148,7 +148,7 @@ pub enum Representability { SelfRecursive(Vec), } -impl<'tcx> ParameterEnvironment<'tcx> { +impl<'tcx> ParamEnv<'tcx> { /// Construct a trait environment suitable for contexts where /// there are no where clauses in scope. pub fn empty() -> Self { @@ -157,7 +157,7 @@ pub fn empty() -> Self { /// Construct a trait environment with the given set of predicates. pub fn new(caller_bounds: &'tcx ty::Slice>) -> Self { - ty::ParameterEnvironment { caller_bounds } + ty::ParamEnv { caller_bounds } } pub fn can_type_implement_copy<'a>(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>, @@ -720,7 +720,7 @@ fn visit_binder>(&mut self, x: &ty::Binder) -> bool { impl<'a, 'tcx> ty::TyS<'tcx> { pub fn moves_by_default(&'tcx self, tcx: TyCtxt<'a, 'tcx, 'tcx>, - param_env: ParameterEnvironment<'tcx>, + param_env: ParamEnv<'tcx>, span: Span) -> bool { !tcx.at(span).is_copy_raw(param_env.and(self)) @@ -728,7 +728,7 @@ pub fn moves_by_default(&'tcx self, pub fn is_sized(&'tcx self, tcx: TyCtxt<'a, 'tcx, 'tcx>, - param_env: ParameterEnvironment<'tcx>, + param_env: ParamEnv<'tcx>, span: Span)-> bool { tcx.at(span).is_sized_raw(param_env.and(self)) @@ -736,7 +736,7 @@ pub fn is_sized(&'tcx self, pub fn is_freeze(&'tcx self, tcx: TyCtxt<'a, 'tcx, 'tcx>, - param_env: ParameterEnvironment<'tcx>, + param_env: ParamEnv<'tcx>, span: Span)-> bool { tcx.at(span).is_freeze_raw(param_env.and(self)) @@ -751,7 +751,7 @@ pub fn is_freeze(&'tcx self, #[inline] pub fn needs_drop(&'tcx self, tcx: TyCtxt<'a, 'tcx, 'tcx>, - param_env: ty::ParameterEnvironment<'tcx>) + param_env: ty::ParamEnv<'tcx>) -> bool { tcx.needs_drop_raw(param_env.and(self)) } @@ -942,7 +942,7 @@ fn is_type_structurally_recursive<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, } fn is_copy_raw<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, - query: ty::ParameterEnvironmentAnd<'tcx, Ty<'tcx>>) + query: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> bool { let (param_env, ty) = query.into_parts(); @@ -952,7 +952,7 @@ fn is_copy_raw<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, } fn is_sized_raw<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, - query: ty::ParameterEnvironmentAnd<'tcx, Ty<'tcx>>) + query: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> bool { let (param_env, ty) = query.into_parts(); @@ -962,7 +962,7 @@ fn is_sized_raw<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, } fn is_freeze_raw<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, - query: ty::ParameterEnvironmentAnd<'tcx, Ty<'tcx>>) + query: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> bool { let (param_env, ty) = query.into_parts(); @@ -972,7 +972,7 @@ fn is_freeze_raw<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, } fn needs_drop_raw<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, - query: ty::ParameterEnvironmentAnd<'tcx, Ty<'tcx>>) + query: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> bool { let (param_env, ty) = query.into_parts(); @@ -1018,7 +1018,7 @@ fn needs_drop_raw<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, ty::TyAdt(def, _) if def.has_dtor(tcx) => true, // Can refer to a type which may drop. - // FIXME(eddyb) check this against a ParameterEnvironment. + // FIXME(eddyb) check this against a ParamEnv. ty::TyDynamic(..) | ty::TyProjection(..) | ty::TyParam(_) | ty::TyAnon(..) | ty::TyInfer(_) | ty::TyError => true, diff --git a/src/librustc_borrowck/borrowck/check_loans.rs b/src/librustc_borrowck/borrowck/check_loans.rs index eeb5a3fb957..fd632d0c741 100644 --- a/src/librustc_borrowck/borrowck/check_loans.rs +++ b/src/librustc_borrowck/borrowck/check_loans.rs @@ -90,7 +90,7 @@ struct CheckLoanCtxt<'a, 'tcx: 'a> { dfcx_loans: &'a LoanDataFlow<'a, 'tcx>, move_data: &'a move_data::FlowedMoveData<'a, 'tcx>, all_loans: &'a [Loan<'tcx>], - param_env: &'a ty::ParameterEnvironment<'tcx>, + param_env: &'a ty::ParamEnv<'tcx>, } impl<'a, 'tcx> euv::Delegate<'tcx> for CheckLoanCtxt<'a, 'tcx> { diff --git a/src/librustc_borrowck/borrowck/mir/elaborate_drops.rs b/src/librustc_borrowck/borrowck/mir/elaborate_drops.rs index 0178aa818d6..5f13a080909 100644 --- a/src/librustc_borrowck/borrowck/mir/elaborate_drops.rs +++ b/src/librustc_borrowck/borrowck/mir/elaborate_drops.rs @@ -196,7 +196,7 @@ fn tcx(&self) -> ty::TyCtxt<'a, 'tcx, 'tcx> { self.ctxt.tcx } - fn param_env(&self) -> ty::ParameterEnvironment<'tcx> { + fn param_env(&self) -> ty::ParamEnv<'tcx> { self.ctxt.param_env() } @@ -290,7 +290,7 @@ struct ElaborateDropsCtxt<'a, 'tcx: 'a> { impl<'b, 'tcx> ElaborateDropsCtxt<'b, 'tcx> { fn move_data(&self) -> &'b MoveData<'tcx> { &self.env.move_data } - fn param_env(&self) -> ty::ParameterEnvironment<'tcx> { + fn param_env(&self) -> ty::ParamEnv<'tcx> { self.env.param_env } diff --git a/src/librustc_borrowck/borrowck/mir/gather_moves.rs b/src/librustc_borrowck/borrowck/mir/gather_moves.rs index ebaae1b30d7..cf56a705839 100644 --- a/src/librustc_borrowck/borrowck/mir/gather_moves.rs +++ b/src/librustc_borrowck/borrowck/mir/gather_moves.rs @@ -9,7 +9,7 @@ // except according to those terms. -use rustc::ty::{self, TyCtxt, ParameterEnvironment}; +use rustc::ty::{self, TyCtxt, ParamEnv}; use rustc::mir::*; use rustc::util::nodemap::FxHashMap; use rustc_data_structures::indexed_vec::{IndexVec}; @@ -191,7 +191,7 @@ pub struct MovePathLookup<'tcx> { struct MoveDataBuilder<'a, 'tcx: 'a> { mir: &'a Mir<'tcx>, tcx: TyCtxt<'a, 'tcx, 'tcx>, - param_env: ParameterEnvironment<'tcx>, + param_env: ParamEnv<'tcx>, data: MoveData<'tcx>, } @@ -203,7 +203,7 @@ pub enum MovePathError { impl<'a, 'tcx> MoveDataBuilder<'a, 'tcx> { fn new(mir: &'a Mir<'tcx>, tcx: TyCtxt<'a, 'tcx, 'tcx>, - param_env: ParameterEnvironment<'tcx>) + param_env: ParamEnv<'tcx>) -> Self { let mut move_paths = IndexVec::new(); let mut path_map = IndexVec::new(); @@ -370,7 +370,7 @@ pub fn find(&self, lval: &Lvalue<'tcx>) -> LookupResult { impl<'a, 'tcx> MoveData<'tcx> { pub fn gather_moves(mir: &Mir<'tcx>, tcx: TyCtxt<'a, 'tcx, 'tcx>, - param_env: ParameterEnvironment<'tcx>) + param_env: ParamEnv<'tcx>) -> Self { gather_moves(mir, tcx, param_env) } @@ -378,7 +378,7 @@ pub fn gather_moves(mir: &Mir<'tcx>, fn gather_moves<'a, 'tcx>(mir: &Mir<'tcx>, tcx: TyCtxt<'a, 'tcx, 'tcx>, - param_env: ParameterEnvironment<'tcx>) + param_env: ParamEnv<'tcx>) -> MoveData<'tcx> { let mut builder = MoveDataBuilder::new(mir, tcx, param_env); diff --git a/src/librustc_borrowck/borrowck/mir/mod.rs b/src/librustc_borrowck/borrowck/mir/mod.rs index 003fc2ae9c2..aa7952e493c 100644 --- a/src/librustc_borrowck/borrowck/mir/mod.rs +++ b/src/librustc_borrowck/borrowck/mir/mod.rs @@ -51,7 +51,7 @@ fn has_rustc_mir_with(attrs: &[ast::Attribute], name: &str) -> Option pub struct MoveDataParamEnv<'tcx> { move_data: MoveData<'tcx>, - param_env: ty::ParameterEnvironment<'tcx>, + param_env: ty::ParamEnv<'tcx>, } pub fn borrowck_mir(bcx: &mut BorrowckCtxt, diff --git a/src/librustc_borrowck/borrowck/mod.rs b/src/librustc_borrowck/borrowck/mod.rs index c28d45be18d..f7c20542cbf 100644 --- a/src/librustc_borrowck/borrowck/mod.rs +++ b/src/librustc_borrowck/borrowck/mod.rs @@ -535,7 +535,7 @@ pub fn report_use_of_moved_value(&self, lp: &LoanPath<'tcx>, the_move: &move_data::Move, moved_lp: &LoanPath<'tcx>, - _param_env: &ty::ParameterEnvironment<'tcx>) { + _param_env: &ty::ParamEnv<'tcx>) { let (verb, verb_participle) = match use_kind { MovedInUse => ("use", "used"), MovedInCapture => ("capture", "captured"), diff --git a/src/librustc_const_eval/check_match.rs b/src/librustc_const_eval/check_match.rs index 6e2a13a9a0d..91886b221fe 100644 --- a/src/librustc_const_eval/check_match.rs +++ b/src/librustc_const_eval/check_match.rs @@ -69,7 +69,7 @@ fn create_e0004<'a>(sess: &'a Session, sp: Span, error_message: String) -> Diagn struct MatchVisitor<'a, 'tcx: 'a> { tcx: TyCtxt<'a, 'tcx, 'tcx>, tables: &'a ty::TypeckTables<'tcx>, - param_env: ty::ParameterEnvironment<'tcx>, + param_env: ty::ParamEnv<'tcx>, region_maps: &'a RegionMaps, } diff --git a/src/librustc_lint/builtin.rs b/src/librustc_lint/builtin.rs index d67f7bc901f..1a56a2d0777 100644 --- a/src/librustc_lint/builtin.rs +++ b/src/librustc_lint/builtin.rs @@ -527,7 +527,7 @@ fn check_item(&mut self, cx: &LateContext, item: &hir::Item) { if def.has_dtor(cx.tcx) { return; } - let param_env = ty::ParameterEnvironment::empty(); + let param_env = ty::ParamEnv::empty(); if !ty.moves_by_default(cx.tcx, param_env, item.span) { return; } diff --git a/src/librustc_mir/shim.rs b/src/librustc_mir/shim.rs index e80764b7af2..14d7be67d64 100644 --- a/src/librustc_mir/shim.rs +++ b/src/librustc_mir/shim.rs @@ -217,7 +217,7 @@ pub struct DropShimElaborator<'a, 'tcx: 'a> { mir: &'a Mir<'tcx>, patch: MirPatch<'tcx>, tcx: ty::TyCtxt<'a, 'tcx, 'tcx>, - param_env: ty::ParameterEnvironment<'tcx>, + param_env: ty::ParamEnv<'tcx>, } impl<'a, 'tcx> fmt::Debug for DropShimElaborator<'a, 'tcx> { @@ -232,7 +232,7 @@ impl<'a, 'tcx> DropElaborator<'a, 'tcx> for DropShimElaborator<'a, 'tcx> { fn patch(&mut self) -> &mut MirPatch<'tcx> { &mut self.patch } fn mir(&self) -> &'a Mir<'tcx> { self.mir } fn tcx(&self) -> ty::TyCtxt<'a, 'tcx, 'tcx> { self.tcx } - fn param_env(&self) -> ty::ParameterEnvironment<'tcx> { self.param_env } + fn param_env(&self) -> ty::ParamEnv<'tcx> { self.param_env } fn drop_style(&self, _path: Self::Path, mode: DropFlagMode) -> DropStyle { if let DropFlagMode::Shallow = mode { diff --git a/src/librustc_mir/transform/inline.rs b/src/librustc_mir/transform/inline.rs index e2c10c1a547..5516d84e121 100644 --- a/src/librustc_mir/transform/inline.rs +++ b/src/librustc_mir/transform/inline.rs @@ -545,7 +545,7 @@ fn make_call_args(&self, args: Vec>, } } -fn type_size_of<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, param_env: ty::ParameterEnvironment<'tcx>, +fn type_size_of<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, param_env: ty::ParamEnv<'tcx>, ty: Ty<'tcx>) -> Option { tcx.infer_ctxt(param_env, traits::Reveal::All).enter(|infcx| { ty.layout(&infcx).ok().map(|layout| { diff --git a/src/librustc_mir/transform/qualify_consts.rs b/src/librustc_mir/transform/qualify_consts.rs index 9737c603987..c839061df16 100644 --- a/src/librustc_mir/transform/qualify_consts.rs +++ b/src/librustc_mir/transform/qualify_consts.rs @@ -78,7 +78,7 @@ impl<'a, 'tcx> Qualif { /// Remove flags which are impossible for the given type. fn restrict(&mut self, ty: Ty<'tcx>, tcx: TyCtxt<'a, 'tcx, 'tcx>, - param_env: ty::ParameterEnvironment<'tcx>) { + param_env: ty::ParamEnv<'tcx>) { if ty.is_freeze(tcx, param_env, DUMMY_SP) { *self = *self - Qualif::MUTABLE_INTERIOR; } @@ -128,7 +128,7 @@ struct Qualifier<'a, 'gcx: 'a+'tcx, 'tcx: 'a> { mir: &'a Mir<'tcx>, rpo: ReversePostorder<'a, 'tcx>, tcx: TyCtxt<'a, 'gcx, 'tcx>, - param_env: ty::ParameterEnvironment<'tcx>, + param_env: ty::ParamEnv<'tcx>, temp_qualif: IndexVec>, return_qualif: Option, qualif: Qualif, @@ -139,7 +139,7 @@ struct Qualifier<'a, 'gcx: 'a+'tcx, 'tcx: 'a> { impl<'a, 'tcx> Qualifier<'a, 'tcx, 'tcx> { fn new(tcx: TyCtxt<'a, 'tcx, 'tcx>, - param_env: ty::ParameterEnvironment<'tcx>, + param_env: ty::ParamEnv<'tcx>, def_id: DefId, mir: &'a Mir<'tcx>, mode: Mode) diff --git a/src/librustc_mir/util/elaborate_drops.rs b/src/librustc_mir/util/elaborate_drops.rs index 0573a4e2ee1..585840ce1e5 100644 --- a/src/librustc_mir/util/elaborate_drops.rs +++ b/src/librustc_mir/util/elaborate_drops.rs @@ -56,7 +56,7 @@ pub trait DropElaborator<'a, 'tcx: 'a> : fmt::Debug { fn patch(&mut self) -> &mut MirPatch<'tcx>; fn mir(&self) -> &'a Mir<'tcx>; fn tcx(&self) -> ty::TyCtxt<'a, 'tcx, 'tcx>; - fn param_env(&self) -> ty::ParameterEnvironment<'tcx>; + fn param_env(&self) -> ty::ParamEnv<'tcx>; fn drop_style(&self, path: Self::Path, mode: DropFlagMode) -> DropStyle; fn get_drop_flag(&mut self, path: Self::Path) -> Option>; diff --git a/src/librustc_passes/consts.rs b/src/librustc_passes/consts.rs index 9a8ea52a665..8b58e71a0d6 100644 --- a/src/librustc_passes/consts.rs +++ b/src/librustc_passes/consts.rs @@ -38,7 +38,7 @@ use rustc::middle::mem_categorization as mc; use rustc::middle::mem_categorization::Categorization; use rustc::mir::transform::MirSource; -use rustc::ty::{self, ParameterEnvironment, Ty, TyCtxt}; +use rustc::ty::{self, ParamEnv, Ty, TyCtxt}; use rustc::traits::Reveal; use rustc::util::common::ErrorReported; use rustc::util::nodemap::NodeSet; @@ -58,7 +58,7 @@ struct CheckCrateVisitor<'a, 'tcx: 'a> { in_fn: bool, promotable: bool, mut_rvalue_borrows: NodeSet, - param_env: ty::ParameterEnvironment<'tcx>, + param_env: ty::ParamEnv<'tcx>, tables: &'a ty::TypeckTables<'tcx>, } @@ -466,7 +466,7 @@ pub fn check_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) { in_fn: false, promotable: false, mut_rvalue_borrows: NodeSet(), - param_env: ParameterEnvironment::empty(), + param_env: ParamEnv::empty(), }.as_deep_visitor()); tcx.sess.abort_if_errors(); } diff --git a/src/librustc_trans/context.rs b/src/librustc_trans/context.rs index 7baaf25cf25..5a1b8d96cbc 100644 --- a/src/librustc_trans/context.rs +++ b/src/librustc_trans/context.rs @@ -24,7 +24,7 @@ use type_::Type; use rustc_data_structures::base_n; use rustc::ty::subst::Substs; -use rustc::ty::{self, ParameterEnvironment, Ty, TyCtxt}; +use rustc::ty::{self, ParamEnv, Ty, TyCtxt}; use rustc::ty::layout::{LayoutTyper, TyLayout}; use session::config::NoDebugInfo; use session::Session; @@ -321,15 +321,15 @@ pub fn new(tcx: TyCtxt<'b, 'tcx, 'tcx>, } pub fn type_needs_drop(&self, ty: Ty<'tcx>) -> bool { - ty.needs_drop(self.tcx, ParameterEnvironment::empty()) + ty.needs_drop(self.tcx, ParamEnv::empty()) } pub fn type_is_sized(&self, ty: Ty<'tcx>) -> bool { - ty.is_sized(self.tcx, ParameterEnvironment::empty(), DUMMY_SP) + ty.is_sized(self.tcx, ParamEnv::empty(), DUMMY_SP) } pub fn type_is_freeze(&self, ty: Ty<'tcx>) -> bool { - ty.is_freeze(self.tcx, ParameterEnvironment::empty(), DUMMY_SP) + ty.is_freeze(self.tcx, ParamEnv::empty(), DUMMY_SP) } pub fn exported_symbols<'a>(&'a self) -> &'a NodeSet { diff --git a/src/librustc_typeck/check/compare_method.rs b/src/librustc_typeck/check/compare_method.rs index 320884b82f4..d89a5e7a519 100644 --- a/src/librustc_typeck/check/compare_method.rs +++ b/src/librustc_typeck/check/compare_method.rs @@ -212,7 +212,7 @@ fn compare_predicate_entailment<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, // The key step here is to update the caller_bounds's predicates to be // the new hybrid bounds we computed. let normalize_cause = traits::ObligationCause::misc(impl_m_span, impl_m_node_id); - let param_env = ty::ParameterEnvironment::new(tcx.intern_predicates(&hybrid_preds.predicates)); + let param_env = ty::ParamEnv::new(tcx.intern_predicates(&hybrid_preds.predicates)); let param_env = traits::normalize_param_env_or_error(tcx, impl_m.def_id, param_env, -- 2.44.0