about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorvarkor <github@varkor.com>2018-08-22 01:35:29 +0100
committervarkor <github@varkor.com>2018-08-22 16:07:55 +0100
commit04fa5d3adbb8212f5b4e87e3bbd7b74bb7c9ec65 (patch)
treeba27d455ed89ba5d5a70a8265cc062fc2c52aae7 /src
parent6f637da50c56a22f745fd056691da8c86824cd9b (diff)
downloadrust-04fa5d3adbb8212f5b4e87e3bbd7b74bb7c9ec65.tar.gz
rust-04fa5d3adbb8212f5b4e87e3bbd7b74bb7c9ec65.zip
Remove Ty prefix from Ty{Foreign|Param}
Diffstat (limited to 'src')
-rw-r--r--src/librustc/hir/def.rs12
-rw-r--r--src/librustc/hir/lowering.rs6
-rw-r--r--src/librustc/hir/map/mod.rs4
-rw-r--r--src/librustc/ich/impls_hir.rs4
-rw-r--r--src/librustc/ich/impls_ty.rs4
-rw-r--r--src/librustc/infer/canonical/canonicalizer.rs4
-rw-r--r--src/librustc/infer/error_reporting/mod.rs2
-rw-r--r--src/librustc/infer/freshen.rs4
-rw-r--r--src/librustc/infer/outlives/obligations.rs2
-rw-r--r--src/librustc/middle/resolve_lifetime.rs2
-rw-r--r--src/librustc/traits/auto_trait.rs2
-rw-r--r--src/librustc/traits/coherence.rs6
-rw-r--r--src/librustc/traits/error_reporting.rs8
-rw-r--r--src/librustc/traits/object_safety.rs2
-rw-r--r--src/librustc/traits/query/dropck_outlives.rs4
-rw-r--r--src/librustc/traits/select.rs18
-rw-r--r--src/librustc/traits/specialize/mod.rs2
-rw-r--r--src/librustc/ty/context.rs6
-rw-r--r--src/librustc/ty/error.rs4
-rw-r--r--src/librustc/ty/fast_reject.rs4
-rw-r--r--src/librustc/ty/flags.rs4
-rw-r--r--src/librustc/ty/item_path.rs6
-rw-r--r--src/librustc/ty/layout.rs12
-rw-r--r--src/librustc/ty/mod.rs4
-rw-r--r--src/librustc/ty/outlives.rs4
-rw-r--r--src/librustc/ty/relate.rs4
-rw-r--r--src/librustc/ty/structural_impls.rs4
-rw-r--r--src/librustc/ty/sty.rs22
-rw-r--r--src/librustc/ty/subst.rs2
-rw-r--r--src/librustc/ty/util.rs6
-rw-r--r--src/librustc/ty/walk.rs4
-rw-r--r--src/librustc/ty/wf.rs4
-rw-r--r--src/librustc/util/ppaux.rs8
-rw-r--r--src/librustc_codegen_llvm/context.rs2
-rw-r--r--src/librustc_codegen_llvm/debuginfo/metadata.rs2
-rw-r--r--src/librustc_codegen_llvm/debuginfo/type_names.rs4
-rw-r--r--src/librustc_codegen_llvm/mir/place.rs2
-rw-r--r--src/librustc_codegen_llvm/type_of.rs2
-rw-r--r--src/librustc_lint/builtin.rs2
-rw-r--r--src/librustc_lint/types.rs4
-rw-r--r--src/librustc_metadata/decoder.rs2
-rw-r--r--src/librustc_mir/monomorphize/collector.rs2
-rw-r--r--src/librustc_mir/monomorphize/item.rs4
-rw-r--r--src/librustc_privacy/lib.rs8
-rw-r--r--src/librustc_resolve/build_reduced_graph.rs4
-rw-r--r--src/librustc_resolve/lib.rs12
-rw-r--r--src/librustc_save_analysis/lib.rs4
-rw-r--r--src/librustc_traits/dropck_outlives.rs6
-rw-r--r--src/librustc_typeck/astconv.rs8
-rw-r--r--src/librustc_typeck/check/cast.rs4
-rw-r--r--src/librustc_typeck/check/compare_method.rs2
-rw-r--r--src/librustc_typeck/check/method/probe.rs6
-rw-r--r--src/librustc_typeck/check/method/suggest.rs4
-rw-r--r--src/librustc_typeck/check/mod.rs4
-rw-r--r--src/librustc_typeck/check/op.rs4
-rw-r--r--src/librustc_typeck/check/wfcheck.rs4
-rw-r--r--src/librustc_typeck/check/writeback.rs2
-rw-r--r--src/librustc_typeck/coherence/inherent_impls.rs2
-rw-r--r--src/librustc_typeck/coherence/orphan.rs2
-rw-r--r--src/librustc_typeck/collect.rs2
-rw-r--r--src/librustc_typeck/constrained_type_params.rs2
-rw-r--r--src/librustc_typeck/variance/constraints.rs4
-rw-r--r--src/librustdoc/clean/inline.rs2
-rw-r--r--src/librustdoc/clean/mod.rs14
-rw-r--r--src/librustdoc/core.rs2
-rw-r--r--src/librustdoc/visit_ast.rs2
-rw-r--r--src/test/run-pass/auxiliary/issue13507.rs2
-rw-r--r--src/test/ui/privacy/private-inferred-type-1.rs4
68 files changed, 160 insertions, 160 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 {
diff --git a/src/librustc_codegen_llvm/context.rs b/src/librustc_codegen_llvm/context.rs
index 500e659a76d..2ee4bec5ac2 100644
--- a/src/librustc_codegen_llvm/context.rs
+++ b/src/librustc_codegen_llvm/context.rs
@@ -434,7 +434,7 @@ impl<'b, 'tcx> CodegenCx<'b, 'tcx> {
 
         let tail = self.tcx.struct_tail(ty);
         match tail.sty {
-            ty::TyForeign(..) => false,
+            ty::Foreign(..) => false,
             ty::TyStr | ty::Slice(..) | ty::Dynamic(..) => true,
             _ => bug!("unexpected unsized tail: {:?}", tail.sty),
         }
diff --git a/src/librustc_codegen_llvm/debuginfo/metadata.rs b/src/librustc_codegen_llvm/debuginfo/metadata.rs
index 45bb951d9c1..670b7e1fdab 100644
--- a/src/librustc_codegen_llvm/debuginfo/metadata.rs
+++ b/src/librustc_codegen_llvm/debuginfo/metadata.rs
@@ -585,7 +585,7 @@ pub fn type_metadata(
                         trait_pointer_metadata(cx, t, None, unique_type_id),
             false)
         }
-        ty::TyForeign(..) => {
+        ty::Foreign(..) => {
             MetadataCreationResult::new(
                         foreign_type_metadata(cx, t, unique_type_id),
             false)
diff --git a/src/librustc_codegen_llvm/debuginfo/type_names.rs b/src/librustc_codegen_llvm/debuginfo/type_names.rs
index e0ad72681ae..0b138d48119 100644
--- a/src/librustc_codegen_llvm/debuginfo/type_names.rs
+++ b/src/librustc_codegen_llvm/debuginfo/type_names.rs
@@ -48,7 +48,7 @@ pub fn push_debuginfo_type_name<'a, 'tcx>(cx: &CodegenCx<'a, 'tcx>,
         ty::TyInt(int_ty) => output.push_str(int_ty.ty_to_string()),
         ty::TyUint(uint_ty) => output.push_str(uint_ty.ty_to_string()),
         ty::TyFloat(float_ty) => output.push_str(float_ty.ty_to_string()),
-        ty::TyForeign(def_id) => push_item_name(cx, def_id, qualified, output),
+        ty::Foreign(def_id) => push_item_name(cx, def_id, qualified, output),
         ty::Adt(def, substs) => {
             push_item_name(cx, def.did, qualified, output);
             push_type_params(cx, substs, output);
@@ -176,7 +176,7 @@ pub fn push_debuginfo_type_name<'a, 'tcx>(cx: &CodegenCx<'a, 'tcx>,
         ty::Projection(..) |
         ty::Anon(..) |
         ty::GeneratorWitness(..) |
-        ty::TyParam(_) => {
+        ty::Param(_) => {
             bug!("debuginfo: Trying to create type name for \
                 unexpected type: {:?}", t);
         }
diff --git a/src/librustc_codegen_llvm/mir/place.rs b/src/librustc_codegen_llvm/mir/place.rs
index ace907055a3..f280589b7a0 100644
--- a/src/librustc_codegen_llvm/mir/place.rs
+++ b/src/librustc_codegen_llvm/mir/place.rs
@@ -211,7 +211,7 @@ impl PlaceRef<'ll, 'tcx> {
                 return simple();
             }
             _ if !field.is_unsized() => return simple(),
-            ty::Slice(..) | ty::TyStr | ty::TyForeign(..) => return simple(),
+            ty::Slice(..) | ty::TyStr | ty::Foreign(..) => return simple(),
             ty::Adt(def, _) => {
                 if def.repr.packed() {
                     // FIXME(eddyb) generalize the adjustment when we
diff --git a/src/librustc_codegen_llvm/type_of.rs b/src/librustc_codegen_llvm/type_of.rs
index a970d41c15b..0864b127fae 100644
--- a/src/librustc_codegen_llvm/type_of.rs
+++ b/src/librustc_codegen_llvm/type_of.rs
@@ -62,7 +62,7 @@ fn uncached_llvm_type<'a, 'tcx>(cx: &CodegenCx<'a, 'tcx>,
         // FIXME(eddyb) producing readable type names for trait objects can result
         // in problematically distinct types due to HRTB and subtyping (see #47638).
         // ty::Dynamic(..) |
-        ty::TyForeign(..) |
+        ty::Foreign(..) |
         ty::TyStr => {
             let mut name = String::with_capacity(32);
             let printer = DefPathBasedNames::new(cx.tcx, true, true);
diff --git a/src/librustc_lint/builtin.rs b/src/librustc_lint/builtin.rs
index c26d8555214..d4bb5769c75 100644
--- a/src/librustc_lint/builtin.rs
+++ b/src/librustc_lint/builtin.rs
@@ -1510,7 +1510,7 @@ impl TypeAliasBounds {
                 match ty.node {
                     hir::TyKind::Path(hir::QPath::Resolved(None, ref path)) => {
                         match path.def {
-                            Def::TyParam(_) => true,
+                            Def::Param(_) => true,
                             _ => false
                         }
                     }
diff --git a/src/librustc_lint/types.rs b/src/librustc_lint/types.rs
index 767d7430ee8..ac7894543be 100644
--- a/src/librustc_lint/types.rs
+++ b/src/librustc_lint/types.rs
@@ -712,9 +712,9 @@ impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> {
                 FfiSafe
             }
 
-            ty::TyForeign(..) => FfiSafe,
+            ty::Foreign(..) => FfiSafe,
 
-            ty::TyParam(..) |
+            ty::Param(..) |
             ty::Infer(..) |
             ty::Error |
             ty::Closure(..) |
diff --git a/src/librustc_metadata/decoder.rs b/src/librustc_metadata/decoder.rs
index f4dd8861e2a..292355b6656 100644
--- a/src/librustc_metadata/decoder.rs
+++ b/src/librustc_metadata/decoder.rs
@@ -429,7 +429,7 @@ impl<'tcx> EntryKind<'tcx> {
             EntryKind::Trait(_) => Def::Trait(did),
             EntryKind::Enum(..) => Def::Enum(did),
             EntryKind::MacroDef(_) => Def::Macro(did, MacroKind::Bang),
-            EntryKind::ForeignType => Def::TyForeign(did),
+            EntryKind::ForeignType => Def::Foreign(did),
 
             EntryKind::ForeignMod |
             EntryKind::GlobalAsm |
diff --git a/src/librustc_mir/monomorphize/collector.rs b/src/librustc_mir/monomorphize/collector.rs
index 8cf2868d12a..592a833a347 100644
--- a/src/librustc_mir/monomorphize/collector.rs
+++ b/src/librustc_mir/monomorphize/collector.rs
@@ -838,7 +838,7 @@ fn find_vtable_types_for_unsizing<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
             }
             let tail = tcx.struct_tail(ty);
             match tail.sty {
-                ty::TyForeign(..) => false,
+                ty::Foreign(..) => false,
                 ty::TyStr | ty::Slice(..) | ty::Dynamic(..) => true,
                 _ => bug!("unexpected unsized tail: {:?}", tail.sty),
             }
diff --git a/src/librustc_mir/monomorphize/item.rs b/src/librustc_mir/monomorphize/item.rs
index da19f03304b..c743efc26f6 100644
--- a/src/librustc_mir/monomorphize/item.rs
+++ b/src/librustc_mir/monomorphize/item.rs
@@ -327,7 +327,7 @@ impl<'a, 'tcx> DefPathBasedNames<'a, 'tcx> {
                         output);
                 }
             },
-            ty::TyForeign(did) => self.push_def_path(did, output),
+            ty::Foreign(did) => self.push_def_path(did, output),
             ty::FnDef(..) |
             ty::FnPtr(_) => {
                 let sig = t.fn_sig(self.tcx);
@@ -383,7 +383,7 @@ impl<'a, 'tcx> DefPathBasedNames<'a, 'tcx> {
             ty::Error |
             ty::Infer(_) |
             ty::Projection(..) |
-            ty::TyParam(_) |
+            ty::Param(_) |
             ty::GeneratorWitness(_) |
             ty::Anon(..) => {
                 bug!("DefPathBasedNames: Trying to create type name for \
diff --git a/src/librustc_privacy/lib.rs b/src/librustc_privacy/lib.rs
index 3c2869af54f..dd536d673cf 100644
--- a/src/librustc_privacy/lib.rs
+++ b/src/librustc_privacy/lib.rs
@@ -90,7 +90,7 @@ impl<'a, 'tcx> EmbargoVisitor<'a, 'tcx> {
     fn item_ty_level(&self, item_def_id: DefId) -> Option<AccessLevel> {
         let ty_def_id = match self.tcx.type_of(item_def_id).sty {
             ty::Adt(adt, _) => adt.did,
-            ty::TyForeign(did) => did,
+            ty::Foreign(did) => did,
             ty::Dynamic(ref obj, ..) if obj.principal().is_some() =>
                 obj.principal().unwrap().def_id(),
             ty::Projection(ref proj) => proj.trait_ref(self.tcx).def_id,
@@ -471,7 +471,7 @@ impl<'b, 'a, 'tcx> TypeVisitor<'tcx> for ReachEverythingInTheInterfaceVisitor<'b
     fn visit_ty(&mut self, ty: Ty<'tcx>) -> bool {
         let ty_def_id = match ty.sty {
             ty::Adt(adt, _) => Some(adt.did),
-            ty::TyForeign(did) => Some(did),
+            ty::Foreign(did) => Some(did),
             ty::Dynamic(ref obj, ..) => obj.principal().map(|p| p.def_id()),
             ty::Projection(ref proj) => Some(proj.item_def_id),
             ty::FnDef(def_id, ..) |
@@ -898,7 +898,7 @@ impl<'a, 'tcx> TypeVisitor<'tcx> for TypePrivacyVisitor<'a, 'tcx> {
         match ty.sty {
             ty::Adt(&ty::AdtDef { did: def_id, .. }, ..) |
             ty::FnDef(def_id, ..) |
-            ty::TyForeign(def_id) => {
+            ty::Foreign(def_id) => {
                 if !self.item_is_accessible(def_id) {
                     let msg = format!("type `{}` is private", ty);
                     self.tcx.sess.span_err(self.span, &msg);
@@ -1435,7 +1435,7 @@ impl<'a, 'tcx: 'a> TypeVisitor<'tcx> for SearchInterfaceForPrivateItemsVisitor<'
     fn visit_ty(&mut self, ty: Ty<'tcx>) -> bool {
         let ty_def_id = match ty.sty {
             ty::Adt(adt, _) => Some(adt.did),
-            ty::TyForeign(did) => Some(did),
+            ty::Foreign(did) => Some(did),
             ty::Dynamic(ref obj, ..) => obj.principal().map(|p| p.def_id()),
             ty::Projection(ref proj) => {
                 if self.required_visibility == ty::Visibility::Invisible {
diff --git a/src/librustc_resolve/build_reduced_graph.rs b/src/librustc_resolve/build_reduced_graph.rs
index 19dc35f854e..0c55ae65ec7 100644
--- a/src/librustc_resolve/build_reduced_graph.rs
+++ b/src/librustc_resolve/build_reduced_graph.rs
@@ -656,7 +656,7 @@ impl<'a, 'cl> Resolver<'a, 'cl> {
                 (Def::Static(self.definitions.local_def_id(item.id), m), ValueNS)
             }
             ForeignItemKind::Ty => {
-                (Def::TyForeign(self.definitions.local_def_id(item.id)), TypeNS)
+                (Def::Foreign(self.definitions.local_def_id(item.id)), TypeNS)
             }
             ForeignItemKind::Macro(_) => unreachable!(),
         };
@@ -692,7 +692,7 @@ impl<'a, 'cl> Resolver<'a, 'cl> {
                                              span);
                 self.define(parent, ident, TypeNS, (module, vis, DUMMY_SP, expansion));
             }
-            Def::Variant(..) | Def::TyAlias(..) | Def::TyForeign(..) => {
+            Def::Variant(..) | Def::TyAlias(..) | Def::Foreign(..) => {
                 self.define(parent, ident, TypeNS, (def, vis, DUMMY_SP, expansion));
             }
             Def::Fn(..) | Def::Static(..) | Def::Const(..) | Def::VariantCtor(..) => {
diff --git a/src/librustc_resolve/lib.rs b/src/librustc_resolve/lib.rs
index 004a9a77dd9..b731cc21f2b 100644
--- a/src/librustc_resolve/lib.rs
+++ b/src/librustc_resolve/lib.rs
@@ -204,14 +204,14 @@ fn resolve_struct_error<'sess, 'a>(resolver: &'sess Resolver,
                                     "`Self` type implicitly declared here, on the `impl`");
                     }
                 },
-                Def::TyParam(typaram_defid) => {
+                Def::Param(typaram_defid) => {
                     if let Some(typaram_span) = resolver.definitions.opt_span(typaram_defid) {
                         err.span_label(typaram_span, "type variable from outer function");
                     }
                 },
                 _ => {
                     bug!("TypeParametersFromOuterFunction should only be used with Def::SelfTy or \
-                         Def::TyParam")
+                         Def::Param")
                 }
             }
 
@@ -537,9 +537,9 @@ impl<'a> PathSource<'a> {
             PathSource::Type => match def {
                 Def::Struct(..) | Def::Union(..) | Def::Enum(..) |
                 Def::Trait(..) | Def::TyAlias(..) | Def::AssociatedTy(..) |
-                Def::PrimTy(..) | Def::TyParam(..) | Def::SelfTy(..) |
+                Def::PrimTy(..) | Def::Param(..) | Def::SelfTy(..) |
                 Def::Existential(..) |
-                Def::TyForeign(..) => true,
+                Def::Foreign(..) => true,
                 _ => false,
             },
             PathSource::Trait(AliasPossibility::No) => match def {
@@ -2359,7 +2359,7 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> {
                             seen_bindings.entry(ident).or_insert(param.ident.span);
 
                         // Plain insert (no renaming).
-                        let def = Def::TyParam(self.definitions.local_def_id(param.id));
+                        let def = Def::Param(self.definitions.local_def_id(param.id));
                             function_type_rib.bindings.insert(ident, def);
                             self.record_def(param.id, PathResolution::new(def));
                         }
@@ -3765,7 +3765,7 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> {
                     }
                 }
             }
-            Def::TyParam(..) | Def::SelfTy(..) => {
+            Def::Param(..) | Def::SelfTy(..) => {
                 for rib in ribs {
                     match rib.kind {
                         NormalRibKind | TraitOrImplItemRibKind | ClosureRibKind(..) |
diff --git a/src/librustc_save_analysis/lib.rs b/src/librustc_save_analysis/lib.rs
index 298f9549666..2d9768db113 100644
--- a/src/librustc_save_analysis/lib.rs
+++ b/src/librustc_save_analysis/lib.rs
@@ -747,13 +747,13 @@ impl<'l, 'tcx: 'l> SaveContext<'l, 'tcx> {
             HirDef::Union(def_id) |
             HirDef::Enum(def_id) |
             HirDef::TyAlias(def_id) |
-            HirDef::TyForeign(def_id) |
+            HirDef::Foreign(def_id) |
             HirDef::TraitAlias(def_id) |
             HirDef::AssociatedExistential(def_id) |
             HirDef::AssociatedTy(def_id) |
             HirDef::Trait(def_id) |
             HirDef::Existential(def_id) |
-            HirDef::TyParam(def_id) => {
+            HirDef::Param(def_id) => {
                 let span = self.span_from_span(sub_span);
                 Some(Ref {
                     kind: RefKind::Type,
diff --git a/src/librustc_traits/dropck_outlives.rs b/src/librustc_traits/dropck_outlives.rs
index 005d56a1508..8e7d3d2c175 100644
--- a/src/librustc_traits/dropck_outlives.rs
+++ b/src/librustc_traits/dropck_outlives.rs
@@ -119,7 +119,7 @@ fn dropck_outlives<'tcx>(
                         match ty.sty {
                             // All parameters live for the duration of the
                             // function.
-                            ty::TyParam(..) => {}
+                            ty::Param(..) => {}
 
                             // A projection that we couldn't resolve - it
                             // might have a destructor.
@@ -180,7 +180,7 @@ fn dtorck_constraint_for_ty<'a, 'gcx, 'tcx>(
         | ty::TyFloat(_)
         | ty::TyStr
         | ty::Never
-        | ty::TyForeign(..)
+        | ty::Foreign(..)
         | ty::RawPtr(..)
         | ty::Ref(..)
         | ty::FnDef(..)
@@ -266,7 +266,7 @@ fn dtorck_constraint_for_ty<'a, 'gcx, 'tcx>(
         }),
 
         // Types that can't be resolved. Pass them forward.
-        ty::Projection(..) | ty::Anon(..) | ty::TyParam(..) => Ok(DtorckConstraint {
+        ty::Projection(..) | ty::Anon(..) | ty::Param(..) => Ok(DtorckConstraint {
             outlives: vec![],
             dtorck_types: vec![ty],
             overflows: vec![],
diff --git a/src/librustc_typeck/astconv.rs b/src/librustc_typeck/astconv.rs
index 42218fc5150..00434fff238 100644
--- a/src/librustc_typeck/astconv.rs
+++ b/src/librustc_typeck/astconv.rs
@@ -1239,8 +1239,8 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx>+'o {
                     Err(ErrorReported) => return (tcx.types.err, Def::Err),
                 }
             }
-            (&ty::TyParam(_), Def::SelfTy(Some(param_did), None)) |
-            (&ty::TyParam(_), Def::TyParam(param_did)) => {
+            (&ty::Param(_), Def::SelfTy(Some(param_did), None)) |
+            (&ty::Param(_), Def::Param(param_did)) => {
                 match self.find_bound_for_assoc_item(param_did, assoc_name, span) {
                     Ok(bound) => bound,
                     Err(ErrorReported) => return (tcx.types.err, Def::Err),
@@ -1387,7 +1387,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx>+'o {
                 )
             }
             Def::Enum(did) | Def::TyAlias(did) | Def::Struct(did) |
-            Def::Union(did) | Def::TyForeign(did) => {
+            Def::Union(did) | Def::Foreign(did) => {
                 assert_eq!(opt_self_ty, None);
                 self.prohibit_generics(path.segments.split_last().unwrap().1);
                 self.ast_path_to_ty(span, did, path.segments.last().unwrap())
@@ -1401,7 +1401,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx>+'o {
                                     tcx.parent_def_id(did).unwrap(),
                                     path.segments.last().unwrap())
             }
-            Def::TyParam(did) => {
+            Def::Param(did) => {
                 assert_eq!(opt_self_ty, None);
                 self.prohibit_generics(&path.segments);
 
diff --git a/src/librustc_typeck/check/cast.rs b/src/librustc_typeck/check/cast.rs
index cf0026a7a9c..3bf54ff822f 100644
--- a/src/librustc_typeck/check/cast.rs
+++ b/src/librustc_typeck/check/cast.rs
@@ -121,11 +121,11 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
             },
 
             // Pointers to foreign types are thin, despite being unsized
-            ty::TyForeign(..) => Some(PointerKind::Thin),
+            ty::Foreign(..) => Some(PointerKind::Thin),
             // We should really try to normalize here.
             ty::Projection(ref pi) => Some(PointerKind::OfProjection(pi)),
             ty::Anon(def_id, substs) => Some(PointerKind::OfAnon(def_id, substs)),
-            ty::TyParam(ref p) => Some(PointerKind::OfParam(p)),
+            ty::Param(ref p) => Some(PointerKind::OfParam(p)),
             // Insufficient type information.
             ty::Infer(_) => None,
 
diff --git a/src/librustc_typeck/check/compare_method.rs b/src/librustc_typeck/check/compare_method.rs
index 9aa2ba363ed..3f32e26c1b4 100644
--- a/src/librustc_typeck/check/compare_method.rs
+++ b/src/librustc_typeck/check/compare_method.rs
@@ -830,7 +830,7 @@ fn compare_synthetic_generics<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
                                 hir::intravisit::walk_ty(self, ty);
                                 match ty.node {
                                     hir::TyKind::Path(hir::QPath::Resolved(None, ref path)) => {
-                                        if let hir::def::Def::TyParam(def_id) = path.def {
+                                        if let hir::def::Def::Param(def_id) = path.def {
                                             if def_id == self.1 {
                                                 self.0 = Some(ty.span);
                                             }
diff --git a/src/librustc_typeck/check/method/probe.rs b/src/librustc_typeck/check/method/probe.rs
index 46ccbb01c38..120d4236544 100644
--- a/src/librustc_typeck/check/method/probe.rs
+++ b/src/librustc_typeck/check/method/probe.rs
@@ -459,10 +459,10 @@ impl<'a, 'gcx, 'tcx> ProbeContext<'a, 'gcx, 'tcx> {
             ty::Adt(def, _) => {
                 self.assemble_inherent_impl_candidates_for_type(def.did);
             }
-            ty::TyForeign(did) => {
+            ty::Foreign(did) => {
                 self.assemble_inherent_impl_candidates_for_type(did);
             }
-            ty::TyParam(p) => {
+            ty::Param(p) => {
                 self.assemble_inherent_candidates_from_param(self_ty, p);
             }
             ty::TyChar => {
@@ -652,7 +652,7 @@ impl<'a, 'gcx, 'tcx> ProbeContext<'a, 'gcx, 'tcx> {
                 match *predicate {
                     ty::Predicate::Trait(ref trait_predicate) => {
                         match trait_predicate.skip_binder().trait_ref.self_ty().sty {
-                            ty::TyParam(ref p) if *p == param_ty => {
+                            ty::Param(ref p) if *p == param_ty => {
                                 Some(trait_predicate.to_poly_trait_ref())
                             }
                             _ => None,
diff --git a/src/librustc_typeck/check/method/suggest.rs b/src/librustc_typeck/check/method/suggest.rs
index 15aae83c5b9..0bef176b499 100644
--- a/src/librustc_typeck/check/method/suggest.rs
+++ b/src/librustc_typeck/check/method/suggest.rs
@@ -639,12 +639,12 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
         fn is_local(ty: Ty) -> bool {
             match ty.sty {
                 ty::Adt(def, _) => def.did.is_local(),
-                ty::TyForeign(did) => did.is_local(),
+                ty::Foreign(did) => did.is_local(),
 
                 ty::Dynamic(ref tr, ..) => tr.principal()
                     .map_or(false, |p| p.def_id().is_local()),
 
-                ty::TyParam(_) => true,
+                ty::Param(_) => true,
 
                 // everything else (primitive types etc.) is effectively
                 // non-local (there are "edge" cases, e.g. (LocalType,), but
diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs
index 1230ccf4400..231bf8f1cbc 100644
--- a/src/librustc_typeck/check/mod.rs
+++ b/src/librustc_typeck/check/mod.rs
@@ -1647,7 +1647,7 @@ pub fn check_simd<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, sp: Span, def_id: DefId
                 return;
             }
             match e.sty {
-                ty::TyParam(_) => { /* struct<T>(T, T, T, T) is ok */ }
+                ty::Param(_) => { /* struct<T>(T, T, T, T) is ok */ }
                 _ if e.is_machine()  => { /* struct(u8, u8, u8, u8) is ok */ }
                 _ => {
                     span_err!(tcx.sess, sp, E0077,
@@ -5155,7 +5155,7 @@ pub fn check_bounds_are_used<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
     let mut types_used = vec![false; own_counts.types];
 
     for leaf_ty in ty.walk() {
-        if let ty::TyParam(ty::ParamTy { idx, .. }) = leaf_ty.sty {
+        if let ty::Param(ty::ParamTy { idx, .. }) = leaf_ty.sty {
             debug!("Found use of ty param num {}", idx);
             types_used[idx as usize - own_counts.lifetimes] = true;
         } else if let ty::Error = leaf_ty.sty {
diff --git a/src/librustc_typeck/check/op.rs b/src/librustc_typeck/check/op.rs
index dd8c8a8102a..69ef8913734 100644
--- a/src/librustc_typeck/check/op.rs
+++ b/src/librustc_typeck/check/op.rs
@@ -311,7 +311,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
                                     // This has nothing here because it means we did string
                                     // concatenation (e.g. "Hello " += "World!"). This means
                                     // we don't want the note in the else clause to be emitted
-                                } else if let ty::TyParam(_) = lhs_ty.sty {
+                                } else if let ty::Param(_) = lhs_ty.sty {
                                     // FIXME: point to span of param
                                     err.note(&format!(
                                         "`{}` might need a bound for `{}`",
@@ -385,7 +385,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
                                     // This has nothing here because it means we did string
                                     // concatenation (e.g. "Hello " + "World!"). This means
                                     // we don't want the note in the else clause to be emitted
-                                } else if let ty::TyParam(_) = lhs_ty.sty {
+                                } else if let ty::Param(_) = lhs_ty.sty {
                                     // FIXME: point to span of param
                                     err.note(&format!(
                                         "`{}` might need a bound for `{}`",
diff --git a/src/librustc_typeck/check/wfcheck.rs b/src/librustc_typeck/check/wfcheck.rs
index 54b295601ea..99e0e8775b0 100644
--- a/src/librustc_typeck/check/wfcheck.rs
+++ b/src/librustc_typeck/check/wfcheck.rs
@@ -454,7 +454,7 @@ fn check_where_clauses<'a, 'gcx, 'fcx, 'tcx>(
         impl<'tcx> ty::fold::TypeVisitor<'tcx> for CountParams {
             fn visit_ty(&mut self, t: Ty<'tcx>) -> bool {
                 match t.sty {
-                    ty::TyParam(p) => {
+                    ty::Param(p) => {
                         self.params.insert(p.idx);
                         t.super_visit_with(self)
                     }
@@ -588,7 +588,7 @@ fn check_existential_types<'a, 'fcx, 'gcx, 'tcx>(
                         for (subst, param) in substs.iter().zip(&generics.params) {
                             match subst.unpack() {
                                 ty::subst::UnpackedKind::Type(ty) => match ty.sty {
-                                    ty::TyParam(..) => {},
+                                    ty::Param(..) => {},
                                     // prevent `fn foo() -> Foo<u32>` from being defining
                                     _ => {
                                         tcx
diff --git a/src/librustc_typeck/check/writeback.rs b/src/librustc_typeck/check/writeback.rs
index 2550d414bc0..1e147b6c263 100644
--- a/src/librustc_typeck/check/writeback.rs
+++ b/src/librustc_typeck/check/writeback.rs
@@ -417,7 +417,7 @@ impl<'cx, 'gcx, 'tcx> WritebackCx<'cx, 'gcx, 'tcx> {
                     fldop: |ty| {
                         trace!("checking type {:?}: {:#?}", ty, ty.sty);
                         // find a type parameter
-                        if let ty::TyParam(..) = ty.sty {
+                        if let ty::Param(..) = ty.sty {
                             // look it up in the substitution list
                             assert_eq!(anon_defn.substs.len(), generics.params.len());
                             for (subst, param) in anon_defn.substs.iter().zip(&generics.params) {
diff --git a/src/librustc_typeck/coherence/inherent_impls.rs b/src/librustc_typeck/coherence/inherent_impls.rs
index f3433b7c9db..857ade7a423 100644
--- a/src/librustc_typeck/coherence/inherent_impls.rs
+++ b/src/librustc_typeck/coherence/inherent_impls.rs
@@ -105,7 +105,7 @@ impl<'a, 'tcx, 'v> ItemLikeVisitor<'v> for InherentCollect<'a, 'tcx> {
             ty::Adt(def, _) => {
                 self.check_def_id(item, def.did);
             }
-            ty::TyForeign(did) => {
+            ty::Foreign(did) => {
                 self.check_def_id(item, did);
             }
             ty::Dynamic(ref data, ..) if data.principal().is_some() => {
diff --git a/src/librustc_typeck/coherence/orphan.rs b/src/librustc_typeck/coherence/orphan.rs
index 1dad6b722dc..f9b89488232 100644
--- a/src/librustc_typeck/coherence/orphan.rs
+++ b/src/librustc_typeck/coherence/orphan.rs
@@ -115,7 +115,7 @@ impl<'cx, 'tcx, 'v> ItemLikeVisitor<'v> for OrphanChecker<'cx, 'tcx> {
                     let self_ty = trait_ref.self_ty();
                     let opt_self_def_id = match self_ty.sty {
                         ty::Adt(self_def, _) => Some(self_def.did),
-                        ty::TyForeign(did) => Some(did),
+                        ty::Foreign(did) => Some(did),
                         _ => None,
                     };
 
diff --git a/src/librustc_typeck/collect.rs b/src/librustc_typeck/collect.rs
index 956d542ab7d..14328578229 100644
--- a/src/librustc_typeck/collect.rs
+++ b/src/librustc_typeck/collect.rs
@@ -350,7 +350,7 @@ fn is_param<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
     if let hir::TyKind::Path(hir::QPath::Resolved(None, ref path)) = ast_ty.node {
         match path.def {
             Def::SelfTy(Some(def_id), None) |
-            Def::TyParam(def_id) => {
+            Def::Param(def_id) => {
                 def_id == tcx.hir.local_def_id(param_id)
             }
             _ => false
diff --git a/src/librustc_typeck/constrained_type_params.rs b/src/librustc_typeck/constrained_type_params.rs
index 20bbc475e7d..37b0b83ccd0 100644
--- a/src/librustc_typeck/constrained_type_params.rs
+++ b/src/librustc_typeck/constrained_type_params.rs
@@ -66,7 +66,7 @@ impl<'tcx> TypeVisitor<'tcx> for ParameterCollector {
                 // projections are not injective
                 return false;
             }
-            ty::TyParam(data) => {
+            ty::Param(data) => {
                 self.parameters.push(Parameter::from(data));
             }
             _ => {}
diff --git a/src/librustc_typeck/variance/constraints.rs b/src/librustc_typeck/variance/constraints.rs
index 83f94e2de08..3d5b499bdc7 100644
--- a/src/librustc_typeck/variance/constraints.rs
+++ b/src/librustc_typeck/variance/constraints.rs
@@ -262,7 +262,7 @@ impl<'a, 'tcx> ConstraintContext<'a, 'tcx> {
 
         match ty.sty {
             ty::TyBool | ty::TyChar | ty::TyInt(_) | ty::TyUint(_) | ty::TyFloat(_) |
-            ty::TyStr | ty::Never | ty::TyForeign(..) => {
+            ty::TyStr | ty::Never | ty::Foreign(..) => {
                 // leaf type -- noop
             }
 
@@ -323,7 +323,7 @@ impl<'a, 'tcx> ConstraintContext<'a, 'tcx> {
                 }
             }
 
-            ty::TyParam(ref data) => {
+            ty::Param(ref data) => {
                 self.add_constraint(current, data.idx, variance);
             }
 
diff --git a/src/librustdoc/clean/inline.rs b/src/librustdoc/clean/inline.rs
index 1c66c39b660..ec5db1e7f9a 100644
--- a/src/librustdoc/clean/inline.rs
+++ b/src/librustdoc/clean/inline.rs
@@ -83,7 +83,7 @@ pub fn try_inline(cx: &DocContext, def: Def, name: ast::Name, visited: &mut FxHa
             ret.extend(build_impls(cx, did, true));
             clean::EnumItem(build_enum(cx, did))
         }
-        Def::TyForeign(did) => {
+        Def::Foreign(did) => {
             record_extern_fqn(cx, did, clean::TypeKind::Foreign);
             ret.extend(build_impls(cx, did, false));
             clean::ForeignTypeItem
diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs
index 25b83e08011..ab97c4400d3 100644
--- a/src/librustdoc/clean/mod.rs
+++ b/src/librustdoc/clean/mod.rs
@@ -2411,7 +2411,7 @@ impl Clean<Type> for hir::Ty {
                     return new_ty;
                 }
 
-                if let Def::TyParam(did) = path.def {
+                if let Def::Param(did) = path.def {
                     if let Some(bounds) = cx.impl_trait_bounds.borrow_mut().remove(&did) {
                         return ImplTrait(bounds);
                     }
@@ -2460,7 +2460,7 @@ impl Clean<Type> for hir::Ty {
                                 }
                                 hir::GenericParamKind::Type { ref default, .. } => {
                                     let ty_param_def =
-                                        Def::TyParam(cx.tcx.hir.local_def_id(param.id));
+                                        Def::Param(cx.tcx.hir.local_def_id(param.id));
                                     let mut j = 0;
                                     let type_ = generic_args.args.iter().find_map(|arg| {
                                         match arg {
@@ -2602,7 +2602,7 @@ impl<'tcx> Clean<Type> for Ty<'tcx> {
                     is_generic: false,
                 }
             }
-            ty::TyForeign(did) => {
+            ty::Foreign(did) => {
                 inline::record_extern_fqn(cx, did, TypeKind::Foreign);
                 let path = external_path(cx, &cx.tcx.item_name(did).as_str(),
                                          None, false, vec![], Substs::empty());
@@ -2661,7 +2661,7 @@ impl<'tcx> Clean<Type> for Ty<'tcx> {
 
             ty::Projection(ref data) => data.clean(cx),
 
-            ty::TyParam(ref p) => Generic(p.name.to_string()),
+            ty::Param(ref p) => Generic(p.name.to_string()),
 
             ty::Anon(def_id, substs) => {
                 // Grab the "TraitA + TraitB" from `impl TraitA + TraitB`,
@@ -3710,10 +3710,10 @@ fn resolve_type(cx: &DocContext,
         Def::SelfTy(..) if path.segments.len() == 1 => {
             return Generic(keywords::SelfType.name().to_string());
         }
-        Def::TyParam(..) if path.segments.len() == 1 => {
+        Def::Param(..) if path.segments.len() == 1 => {
             return Generic(format!("{:#}", path));
         }
-        Def::SelfTy(..) | Def::TyParam(..) | Def::AssociatedTy(..) => true,
+        Def::SelfTy(..) | Def::Param(..) | Def::AssociatedTy(..) => true,
         _ => false,
     };
     let did = register_def(&*cx, path.def);
@@ -3731,7 +3731,7 @@ pub fn register_def(cx: &DocContext, def: Def) -> DefId {
         Def::Struct(i) => (i, TypeKind::Struct),
         Def::Union(i) => (i, TypeKind::Union),
         Def::Mod(i) => (i, TypeKind::Module),
-        Def::TyForeign(i) => (i, TypeKind::Foreign),
+        Def::Foreign(i) => (i, TypeKind::Foreign),
         Def::Const(i) => (i, TypeKind::Const),
         Def::Static(i, _) => (i, TypeKind::Static),
         Def::Variant(i) => (cx.tcx.parent_def_id(i).expect("cannot get parent def id"),
diff --git a/src/librustdoc/core.rs b/src/librustdoc/core.rs
index a312913a69c..d08031cd219 100644
--- a/src/librustdoc/core.rs
+++ b/src/librustdoc/core.rs
@@ -234,7 +234,7 @@ impl<'a, 'tcx, 'rcx, 'cstore> DocContext<'a, 'tcx, 'rcx, 'cstore> {
                 None,
                 P(hir::Path {
                     span: DUMMY_SP,
-                    def: Def::TyParam(param.def_id),
+                    def: Def::Param(param.def_id),
                     segments: HirVec::from_vec(vec![
                         hir::PathSegment::from_ident(Ident::from_interned_str(param.name))
                     ]),
diff --git a/src/librustdoc/visit_ast.rs b/src/librustdoc/visit_ast.rs
index 68ddf72da06..db32a324521 100644
--- a/src/librustdoc/visit_ast.rs
+++ b/src/librustdoc/visit_ast.rs
@@ -267,7 +267,7 @@ impl<'a, 'tcx, 'rcx, 'cstore> RustdocVisitor<'a, 'tcx, 'rcx, 'cstore> {
                 Def::Struct(did) |
                 Def::Union(did) |
                 Def::Enum(did) |
-                Def::TyForeign(did) |
+                Def::Foreign(did) |
                 Def::TyAlias(did) if !self_is_hidden => {
                     self.cx.access_levels.borrow_mut().map.insert(did, AccessLevel::Public);
                 },
diff --git a/src/test/run-pass/auxiliary/issue13507.rs b/src/test/run-pass/auxiliary/issue13507.rs
index e8f1a0826d6..50ebbacc506 100644
--- a/src/test/run-pass/auxiliary/issue13507.rs
+++ b/src/test/run-pass/auxiliary/issue13507.rs
@@ -89,7 +89,7 @@ pub mod testtypes {
     pub type FooNil = ();
     pub type FooTuple = (u8, i8, bool);
 
-    // Skipping TyParam
+    // Skipping Param
 
     // Skipping Infer
 
diff --git a/src/test/ui/privacy/private-inferred-type-1.rs b/src/test/ui/privacy/private-inferred-type-1.rs
index ba8b3d1810a..e836d5a9844 100644
--- a/src/test/ui/privacy/private-inferred-type-1.rs
+++ b/src/test/ui/privacy/private-inferred-type-1.rs
@@ -11,7 +11,7 @@
 trait Arr0 {
     fn arr0_secret(&self);
 }
-trait TyParam {
+trait Param {
     fn ty_param_secret(&self);
 }
 
@@ -19,7 +19,7 @@ mod m {
     struct Priv;
 
     impl ::Arr0 for [Priv; 0] { fn arr0_secret(&self) {} }
-    impl ::TyParam for Option<Priv> { fn ty_param_secret(&self) {} }
+    impl ::Param for Option<Priv> { fn ty_param_secret(&self) {} }
 }
 
 fn main() {