diff options
| author | varkor <github@varkor.com> | 2018-08-22 01:35:29 +0100 |
|---|---|---|
| committer | varkor <github@varkor.com> | 2018-08-22 16:07:55 +0100 |
| commit | 04fa5d3adbb8212f5b4e87e3bbd7b74bb7c9ec65 (patch) | |
| tree | ba27d455ed89ba5d5a70a8265cc062fc2c52aae7 /src/librustc | |
| parent | 6f637da50c56a22f745fd056691da8c86824cd9b (diff) | |
| download | rust-04fa5d3adbb8212f5b4e87e3bbd7b74bb7c9ec65.tar.gz rust-04fa5d3adbb8212f5b4e87e3bbd7b74bb7c9ec65.zip | |
Remove Ty prefix from Ty{Foreign|Param}
Diffstat (limited to 'src/librustc')
33 files changed, 92 insertions, 92 deletions
diff --git a/src/librustc/hir/def.rs b/src/librustc/hir/def.rs index 4a14223eb88..a4b2e18ec10 100644 --- a/src/librustc/hir/def.rs +++ b/src/librustc/hir/def.rs @@ -53,13 +53,13 @@ pub enum Def { Existential(DefId), /// `type Foo = Bar;` TyAlias(DefId), - TyForeign(DefId), + Foreign(DefId), TraitAlias(DefId), AssociatedTy(DefId), /// `existential type Foo: Bar;` AssociatedExistential(DefId), PrimTy(hir::PrimTy), - TyParam(DefId), + Param(DefId), SelfTy(Option<DefId> /* trait */, Option<DefId> /* impl */), ToolMod, // e.g. `rustfmt` in `#[rustfmt::skip]` @@ -269,10 +269,10 @@ impl Def { Def::Fn(id) | Def::Mod(id) | Def::Static(id, _) | Def::Variant(id) | Def::VariantCtor(id, ..) | Def::Enum(id) | Def::TyAlias(id) | Def::TraitAlias(id) | - Def::AssociatedTy(id) | Def::TyParam(id) | Def::Struct(id) | Def::StructCtor(id, ..) | + Def::AssociatedTy(id) | Def::Param(id) | Def::Struct(id) | Def::StructCtor(id, ..) | Def::Union(id) | Def::Trait(id) | Def::Method(id) | Def::Const(id) | Def::AssociatedConst(id) | Def::Macro(id, ..) | - Def::Existential(id) | Def::AssociatedExistential(id) | Def::TyForeign(id) => { + Def::Existential(id) | Def::AssociatedExistential(id) | Def::Foreign(id) => { id } @@ -311,11 +311,11 @@ impl Def { Def::StructCtor(.., CtorKind::Fictive) => bug!("impossible struct constructor"), Def::Union(..) => "union", Def::Trait(..) => "trait", - Def::TyForeign(..) => "foreign type", + Def::Foreign(..) => "foreign type", Def::Method(..) => "method", Def::Const(..) => "constant", Def::AssociatedConst(..) => "associated constant", - Def::TyParam(..) => "type parameter", + Def::Param(..) => "type parameter", Def::PrimTy(..) => "builtin type", Def::Local(..) => "local variable", Def::Upvar(..) => "closure capture", diff --git a/src/librustc/hir/lowering.rs b/src/librustc/hir/lowering.rs index b5f5f4d5c11..4251e4e9eaa 100644 --- a/src/librustc/hir/lowering.rs +++ b/src/librustc/hir/lowering.rs @@ -1183,7 +1183,7 @@ impl<'a> LoweringContext<'a> { } ImplTraitContext::Universal(in_band_ty_params) => { self.lower_node_id(def_node_id); - // Add a definition for the in-band TyParam + // Add a definition for the in-band Param let def_index = self .resolver .definitions() @@ -1213,7 +1213,7 @@ impl<'a> LoweringContext<'a> { None, P(hir::Path { span, - def: Def::TyParam(DefId::local(def_index)), + def: Def::Param(DefId::local(def_index)), segments: hir_vec![hir::PathSegment::from_ident(ident)], }), )) @@ -2352,7 +2352,7 @@ impl<'a> LoweringContext<'a> { if path.segments.len() == 1 && bound_pred.bound_generic_params.is_empty() => { - if let Some(Def::TyParam(def_id)) = self.resolver + if let Some(Def::Param(def_id)) = self.resolver .get_resolution(bound_pred.bounded_ty.id) .map(|d| d.base_def()) { diff --git a/src/librustc/hir/map/mod.rs b/src/librustc/hir/map/mod.rs index ebda91cb7b0..b48e9a1f45c 100644 --- a/src/librustc/hir/map/mod.rs +++ b/src/librustc/hir/map/mod.rs @@ -453,7 +453,7 @@ impl<'hir> Map<'hir> { match item.node { ForeignItemKind::Fn(..) => Some(Def::Fn(def_id)), ForeignItemKind::Static(_, m) => Some(Def::Static(def_id, m)), - ForeignItemKind::Type => Some(Def::TyForeign(def_id)), + ForeignItemKind::Type => Some(Def::Foreign(def_id)), } } NodeTraitItem(item) => { @@ -499,7 +499,7 @@ impl<'hir> Map<'hir> { NodeGenericParam(param) => { Some(match param.kind { GenericParamKind::Lifetime { .. } => Def::Local(param.id), - GenericParamKind::Type { .. } => Def::TyParam(self.local_def_id(param.id)), + GenericParamKind::Type { .. } => Def::Param(self.local_def_id(param.id)), }) } } diff --git a/src/librustc/ich/impls_hir.rs b/src/librustc/ich/impls_hir.rs index 76e57558bfe..cb822d01534 100644 --- a/src/librustc/ich/impls_hir.rs +++ b/src/librustc/ich/impls_hir.rs @@ -1010,9 +1010,9 @@ impl_stable_hash_for!(enum hir::def::Def { AssociatedTy(def_id), AssociatedExistential(def_id), PrimTy(prim_ty), - TyParam(def_id), + Param(def_id), SelfTy(trait_def_id, impl_def_id), - TyForeign(def_id), + Foreign(def_id), Fn(def_id), Const(def_id), Static(def_id, is_mutbl), diff --git a/src/librustc/ich/impls_ty.rs b/src/librustc/ich/impls_ty.rs index 0cc1df2b8c2..a3d7aca3297 100644 --- a/src/librustc/ich/impls_ty.rs +++ b/src/librustc/ich/impls_ty.rs @@ -874,10 +874,10 @@ for ty::TyKind<'gcx> def_id.hash_stable(hcx, hasher); substs.hash_stable(hcx, hasher); } - TyParam(param_ty) => { + Param(param_ty) => { param_ty.hash_stable(hcx, hasher); } - TyForeign(def_id) => { + Foreign(def_id) => { def_id.hash_stable(hcx, hasher); } Infer(infer_ty) => { diff --git a/src/librustc/infer/canonical/canonicalizer.rs b/src/librustc/infer/canonical/canonicalizer.rs index 062c12579d9..02f8b4648f1 100644 --- a/src/librustc/infer/canonical/canonicalizer.rs +++ b/src/librustc/infer/canonical/canonicalizer.rs @@ -283,8 +283,8 @@ impl<'cx, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for Canonicalizer<'cx, 'gcx, 'tcx> | ty::Never | ty::Tuple(..) | ty::Projection(..) - | ty::TyForeign(..) - | ty::TyParam(..) + | ty::Foreign(..) + | ty::Param(..) | ty::Anon(..) => { if t.flags.intersects(self.needs_canonical_flags) { t.super_fold_with(self) diff --git a/src/librustc/infer/error_reporting/mod.rs b/src/librustc/infer/error_reporting/mod.rs index 4275e56db4e..4f83c7c4d0c 100644 --- a/src/librustc/infer/error_reporting/mod.rs +++ b/src/librustc/infer/error_reporting/mod.rs @@ -1123,7 +1123,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { let type_param = generics.type_param(param, self.tcx); let hir = &self.tcx.hir; hir.as_local_node_id(type_param.def_id).map(|id| { - // Get the `hir::TyParam` to verify whether it already has any bounds. + // Get the `hir::Param` to verify whether it already has any bounds. // We do this to avoid suggesting code that ends up as `T: 'a'b`, // instead we suggest `T: 'a + 'b` in that case. let mut has_bounds = false; diff --git a/src/librustc/infer/freshen.rs b/src/librustc/infer/freshen.rs index 06bc1bfbaf4..c1c16677ccc 100644 --- a/src/librustc/infer/freshen.rs +++ b/src/librustc/infer/freshen.rs @@ -193,8 +193,8 @@ impl<'a, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for TypeFreshener<'a, 'gcx, 'tcx> { ty::Never | ty::Tuple(..) | ty::Projection(..) | - ty::TyForeign(..) | - ty::TyParam(..) | + ty::Foreign(..) | + ty::Param(..) | ty::Closure(..) | ty::GeneratorWitness(..) | ty::Anon(..) => { diff --git a/src/librustc/infer/outlives/obligations.rs b/src/librustc/infer/outlives/obligations.rs index c1006c17ba2..817280b97e0 100644 --- a/src/librustc/infer/outlives/obligations.rs +++ b/src/librustc/infer/outlives/obligations.rs @@ -450,7 +450,7 @@ where fn type_bound(&self, ty: Ty<'tcx>) -> VerifyBound<'tcx> { match ty.sty { - ty::TyParam(p) => self.param_bound(p), + ty::Param(p) => self.param_bound(p), ty::Projection(data) => { let declared_bounds = self.projection_declared_bounds(data); self.projection_bound(declared_bounds, data) diff --git a/src/librustc/middle/resolve_lifetime.rs b/src/librustc/middle/resolve_lifetime.rs index 379f4df11fa..84890abc85d 100644 --- a/src/librustc/middle/resolve_lifetime.rs +++ b/src/librustc/middle/resolve_lifetime.rs @@ -1326,7 +1326,7 @@ fn object_lifetime_defaults_for_item( _ => continue, }; - if def == Def::TyParam(param_def_id) { + if def == Def::Param(param_def_id) { add_bounds(&mut set, &data.bounds); } } diff --git a/src/librustc/traits/auto_trait.rs b/src/librustc/traits/auto_trait.rs index 87296f631bd..ed95aa73078 100644 --- a/src/librustc/traits/auto_trait.rs +++ b/src/librustc/traits/auto_trait.rs @@ -606,7 +606,7 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> { } return match substs.type_at(0).sty { - ty::TyParam(_) => true, + ty::Param(_) => true, ty::Projection(p) => self.is_of_param(p.substs), _ => false, }; diff --git a/src/librustc/traits/coherence.rs b/src/librustc/traits/coherence.rs index 2e82bad877c..dd0fc7ebfce 100644 --- a/src/librustc/traits/coherence.rs +++ b/src/librustc/traits/coherence.rs @@ -407,7 +407,7 @@ fn uncovered_tys<'tcx>(tcx: TyCtxt, ty: Ty<'tcx>, in_crate: InCrate) fn is_possibly_remote_type(ty: Ty, _in_crate: InCrate) -> bool { match ty.sty { - ty::Projection(..) | ty::TyParam(..) => true, + ty::Projection(..) | ty::Param(..) => true, _ => false, } } @@ -455,7 +455,7 @@ fn ty_is_local_constructor(ty: Ty, in_crate: InCrate) -> bool { ty::Ref(..) | ty::Never | ty::Tuple(..) | - ty::TyParam(..) | + ty::Param(..) | ty::Projection(..) => { false } @@ -468,7 +468,7 @@ fn ty_is_local_constructor(ty: Ty, in_crate: InCrate) -> bool { }, ty::Adt(def, _) => def_id_is_local(def.did, in_crate), - ty::TyForeign(did) => def_id_is_local(did, in_crate), + ty::Foreign(did) => def_id_is_local(did, in_crate), ty::Dynamic(ref tt, ..) => { tt.principal().map_or(false, |p| { diff --git a/src/librustc/traits/error_reporting.rs b/src/librustc/traits/error_reporting.rs index cfb4e049e92..e095984d07f 100644 --- a/src/librustc/traits/error_reporting.rs +++ b/src/librustc/traits/error_reporting.rs @@ -256,7 +256,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { ty::Closure(..) => Some(9), ty::Tuple(..) => Some(10), ty::Projection(..) => Some(11), - ty::TyParam(..) => Some(12), + ty::Param(..) => Some(12), ty::Anon(..) => Some(13), ty::Never => Some(14), ty::Adt(adt, ..) => match adt.adt_kind() { @@ -265,7 +265,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { AdtKind::Enum => Some(17), }, ty::Generator(..) => Some(18), - ty::TyForeign(..) => Some(19), + ty::Foreign(..) => Some(19), ty::GeneratorWitness(..) => Some(20), ty::Infer(..) | ty::Error => None } @@ -785,7 +785,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { let found_did = match found_trait_ty.sty { ty::Closure(did, _) | - ty::TyForeign(did) | + ty::Foreign(did) | ty::FnDef(did, _) => Some(did), ty::Adt(def, _) => Some(def.did), _ => None, @@ -1348,7 +1348,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { fn tcx<'b>(&'b self) -> TyCtxt<'b, 'gcx, 'tcx> { self.infcx.tcx } fn fold_ty(&mut self, ty: Ty<'tcx>) -> Ty<'tcx> { - if let ty::TyParam(ty::ParamTy {name, ..}) = ty.sty { + if let ty::Param(ty::ParamTy {name, ..}) = ty.sty { let infcx = self.infcx; self.var_map.entry(ty).or_insert_with(|| infcx.next_ty_var( diff --git a/src/librustc/traits/object_safety.rs b/src/librustc/traits/object_safety.rs index dc1da5b0461..17d55b77625 100644 --- a/src/librustc/traits/object_safety.rs +++ b/src/librustc/traits/object_safety.rs @@ -371,7 +371,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { let mut error = false; ty.maybe_walk(|ty| { match ty.sty { - ty::TyParam(ref param_ty) => { + ty::Param(ref param_ty) => { if param_ty.is_self() { error = true; } diff --git a/src/librustc/traits/query/dropck_outlives.rs b/src/librustc/traits/query/dropck_outlives.rs index 1d51f165aef..63552ba4a30 100644 --- a/src/librustc/traits/query/dropck_outlives.rs +++ b/src/librustc/traits/query/dropck_outlives.rs @@ -228,7 +228,7 @@ pub fn trivial_dropck_outlives<'tcx>(tcx: TyCtxt<'_, '_, 'tcx>, ty: Ty<'tcx>) -> | ty::RawPtr(_) | ty::Ref(..) | ty::TyStr - | ty::TyForeign(..) + | ty::Foreign(..) | ty::Error => true, // [T; N] and [T] have same properties as T. @@ -257,7 +257,7 @@ pub fn trivial_dropck_outlives<'tcx>(tcx: TyCtxt<'_, '_, 'tcx>, ty: Ty<'tcx>) -> // The following *might* require a destructor: it would deeper inspection to tell. ty::Dynamic(..) | ty::Projection(..) - | ty::TyParam(_) + | ty::Param(_) | ty::Anon(..) | ty::Infer(_) | ty::Generator(..) => false, diff --git a/src/librustc/traits/select.rs b/src/librustc/traits/select.rs index 55858cca1d1..d2d7b8c37cc 100644 --- a/src/librustc/traits/select.rs +++ b/src/librustc/traits/select.rs @@ -1810,13 +1810,13 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> { // say nothing; a candidate may be added by // `assemble_candidates_from_object_ty`. } - ty::TyForeign(..) => { + ty::Foreign(..) => { // Since the contents of foreign types is unknown, // we don't add any `..` impl. Default traits could // still be provided by a manual implementation for // this trait and type. } - ty::TyParam(..) | + ty::Param(..) | ty::Projection(..) => { // In these cases, we don't know what the actual // type is. Therefore, we cannot break it down @@ -2189,7 +2189,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> { Where(ty::Binder::dummy(Vec::new())) } - ty::TyStr | ty::Slice(_) | ty::Dynamic(..) | ty::TyForeign(..) => None, + ty::TyStr | ty::Slice(_) | ty::Dynamic(..) | ty::Foreign(..) => None, ty::Tuple(tys) => { Where(ty::Binder::bind(tys.last().into_iter().cloned().collect())) @@ -2203,7 +2203,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> { )) } - ty::Projection(_) | ty::TyParam(_) | ty::Anon(..) => None, + ty::Projection(_) | ty::Param(_) | ty::Anon(..) => None, ty::Infer(ty::TyVar(_)) => Ambiguous, ty::Infer(ty::CanonicalTy(_)) | @@ -2239,7 +2239,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> { } ty::Dynamic(..) | ty::TyStr | ty::Slice(..) | - ty::Generator(..) | ty::GeneratorWitness(..) | ty::TyForeign(..) | + ty::Generator(..) | ty::GeneratorWitness(..) | ty::Foreign(..) | ty::Ref(_, _, hir::MutMutable) => { None } @@ -2265,7 +2265,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> { } } - ty::Adt(..) | ty::Projection(..) | ty::TyParam(..) | ty::Anon(..) => { + ty::Adt(..) | ty::Projection(..) | ty::Param(..) | ty::Anon(..) => { // Fallback to whatever user-defined impls exist in this case. None } @@ -2316,8 +2316,8 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> { } ty::Dynamic(..) | - ty::TyParam(..) | - ty::TyForeign(..) | + ty::Param(..) | + ty::Foreign(..) | ty::Projection(..) | ty::Infer(ty::CanonicalTy(_)) | ty::Infer(ty::TyVar(_)) | @@ -3072,7 +3072,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> { let mut ty_params = BitArray::new(substs_a.types().count()); let mut found = false; for ty in field.walk() { - if let ty::TyParam(p) = ty.sty { + if let ty::Param(p) = ty.sty { ty_params.insert(p.idx as usize); found = true; } diff --git a/src/librustc/traits/specialize/mod.rs b/src/librustc/traits/specialize/mod.rs index caebcbec390..9343eff9e79 100644 --- a/src/librustc/traits/specialize/mod.rs +++ b/src/librustc/traits/specialize/mod.rs @@ -90,7 +90,7 @@ pub fn translate_substs<'a, 'gcx, 'tcx>(infcx: &InferCtxt<'a, 'gcx, 'tcx>, .unwrap() .subst(infcx.tcx, &source_substs); - // translate the Self and TyParam parts of the substitution, since those + // translate the Self and Param parts of the substitution, since those // vary across impls let target_substs = match target_node { specialization_graph::Node::Impl(target_impl) => { diff --git a/src/librustc/ty/context.rs b/src/librustc/ty/context.rs index b0c3f7f7edb..b725823b406 100644 --- a/src/librustc/ty/context.rs +++ b/src/librustc/ty/context.rs @@ -2078,7 +2078,7 @@ impl<'a, 'tcx> TyCtxt<'a, 'tcx, 'tcx> { self, Adt, Array, Slice, RawPtr, Ref, FnDef, FnPtr, Generator, GeneratorWitness, Dynamic, Closure, Tuple, - TyParam, Infer, Projection, Anon, TyForeign); + Param, Infer, Projection, Anon, Foreign); println!("Substs interner: #{}", self.interners.substs.borrow().len()); println!("Region interner: #{}", self.interners.region.borrow().len()); @@ -2387,7 +2387,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { } pub fn mk_foreign(self, def_id: DefId) -> Ty<'tcx> { - self.mk_ty(TyForeign(def_id)) + self.mk_ty(Foreign(def_id)) } pub fn mk_box(self, ty: Ty<'tcx>) -> Ty<'tcx> { @@ -2532,7 +2532,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { pub fn mk_ty_param(self, index: u32, name: InternedString) -> Ty<'tcx> { - self.mk_ty(TyParam(ParamTy { idx: index, name: name })) + self.mk_ty(Param(ParamTy { idx: index, name: name })) } pub fn mk_self_type(self) -> Ty<'tcx> { diff --git a/src/librustc/ty/error.rs b/src/librustc/ty/error.rs index 51d0a6819f6..d367a5e4bcf 100644 --- a/src/librustc/ty/error.rs +++ b/src/librustc/ty/error.rs @@ -180,7 +180,7 @@ impl<'a, 'gcx, 'lcx, 'tcx> ty::TyS<'tcx> { ty::Tuple(ref tys) if tys.is_empty() => self.to_string(), ty::Adt(def, _) => format!("{} `{}`", def.descr(), tcx.item_path_str(def.did)), - ty::TyForeign(def_id) => format!("extern type `{}`", tcx.item_path_str(def_id)), + ty::Foreign(def_id) => format!("extern type `{}`", tcx.item_path_str(def_id)), ty::Array(_, n) => { match n.assert_usize(tcx) { Some(n) => format!("array of {} elements", n), @@ -222,7 +222,7 @@ impl<'a, 'gcx, 'lcx, 'tcx> ty::TyS<'tcx> { ty::Infer(ty::FreshIntTy(_)) => "skolemized integral type".to_string(), ty::Infer(ty::FreshFloatTy(_)) => "skolemized floating-point type".to_string(), ty::Projection(_) => "associated type".to_string(), - ty::TyParam(ref p) => { + ty::Param(ref p) => { if p.is_self() { "Self".to_string() } else { diff --git a/src/librustc/ty/fast_reject.rs b/src/librustc/ty/fast_reject.rs index cdafdfeddea..d4eda9e96f2 100644 --- a/src/librustc/ty/fast_reject.rs +++ b/src/librustc/ty/fast_reject.rs @@ -103,7 +103,7 @@ pub fn simplify_type<'a, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, 'tcx>, ty::FnPtr(ref f) => { Some(FunctionSimplifiedType(f.skip_binder().inputs().len())) } - ty::Projection(_) | ty::TyParam(_) => { + ty::Projection(_) | ty::Param(_) => { if can_simplify_params { // In normalized types, projections don't unify with // anything. when lazy normalization happens, this @@ -118,7 +118,7 @@ pub fn simplify_type<'a, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, 'tcx>, ty::Anon(def_id, _) => { Some(AnonSimplifiedType(def_id)) } - ty::TyForeign(def_id) => { + ty::Foreign(def_id) => { Some(ForeignSimplifiedType(def_id)) } ty::Infer(_) | ty::Error => None, diff --git a/src/librustc/ty/flags.rs b/src/librustc/ty/flags.rs index 067d7cc00c5..bdff532933c 100644 --- a/src/librustc/ty/flags.rs +++ b/src/librustc/ty/flags.rs @@ -76,7 +76,7 @@ impl FlagComputation { &ty::TyUint(_) | &ty::Never | &ty::TyStr | - &ty::TyForeign(..) => { + &ty::Foreign(..) => { } // You might think that we could just return Error for @@ -90,7 +90,7 @@ impl FlagComputation { self.add_flags(TypeFlags::HAS_TY_ERR) } - &ty::TyParam(ref p) => { + &ty::Param(ref p) => { self.add_flags(TypeFlags::HAS_FREE_LOCAL_NAMES); if p.is_self() { self.add_flags(TypeFlags::HAS_SELF); diff --git a/src/librustc/ty/item_path.rs b/src/librustc/ty/item_path.rs index ce426c4749b..b8d68111284 100644 --- a/src/librustc/ty/item_path.rs +++ b/src/librustc/ty/item_path.rs @@ -307,7 +307,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { } } - ty::TyForeign(did) => self.push_item_path(buffer, did), + ty::Foreign(did) => self.push_item_path(buffer, did), ty::TyBool | ty::TyChar | @@ -375,7 +375,7 @@ pub fn characteristic_def_id_of_type(ty: Ty) -> Option<DefId> { ty::FnDef(def_id, _) | ty::Closure(def_id, _) | ty::Generator(def_id, _, _) | - ty::TyForeign(def_id) => Some(def_id), + ty::Foreign(def_id) => Some(def_id), ty::TyBool | ty::TyChar | @@ -384,7 +384,7 @@ pub fn characteristic_def_id_of_type(ty: Ty) -> Option<DefId> { ty::TyStr | ty::FnPtr(_) | ty::Projection(_) | - ty::TyParam(_) | + ty::Param(_) | ty::Anon(..) | ty::Infer(_) | ty::Error | diff --git a/src/librustc/ty/layout.rs b/src/librustc/ty/layout.rs index 77a737c9860..9bff0784283 100644 --- a/src/librustc/ty/layout.rs +++ b/src/librustc/ty/layout.rs @@ -521,7 +521,7 @@ impl<'a, 'tcx> LayoutCx<'tcx, TyCtxt<'a, 'tcx, 'tcx>> { let unsized_part = tcx.struct_tail(pointee); let metadata = match unsized_part.sty { - ty::TyForeign(..) => { + ty::Foreign(..) => { return Ok(tcx.intern_layout(LayoutDetails::scalar(self, data_ptr))); } ty::Slice(_) | ty::TyStr => { @@ -594,7 +594,7 @@ impl<'a, 'tcx> LayoutCx<'tcx, TyCtxt<'a, 'tcx, 'tcx>> { ty::FnDef(..) => { univariant(&[], &ReprOptions::default(), StructKind::AlwaysSized)? } - ty::Dynamic(..) | ty::TyForeign(..) => { + ty::Dynamic(..) | ty::Foreign(..) => { let mut unit = univariant_uninterned(&[], &ReprOptions::default(), StructKind::AlwaysSized)?; match unit.abi { @@ -1113,7 +1113,7 @@ impl<'a, 'tcx> LayoutCx<'tcx, TyCtxt<'a, 'tcx, 'tcx>> { ty::GeneratorWitness(..) | ty::Infer(_) => { bug!("LayoutDetails::compute: unexpected type `{}`", ty) } - ty::TyParam(_) | ty::Error => { + ty::Param(_) | ty::Error => { return Err(LayoutError::Unknown(ty)); } }) @@ -1299,7 +1299,7 @@ impl<'a, 'tcx> SizeSkeleton<'tcx> { let non_zero = !ty.is_unsafe_ptr(); let tail = tcx.struct_tail(pointee); match tail.sty { - ty::TyParam(_) | ty::Projection(_) => { + ty::Param(_) | ty::Projection(_) => { debug_assert!(tail.has_param_types() || tail.has_self_ty()); Ok(SizeSkeleton::Pointer { non_zero, @@ -1591,7 +1591,7 @@ impl<'a, 'tcx, C> TyLayoutMethods<'tcx, C> for Ty<'tcx> ty::Never | ty::FnDef(..) | ty::GeneratorWitness(..) | - ty::TyForeign(..) | + ty::Foreign(..) | ty::Dynamic(..) => { bug!("TyLayout::field_type({:?}): not applicable", this) } @@ -1686,7 +1686,7 @@ impl<'a, 'tcx, C> TyLayoutMethods<'tcx, C> for Ty<'tcx> } } - ty::Projection(_) | ty::Anon(..) | ty::TyParam(_) | + ty::Projection(_) | ty::Anon(..) | ty::Param(_) | ty::Infer(_) | ty::Error => { bug!("TyLayout::field_type: unexpected type `{}`", this.ty) } diff --git a/src/librustc/ty/mod.rs b/src/librustc/ty/mod.rs index 17ce9ef87cb..3b1f91c5d74 100644 --- a/src/librustc/ty/mod.rs +++ b/src/librustc/ty/mod.rs @@ -2239,7 +2239,7 @@ impl<'a, 'gcx, 'tcx> AdtDef { TyStr | Dynamic(..) | Slice(_) | - TyForeign(..) | + Foreign(..) | Error | GeneratorWitness(..) => { // these are never sized - return the target type @@ -2270,7 +2270,7 @@ impl<'a, 'gcx, 'tcx> AdtDef { vec![ty] } - TyParam(..) => { + Param(..) => { // perf hack: if there is a `T: Sized` bound, then // we know that `T` is Sized and do not need to check // it on the impl. diff --git a/src/librustc/ty/outlives.rs b/src/librustc/ty/outlives.rs index 6803e15022d..884f366de4f 100644 --- a/src/librustc/ty/outlives.rs +++ b/src/librustc/ty/outlives.rs @@ -94,7 +94,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { // OutlivesTypeParameterEnv -- the actual checking that `X:'a` // is implied by the environment is done in regionck. - ty::TyParam(p) => { + ty::Param(p) => { out.push(Component::Param(p)); } @@ -145,7 +145,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { ty::Never | // ... ty::Adt(..) | // OutlivesNominalType ty::Anon(..) | // OutlivesNominalType (ish) - ty::TyForeign(..) | // OutlivesNominalType + ty::Foreign(..) | // OutlivesNominalType ty::TyStr | // OutlivesScalar (ish) ty::Array(..) | // ... ty::Slice(..) | // ... diff --git a/src/librustc/ty/relate.rs b/src/librustc/ty/relate.rs index baa7485d33a..c65efdd946c 100644 --- a/src/librustc/ty/relate.rs +++ b/src/librustc/ty/relate.rs @@ -387,7 +387,7 @@ pub fn super_relate_tys<'a, 'gcx, 'tcx, R>(relation: &mut R, Ok(a) } - (&ty::TyParam(ref a_p), &ty::TyParam(ref b_p)) + (&ty::Param(ref a_p), &ty::Param(ref b_p)) if a_p.idx == b_p.idx => { Ok(a) @@ -400,7 +400,7 @@ pub fn super_relate_tys<'a, 'gcx, 'tcx, R>(relation: &mut R, Ok(tcx.mk_adt(a_def, substs)) } - (&ty::TyForeign(a_id), &ty::TyForeign(b_id)) + (&ty::Foreign(a_id), &ty::Foreign(b_id)) if a_id == b_id => { Ok(tcx.mk_foreign(a_id)) diff --git a/src/librustc/ty/structural_impls.rs b/src/librustc/ty/structural_impls.rs index 367e4c5cc7a..4dbbf50caa8 100644 --- a/src/librustc/ty/structural_impls.rs +++ b/src/librustc/ty/structural_impls.rs @@ -862,7 +862,7 @@ impl<'tcx> TypeFoldable<'tcx> for Ty<'tcx> { ty::Anon(did, substs) => ty::Anon(did, substs.fold_with(folder)), ty::TyBool | ty::TyChar | ty::TyStr | ty::TyInt(_) | ty::TyUint(_) | ty::TyFloat(_) | ty::Error | ty::Infer(_) | - ty::TyParam(..) | ty::Never | ty::TyForeign(..) => return self + ty::Param(..) | ty::Never | ty::Foreign(..) => return self }; if self.sty == sty { @@ -897,7 +897,7 @@ impl<'tcx> TypeFoldable<'tcx> for Ty<'tcx> { ty::Anon(_, ref substs) => substs.visit_with(visitor), ty::TyBool | ty::TyChar | ty::TyStr | ty::TyInt(_) | ty::TyUint(_) | ty::TyFloat(_) | ty::Error | ty::Infer(_) | - ty::TyParam(..) | ty::Never | ty::TyForeign(..) => false, + ty::Param(..) | ty::Never | ty::Foreign(..) => false, } } diff --git a/src/librustc/ty/sty.rs b/src/librustc/ty/sty.rs index 8a9302aa2d6..9c3da83814f 100644 --- a/src/librustc/ty/sty.rs +++ b/src/librustc/ty/sty.rs @@ -101,13 +101,13 @@ pub enum TyKind<'tcx> { /// Structures, enumerations and unions. /// - /// Substs here, possibly against intuition, *may* contain `TyParam`s. + /// Substs here, possibly against intuition, *may* contain `Param`s. /// That is, even after substitution it is possible that there are type /// variables. This happens when the `Adt` corresponds to an ADT /// definition and not a concrete use of it. Adt(&'tcx AdtDef, &'tcx Substs<'tcx>), - TyForeign(DefId), + Foreign(DefId), /// The pointee of a string slice. Written as `str`. TyStr, @@ -166,7 +166,7 @@ pub enum TyKind<'tcx> { Anon(DefId, &'tcx Substs<'tcx>), /// A type parameter; for example, `T` in `fn f<T>(x: T) {} - TyParam(ParamTy), + Param(ParamTy), /// A type variable used during type-checking. Infer(InferTy), @@ -1058,7 +1058,7 @@ pub type Region<'tcx> = &'tcx RegionKind; /// the likes of `liberate_late_bound_regions`. The distinction exists /// because higher-ranked lifetimes aren't supported in all places. See [1][2]. /// -/// Unlike TyParam-s, bound regions are not supposed to exist "in the wild" +/// Unlike Param-s, bound regions are not supposed to exist "in the wild" /// outside their binder, e.g. in types passed to type inference, and /// should first be substituted (by skolemized regions, free regions, /// or region variables). @@ -1514,14 +1514,14 @@ impl<'a, 'gcx, 'tcx> TyS<'tcx> { pub fn is_param(&self, index: u32) -> bool { match self.sty { - ty::TyParam(ref data) => data.idx == index, + ty::Param(ref data) => data.idx == index, _ => false, } } pub fn is_self(&self) -> bool { match self.sty { - TyParam(ref p) => p.is_self(), + Param(ref p) => p.is_self(), _ => false, } } @@ -1714,7 +1714,7 @@ impl<'a, 'gcx, 'tcx> TyS<'tcx> { pub fn has_concrete_skeleton(&self) -> bool { match self.sty { - TyParam(_) | Infer(_) | Error => false, + Param(_) | Infer(_) | Error => false, _ => true, } } @@ -1815,8 +1815,8 @@ impl<'a, 'gcx, 'tcx> TyS<'tcx> { RawPtr(_) | Never | Tuple(..) | - TyForeign(..) | - TyParam(_) | + Foreign(..) | + Param(_) | Infer(_) | Error => { vec![] @@ -1867,7 +1867,7 @@ impl<'a, 'gcx, 'tcx> TyS<'tcx> { ty::Never | ty::Error => true, - ty::TyStr | ty::Slice(_) | ty::Dynamic(..) | ty::TyForeign(..) => + ty::TyStr | ty::Slice(_) | ty::Dynamic(..) | ty::Foreign(..) => false, ty::Tuple(tys) => @@ -1876,7 +1876,7 @@ impl<'a, 'gcx, 'tcx> TyS<'tcx> { ty::Adt(def, _substs) => def.sized_constraint(tcx).is_empty(), - ty::Projection(_) | ty::TyParam(_) | ty::Anon(..) => false, + ty::Projection(_) | ty::Param(_) | ty::Anon(..) => false, ty::Infer(ty::TyVar(_)) => false, diff --git a/src/librustc/ty/subst.rs b/src/librustc/ty/subst.rs index f76411da458..0e85c68b8b1 100644 --- a/src/librustc/ty/subst.rs +++ b/src/librustc/ty/subst.rs @@ -449,7 +449,7 @@ impl<'a, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for SubstFolder<'a, 'gcx, 'tcx> { self.ty_stack_depth += 1; let t1 = match t.sty { - ty::TyParam(p) => { + ty::Param(p) => { self.ty_for_param(p, t) } _ => { diff --git a/src/librustc/ty/util.rs b/src/librustc/ty/util.rs index d1f91b423ac..6b0734cc992 100644 --- a/src/librustc/ty/util.rs +++ b/src/librustc/ty/util.rs @@ -503,7 +503,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { !impl_generics.region_param(ebr, self).pure_wrt_drop } UnpackedKind::Type(&ty::TyS { - sty: ty::TyKind::TyParam(ref pt), .. + sty: ty::TyKind::Param(ref pt), .. }) => { !impl_generics.type_param(pt, self).pure_wrt_drop } @@ -930,7 +930,7 @@ fn needs_drop_raw<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, ty::RawPtr(_) | ty::Ref(..) | ty::TyStr => false, // Foreign types can never have destructors - ty::TyForeign(..) => false, + ty::Foreign(..) => false, // `ManuallyDrop` doesn't have a destructor regardless of field types. ty::Adt(def, _) if Some(def.did) == tcx.lang_items().manually_drop() => false, @@ -955,7 +955,7 @@ fn needs_drop_raw<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, // Can refer to a type which may drop. // FIXME(eddyb) check this against a ParamEnv. - ty::Dynamic(..) | ty::Projection(..) | ty::TyParam(_) | + ty::Dynamic(..) | ty::Projection(..) | ty::Param(_) | ty::Anon(..) | ty::Infer(_) | ty::Error => true, // Structural recursion. diff --git a/src/librustc/ty/walk.rs b/src/librustc/ty/walk.rs index eafe4a81f75..b40e0968fd8 100644 --- a/src/librustc/ty/walk.rs +++ b/src/librustc/ty/walk.rs @@ -82,8 +82,8 @@ pub fn walk_shallow<'tcx>(ty: Ty<'tcx>) -> AccIntoIter<TypeWalkerArray<'tcx>> { fn push_subtypes<'tcx>(stack: &mut TypeWalkerStack<'tcx>, parent_ty: Ty<'tcx>) { match parent_ty.sty { ty::TyBool | ty::TyChar | ty::TyInt(_) | ty::TyUint(_) | ty::TyFloat(_) | - ty::TyStr | ty::Infer(_) | ty::TyParam(_) | ty::Never | ty::Error | - ty::TyForeign(..) => { + ty::TyStr | ty::Infer(_) | ty::Param(_) | ty::Never | ty::Error | + ty::Foreign(..) => { } ty::Array(ty, len) => { push_const(stack, len); diff --git a/src/librustc/ty/wf.rs b/src/librustc/ty/wf.rs index 0ebde35b134..56eaaa942f5 100644 --- a/src/librustc/ty/wf.rs +++ b/src/librustc/ty/wf.rs @@ -257,8 +257,8 @@ impl<'a, 'gcx, 'tcx> WfPredicates<'a, 'gcx, 'tcx> { ty::TyStr | ty::GeneratorWitness(..) | ty::Never | - ty::TyParam(_) | - ty::TyForeign(..) => { + ty::Param(_) | + ty::Foreign(..) => { // WfScalar, WfParameter, etc } diff --git a/src/librustc/util/ppaux.rs b/src/librustc/util/ppaux.rs index c096e1430a3..18901fcb4f2 100644 --- a/src/librustc/util/ppaux.rs +++ b/src/librustc/util/ppaux.rs @@ -16,8 +16,8 @@ use ty::subst::{self, Subst}; use ty::{BrAnon, BrEnv, BrFresh, BrNamed}; use ty::{TyBool, TyChar, Adt}; use ty::{Error, TyStr, Array, Slice, TyFloat, FnDef, FnPtr}; -use ty::{TyParam, RawPtr, Ref, Never, Tuple}; -use ty::{Closure, Generator, GeneratorWitness, TyForeign, Projection, Anon}; +use ty::{Param, RawPtr, Ref, Never, Tuple}; +use ty::{Closure, Generator, GeneratorWitness, Foreign, Projection, Anon}; use ty::{Dynamic, TyInt, TyUint, Infer}; use ty::{self, RegionVid, Ty, TyCtxt, TypeFoldable, GenericParamCount, GenericParamDefKind}; use util::nodemap::FxHashSet; @@ -1086,7 +1086,7 @@ define_print! { } Infer(infer_ty) => write!(f, "{}", infer_ty), Error => write!(f, "[type error]"), - TyParam(ref param_ty) => write!(f, "{}", param_ty), + Param(ref param_ty) => write!(f, "{}", param_ty), Adt(def, substs) => cx.parameterized(f, substs, def.did, &[]), Dynamic(data, r) => { let r = r.print_to_string(cx); @@ -1101,7 +1101,7 @@ define_print! { Ok(()) } } - TyForeign(def_id) => parameterized(f, subst::Substs::empty(), def_id, &[]), + Foreign(def_id) => parameterized(f, subst::Substs::empty(), def_id, &[]), Projection(ref data) => data.print(f, cx), Anon(def_id, substs) => { if cx.is_verbose { |
