rename ParameterEnvironment to ParamEnv

This commit is contained in:
Niko Matsakis 2017-05-15 17:57:30 -04:00
parent ca65a8a808
commit 226358e2fb
22 changed files with 91 additions and 91 deletions

View File

@ -163,7 +163,7 @@ pub enum DepNode<D: Clone + Debug> {
// not a hotspot.
ProjectionCache { def_ids: Vec<D> },
ParameterEnvironment(D),
ParamEnv(D),
DescribeDef(D),
DefSpan(D),
Stability(D),
@ -293,7 +293,7 @@ impl<D: Clone + Debug> DepNode<D> {
let def_ids: Option<Vec<E>> = 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),

View File

@ -28,7 +28,7 @@ use middle::lang_items;
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<ty::TypeckTables<'tcx>>,
Option<ty::ParameterEnvironment<'tcx>>);
Option<ty::ParamEnv<'tcx>>);
}
impl<'a, 'tcx> InferEnv<'a, 'tcx> for () {
fn to_parts(self, _: TyCtxt<'a, 'tcx, 'tcx>)
-> (Option<&'a ty::TypeckTables<'tcx>>,
Option<ty::TypeckTables<'tcx>>,
Option<ty::ParameterEnvironment<'tcx>>) {
Option<ty::ParamEnv<'tcx>>) {
(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<ty::TypeckTables<'tcx>>,
Option<ty::ParameterEnvironment<'tcx>>) {
Option<ty::ParamEnv<'tcx>>) {
(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<ty::TypeckTables<'tcx>>,
Option<ty::ParameterEnvironment<'tcx>>) {
Option<ty::ParamEnv<'tcx>>) {
(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<ty::TypeckTables<'tcx>>,
Option<ty::ParameterEnvironment<'tcx>>) {
Option<ty::ParamEnv<'tcx>>) {
(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<ty::TypeckTables<'tcx>>,
Option<ty::ParameterEnvironment<'tcx>>) {
Option<ty::ParamEnv<'tcx>>) {
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<RefCell<ty::TypeckTables<'tcx>>>,
tables: Option<&'a ty::TypeckTables<'gcx>>,
param_env: Option<ty::ParameterEnvironment<'gcx>>,
param_env: Option<ty::ParamEnv<'gcx>>,
projection_mode: Reveal,
}
@ -526,7 +526,7 @@ impl<'a, 'gcx, 'tcx> InferCtxtBuilder<'a, 'gcx, 'tcx> {
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 @@ impl<'a, 'tcx> TyCtxt<'a, 'tcx, 'tcx> {
}
pub fn normalize_associated_type_in_env<T>(
self, value: &T, env: ty::ParameterEnvironment<'tcx>
self, value: &T, env: ty::ParamEnv<'tcx>
) -> T
where T: TransNormalize<'tcx>
{
@ -1672,7 +1672,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
self.tables.borrow().upvar_capture_map.get(&upvar_id).cloned()
}
pub fn param_env(&self) -> ty::ParameterEnvironment<'gcx> {
pub fn param_env(&self) -> ty::ParamEnv<'gcx> {
self.parameter_environment
}

View File

@ -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

View File

@ -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))
})
}

View File

@ -315,7 +315,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'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()
}

View File

@ -136,7 +136,7 @@ impl Key for (MirSuite, MirPassIndex, DefId) {
}
}
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<M: DepTrackingMapConfig<Key=DefId>> 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 @@ define_maps! { <'tcx>
[] specialization_graph_of: SpecializationGraph(DefId) -> Rc<specialization_graph::Graph>,
[] 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<DefId> {
@ -942,22 +942,22 @@ fn relevant_trait_impls_for((def_id, _): (DefId, SimplifiedType)) -> DepNode<Def
DepNode::TraitImpls(def_id)
}
fn is_copy_dep_node<'tcx>(_: ty::ParameterEnvironmentAnd<'tcx, Ty<'tcx>>) -> DepNode<DefId> {
fn is_copy_dep_node<'tcx>(_: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> DepNode<DefId> {
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<DefId> {
fn is_sized_dep_node<'tcx>(_: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> DepNode<DefId> {
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<DefId> {
fn is_freeze_dep_node<'tcx>(_: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> DepNode<DefId> {
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<DefId> {
fn needs_drop_dep_node<'tcx>(_: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> DepNode<DefId> {
let krate_def_id = DefId::local(CRATE_DEF_INDEX);
DepNode::NeedsDrop(krate_def_id)
}

View File

@ -1238,18 +1238,18 @@ impl<'tcx> InstantiatedPredicates<'tcx> {
}
}
/// 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<ty::Predicate<'tcx>>,
}
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<T: TypeFoldable<'tcx>>(self, value: T) -> ParameterEnvironmentAnd<'tcx, T> {
pub fn and<T: TypeFoldable<'tcx>>(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 @@ impl<'tcx> ParameterEnvironment<'tcx> {
}
#[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)

View File

@ -16,7 +16,7 @@ use infer::InferCtxt;
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<Span>),
}
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 @@ impl<'tcx> ParameterEnvironment<'tcx> {
/// Construct a trait environment with the given set of predicates.
pub fn new(caller_bounds: &'tcx ty::Slice<ty::Predicate<'tcx>>) -> 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 @@ impl<'a, 'gcx, 'tcx, W> TypeVisitor<'tcx> for TypeIdHasher<'a, 'gcx, 'tcx, W>
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 @@ impl<'a, 'tcx> ty::TyS<'tcx> {
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 @@ impl<'a, 'tcx> ty::TyS<'tcx> {
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 @@ impl<'a, 'tcx> ty::TyS<'tcx> {
#[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 @@ impl<'a, 'tcx> ty::TyS<'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,

View File

@ -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> {

View File

@ -196,7 +196,7 @@ impl<'a, 'b, 'tcx> DropElaborator<'a, 'tcx> for Elaborator<'a, 'b, '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
}

View File

@ -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 @@ impl<'tcx> MovePathLookup<'tcx> {
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 @@ impl<'a, 'tcx> MoveData<'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);

View File

@ -51,7 +51,7 @@ fn has_rustc_mir_with(attrs: &[ast::Attribute], name: &str) -> Option<MetaItem>
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,

View File

@ -535,7 +535,7 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> {
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"),

View File

@ -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,
}

View File

@ -527,7 +527,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MissingCopyImplementations {
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;
}

View File

@ -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 {

View File

@ -545,7 +545,7 @@ impl<'a, 'tcx> Inliner<'a, 'tcx> {
}
}
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<u64> {
tcx.infer_ctxt(param_env, traits::Reveal::All).enter(|infcx| {
ty.layout(&infcx).ok().map(|layout| {

View File

@ -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<Local, Option<Qualif>>,
return_qualif: Option<Qualif>,
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)

View File

@ -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<Operand<'tcx>>;

View File

@ -38,7 +38,7 @@ use rustc::middle::expr_use_visitor as euv;
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();
}

View File

@ -24,7 +24,7 @@ use partitioning::CodegenUnit;
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 @@ impl<'b, 'tcx> SharedCrateContext<'b, '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 {

View File

@ -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,