about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2018-09-08 14:16:37 +0000
committerbors <bors@rust-lang.org>2018-09-08 14:16:37 +0000
commitb24330fb7d9e89d63eb03d81fe577172aad49525 (patch)
tree21d6904410856dedf7e6c3ab033b95014042f54b
parent05cb29e96f718a94d31afd094b1efd7c05be4269 (diff)
parentf4d4faaeedbdb7271221c9b48fd809a5e8469445 (diff)
downloadrust-b24330fb7d9e89d63eb03d81fe577172aad49525.tar.gz
rust-b24330fb7d9e89d63eb03d81fe577172aad49525.zip
Auto merge of #53705 - ms2300:tmp, r=oli-obk
#53576 Renaming TyAnon -> TyOpaque

Fixes #53576
-rw-r--r--src/librustc/ich/impls_ty.rs2
-rw-r--r--src/librustc/infer/canonical/canonicalizer.rs2
-rw-r--r--src/librustc/infer/freshen.rs2
-rw-r--r--src/librustc/infer/mod.rs2
-rw-r--r--src/librustc/infer/opaque_types/mod.rs (renamed from src/librustc/infer/anon_types/mod.rs)171
-rw-r--r--src/librustc/traits/coherence.rs2
-rw-r--r--src/librustc/traits/error_reporting.rs2
-rw-r--r--src/librustc/traits/project.rs6
-rw-r--r--src/librustc/traits/query/dropck_outlives.rs2
-rw-r--r--src/librustc/traits/query/normalize.rs2
-rw-r--r--src/librustc/traits/select.rs10
-rw-r--r--src/librustc/ty/context.rs6
-rw-r--r--src/librustc/ty/error.rs2
-rw-r--r--src/librustc/ty/fast_reject.rs10
-rw-r--r--src/librustc/ty/flags.rs2
-rw-r--r--src/librustc/ty/fold.rs2
-rw-r--r--src/librustc/ty/item_path.rs2
-rw-r--r--src/librustc/ty/layout.rs6
-rw-r--r--src/librustc/ty/mod.rs4
-rw-r--r--src/librustc/ty/outlives.rs2
-rw-r--r--src/librustc/ty/relate.rs4
-rw-r--r--src/librustc/ty/structural_impls.rs4
-rw-r--r--src/librustc/ty/sty.rs10
-rw-r--r--src/librustc/ty/util.rs2
-rw-r--r--src/librustc/ty/walk.rs2
-rw-r--r--src/librustc/ty/wf.rs2
-rw-r--r--src/librustc/util/ppaux.rs6
-rw-r--r--src/librustc_codegen_llvm/debuginfo/type_names.rs2
-rw-r--r--src/librustc_lint/types.rs2
-rw-r--r--src/librustc_mir/borrow_check/nll/type_check/input_output.rs37
-rw-r--r--src/librustc_mir/monomorphize/item.rs2
-rw-r--r--src/librustc_mir/transform/qualify_min_const_fn.rs2
-rw-r--r--src/librustc_privacy/lib.rs14
-rw-r--r--src/librustc_traits/dropck_outlives.rs4
-rw-r--r--src/librustc_typeck/astconv.rs4
-rw-r--r--src/librustc_typeck/check/cast.rs6
-rw-r--r--src/librustc_typeck/check/mod.rs32
-rw-r--r--src/librustc_typeck/check/regionck.rs4
-rw-r--r--src/librustc_typeck/check/wfcheck.rs12
-rw-r--r--src/librustc_typeck/check/writeback.rs26
-rw-r--r--src/librustc_typeck/collect.rs14
-rw-r--r--src/librustc_typeck/constrained_type_params.rs2
-rw-r--r--src/librustc_typeck/variance/constraints.rs2
-rw-r--r--src/librustdoc/clean/mod.rs4
-rw-r--r--src/test/ui/existential_types/generic_type_does_not_live_long_enough.nll.stderr2
-rw-r--r--src/test/ui/existential_types/generic_type_does_not_live_long_enough.stderr2
-rw-r--r--src/test/ui/existential_types/never_reveal_concrete_type.stderr2
-rw-r--r--src/test/ui/existential_types/no_revealing_outside_defining_module.stderr4
-rw-r--r--src/test/ui/impl-trait/equality2.rs2
-rw-r--r--src/test/ui/impl-trait/equality2.stderr2
50 files changed, 228 insertions, 224 deletions
diff --git a/src/librustc/ich/impls_ty.rs b/src/librustc/ich/impls_ty.rs
index e90c4f62f59..e43ef01baad 100644
--- a/src/librustc/ich/impls_ty.rs
+++ b/src/librustc/ich/impls_ty.rs
@@ -878,7 +878,7 @@ for ty::TyKind<'gcx>
             Projection(ref projection_ty) => {
                 projection_ty.hash_stable(hcx, hasher);
             }
-            Anon(def_id, substs) => {
+            Opaque(def_id, substs) => {
                 def_id.hash_stable(hcx, hasher);
                 substs.hash_stable(hcx, hasher);
             }
diff --git a/src/librustc/infer/canonical/canonicalizer.rs b/src/librustc/infer/canonical/canonicalizer.rs
index fbe9165ae97..b30ccb5976c 100644
--- a/src/librustc/infer/canonical/canonicalizer.rs
+++ b/src/librustc/infer/canonical/canonicalizer.rs
@@ -285,7 +285,7 @@ impl<'cx, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for Canonicalizer<'cx, 'gcx, 'tcx>
             | ty::Projection(..)
             | ty::Foreign(..)
             | ty::Param(..)
-            | ty::Anon(..) => {
+            | ty::Opaque(..) => {
                 if t.flags.intersects(self.needs_canonical_flags) {
                     t.super_fold_with(self)
                 } else {
diff --git a/src/librustc/infer/freshen.rs b/src/librustc/infer/freshen.rs
index 4673aac1872..1cb813c39e6 100644
--- a/src/librustc/infer/freshen.rs
+++ b/src/librustc/infer/freshen.rs
@@ -197,7 +197,7 @@ impl<'a, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for TypeFreshener<'a, 'gcx, 'tcx> {
             ty::Param(..) |
             ty::Closure(..) |
             ty::GeneratorWitness(..) |
-            ty::Anon(..) => {
+            ty::Opaque(..) => {
                 t.super_fold_with(self)
             }
         }
diff --git a/src/librustc/infer/mod.rs b/src/librustc/infer/mod.rs
index a379438275d..a092bac5187 100644
--- a/src/librustc/infer/mod.rs
+++ b/src/librustc/infer/mod.rs
@@ -48,7 +48,7 @@ use self::outlives::env::OutlivesEnvironment;
 use self::type_variable::TypeVariableOrigin;
 use self::unify_key::ToType;
 
-pub mod anon_types;
+pub mod opaque_types;
 pub mod at;
 pub mod canonical;
 mod combine;
diff --git a/src/librustc/infer/anon_types/mod.rs b/src/librustc/infer/opaque_types/mod.rs
index 8eab07ece05..9d65c395062 100644
--- a/src/librustc/infer/anon_types/mod.rs
+++ b/src/librustc/infer/opaque_types/mod.rs
@@ -22,13 +22,13 @@ use ty::outlives::Component;
 use ty::subst::{Kind, Substs, UnpackedKind};
 use util::nodemap::DefIdMap;
 
-pub type AnonTypeMap<'tcx> = DefIdMap<AnonTypeDecl<'tcx>>;
+pub type OpaqueTypeMap<'tcx> = DefIdMap<OpaqueTypeDecl<'tcx>>;
 
-/// Information about the anonymous, abstract types whose values we
+/// Information about the opaque, abstract types whose values we
 /// are inferring in this function (these are the `impl Trait` that
 /// appear in the return type).
 #[derive(Copy, Clone, Debug)]
-pub struct AnonTypeDecl<'tcx> {
+pub struct OpaqueTypeDecl<'tcx> {
     /// The substitutions that we apply to the abstract that that this
     /// `impl Trait` desugars to. e.g., if:
     ///
@@ -81,7 +81,7 @@ pub struct AnonTypeDecl<'tcx> {
 }
 
 impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
-    /// Replace all anonymized types in `value` with fresh inference variables
+    /// Replace all opaque types in `value` with fresh inference variables
     /// and creates appropriate obligations. For example, given the input:
     ///
     ///     impl Iterator<Item = impl Debug>
@@ -92,29 +92,31 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
     ///     ?0: Iterator<Item = ?1>
     ///     ?1: Debug
     ///
-    /// Moreover, it returns a `AnonTypeMap` that would map `?0` to
+    /// Moreover, it returns a `OpaqueTypeMap` that would map `?0` to
     /// info about the `impl Iterator<..>` type and `?1` to info about
     /// the `impl Debug` type.
     ///
     /// # Parameters
     ///
-    /// - `parent_def_id` -- we will only instantiate anonymous types
+    /// - `parent_def_id` -- we will only instantiate opaque types
     ///   with this parent. This is typically the def-id of the function
-    ///   in whose return type anon types are being instantiated.
+    ///   in whose return type opaque types are being instantiated.
     /// - `body_id` -- the body-id with which the resulting obligations should
     ///   be associated
     /// - `param_env` -- the in-scope parameter environment to be used for
     ///   obligations
-    /// - `value` -- the value within which we are instantiating anon types
-    pub fn instantiate_anon_types<T: TypeFoldable<'tcx>>(
+    /// - `value` -- the value within which we are instantiating opaque types
+    pub fn instantiate_opaque_types<T: TypeFoldable<'tcx>>(
         &self,
         parent_def_id: DefId,
         body_id: ast::NodeId,
         param_env: ty::ParamEnv<'tcx>,
         value: &T,
-    ) -> InferOk<'tcx, (T, AnonTypeMap<'tcx>)> {
+    ) -> InferOk<'tcx, (T, OpaqueTypeMap<'tcx>)> {
         debug!(
-            "instantiate_anon_types(value={:?}, parent_def_id={:?}, body_id={:?}, param_env={:?})",
+            "instantiate_opaque_types(value={:?},
+            parent_def_id={:?}, body_id={:?},
+            param_env={:?})",
             value, parent_def_id, body_id, param_env,
         );
         let mut instantiator = Instantiator {
@@ -122,17 +124,17 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
             parent_def_id,
             body_id,
             param_env,
-            anon_types: DefIdMap(),
+            opaque_types: DefIdMap(),
             obligations: vec![],
         };
-        let value = instantiator.instantiate_anon_types_in_map(value);
+        let value = instantiator.instantiate_opaque_types_in_map(value);
         InferOk {
-            value: (value, instantiator.anon_types),
+            value: (value, instantiator.opaque_types),
             obligations: instantiator.obligations,
         }
     }
 
-    /// Given the map `anon_types` containing the existential `impl
+    /// Given the map `opaque_types` containing the existential `impl
     /// Trait` types whose underlying, hidden types are being
     /// inferred, this method adds constraints to the regions
     /// appearing in those underlying hidden types to ensure that they
@@ -267,34 +269,34 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
     ///
     /// # Parameters
     ///
-    /// - `anon_types` -- the map produced by `instantiate_anon_types`
+    /// - `opaque_types` -- the map produced by `instantiate_opaque_types`
     /// - `free_region_relations` -- something that can be used to relate
     ///   the free regions (`'a`) that appear in the impl trait.
-    pub fn constrain_anon_types<FRR: FreeRegionRelations<'tcx>>(
+    pub fn constrain_opaque_types<FRR: FreeRegionRelations<'tcx>>(
         &self,
-        anon_types: &AnonTypeMap<'tcx>,
+        opaque_types: &OpaqueTypeMap<'tcx>,
         free_region_relations: &FRR,
     ) {
-        debug!("constrain_anon_types()");
+        debug!("constrain_opaque_types()");
 
-        for (&def_id, anon_defn) in anon_types {
-            self.constrain_anon_type(def_id, anon_defn, free_region_relations);
+        for (&def_id, opaque_defn) in opaque_types {
+            self.constrain_opaque_type(def_id, opaque_defn, free_region_relations);
         }
     }
 
-    fn constrain_anon_type<FRR: FreeRegionRelations<'tcx>>(
+    fn constrain_opaque_type<FRR: FreeRegionRelations<'tcx>>(
         &self,
         def_id: DefId,
-        anon_defn: &AnonTypeDecl<'tcx>,
+        opaque_defn: &OpaqueTypeDecl<'tcx>,
         free_region_relations: &FRR,
     ) {
-        debug!("constrain_anon_type()");
-        debug!("constrain_anon_type: def_id={:?}", def_id);
-        debug!("constrain_anon_type: anon_defn={:#?}", anon_defn);
+        debug!("constrain_opaque_type()");
+        debug!("constrain_opaque_type: def_id={:?}", def_id);
+        debug!("constrain_opaque_type: opaque_defn={:#?}", opaque_defn);
 
-        let concrete_ty = self.resolve_type_vars_if_possible(&anon_defn.concrete_ty);
+        let concrete_ty = self.resolve_type_vars_if_possible(&opaque_defn.concrete_ty);
 
-        debug!("constrain_anon_type: concrete_ty={:?}", concrete_ty);
+        debug!("constrain_opaque_type: concrete_ty={:?}", concrete_ty);
 
         let abstract_type_generics = self.tcx.generics_of(def_id);
 
@@ -303,7 +305,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
         // If there are required region bounds, we can just skip
         // ahead.  There will already be a registered region
         // obligation related `concrete_ty` to those regions.
-        if anon_defn.has_required_region_bounds {
+        if opaque_defn.has_required_region_bounds {
             return;
         }
 
@@ -321,11 +323,11 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
                 _ => continue
             }
             // Get the value supplied for this region from the substs.
-            let subst_arg = anon_defn.substs.region_at(param.index as usize);
+            let subst_arg = opaque_defn.substs.region_at(param.index as usize);
 
             // Compute the least upper bound of it with the other regions.
-            debug!("constrain_anon_types: least_region={:?}", least_region);
-            debug!("constrain_anon_types: subst_arg={:?}", subst_arg);
+            debug!("constrain_opaque_types: least_region={:?}", least_region);
+            debug!("constrain_opaque_types: subst_arg={:?}", subst_arg);
             match least_region {
                 None => least_region = Some(subst_arg),
                 Some(lr) => {
@@ -355,7 +357,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
         }
 
         let least_region = least_region.unwrap_or(self.tcx.types.re_static);
-        debug!("constrain_anon_types: least_region={:?}", least_region);
+        debug!("constrain_opaque_types: least_region={:?}", least_region);
 
         // Require that the type `concrete_ty` outlives
         // `least_region`, modulo any type parameters that appear
@@ -384,7 +386,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
                         // annotations are needed in this case
                         self.tcx
                             .sess
-                            .delay_span_bug(span, "unresolved inf var in anon");
+                            .delay_span_bug(span, "unresolved inf var in opaque");
                     }
 
                     Component::Projection(ty::ProjectionTy {
@@ -405,7 +407,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
         }
     }
 
-    /// Given the fully resolved, instantiated type for an anonymous
+    /// Given the fully resolved, instantiated type for an opaque
     /// type, i.e., the value of an inference variable like C1 or C2
     /// (*), computes the "definition type" for an abstract type
     /// definition -- that is, the inferred value of `Foo1<'x>` or
@@ -420,22 +422,22 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
     /// purpose of this function is to do that translation.
     ///
     /// (*) C1 and C2 were introduced in the comments on
-    /// `constrain_anon_types`. Read that comment for more context.
+    /// `constrain_opaque_types`. Read that comment for more context.
     ///
     /// # Parameters
     ///
     /// - `def_id`, the `impl Trait` type
-    /// - `anon_defn`, the anonymous definition created in `instantiate_anon_types`
+    /// - `opaque_defn`, the opaque definition created in `instantiate_opaque_types`
     /// - `instantiated_ty`, the inferred type C1 -- fully resolved, lifted version of
-    ///   `anon_defn.concrete_ty`
-    pub fn infer_anon_definition_from_instantiation(
+    ///   `opaque_defn.concrete_ty`
+    pub fn infer_opaque_definition_from_instantiation(
         &self,
         def_id: DefId,
-        anon_defn: &AnonTypeDecl<'tcx>,
+        opaque_defn: &OpaqueTypeDecl<'tcx>,
         instantiated_ty: Ty<'gcx>,
     ) -> Ty<'gcx> {
         debug!(
-            "infer_anon_definition_from_instantiation(def_id={:?}, instantiated_ty={:?})",
+            "infer_opaque_definition_from_instantiation(def_id={:?}, instantiated_ty={:?})",
             def_id, instantiated_ty
         );
 
@@ -448,7 +450,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
         // `impl Trait` return type, resulting in the parameters
         // shifting.
         let id_substs = Substs::identity_for_item(gcx, def_id);
-        let map: FxHashMap<Kind<'tcx>, Kind<'gcx>> = anon_defn
+        let map: FxHashMap<Kind<'tcx>, Kind<'gcx>> = opaque_defn
             .substs
             .iter()
             .enumerate()
@@ -467,7 +469,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
                 instantiated_ty,
             ));
         debug!(
-            "infer_anon_definition_from_instantiation: definition_ty={:?}",
+            "infer_opaque_definition_from_instantiation: definition_ty={:?}",
             definition_ty
         );
 
@@ -487,7 +489,7 @@ struct ReverseMapper<'cx, 'gcx: 'tcx, 'tcx: 'cx> {
     /// our own errors because they are sometimes derivative.
     tainted_by_errors: bool,
 
-    anon_type_def_id: DefId,
+    opaque_type_def_id: DefId,
     map: FxHashMap<Kind<'tcx>, Kind<'gcx>>,
     map_missing_regions_to_empty: bool,
 
@@ -499,14 +501,14 @@ impl<'cx, 'gcx, 'tcx> ReverseMapper<'cx, 'gcx, 'tcx> {
     fn new(
         tcx: TyCtxt<'cx, 'gcx, 'tcx>,
         tainted_by_errors: bool,
-        anon_type_def_id: DefId,
+        opaque_type_def_id: DefId,
         map: FxHashMap<Kind<'tcx>, Kind<'gcx>>,
         hidden_ty: Ty<'tcx>,
     ) -> Self {
         Self {
             tcx,
             tainted_by_errors,
-            anon_type_def_id,
+            opaque_type_def_id,
             map,
             map_missing_regions_to_empty: false,
             hidden_ty: Some(hidden_ty),
@@ -554,7 +556,7 @@ impl<'cx, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for ReverseMapper<'cx, 'gcx, 'tcx>
             None => {
                 if !self.map_missing_regions_to_empty && !self.tainted_by_errors {
                     if let Some(hidden_ty) = self.hidden_ty.take() {
-                        let span = self.tcx.def_span(self.anon_type_def_id);
+                        let span = self.tcx.def_span(self.opaque_type_def_id);
                         let mut err = struct_span_err!(
                             self.tcx.sess,
                             span,
@@ -644,19 +646,19 @@ struct Instantiator<'a, 'gcx: 'tcx, 'tcx: 'a> {
     parent_def_id: DefId,
     body_id: ast::NodeId,
     param_env: ty::ParamEnv<'tcx>,
-    anon_types: AnonTypeMap<'tcx>,
+    opaque_types: OpaqueTypeMap<'tcx>,
     obligations: Vec<PredicateObligation<'tcx>>,
 }
 
 impl<'a, 'gcx, 'tcx> Instantiator<'a, 'gcx, 'tcx> {
-    fn instantiate_anon_types_in_map<T: TypeFoldable<'tcx>>(&mut self, value: &T) -> T {
-        debug!("instantiate_anon_types_in_map(value={:?})", value);
+    fn instantiate_opaque_types_in_map<T: TypeFoldable<'tcx>>(&mut self, value: &T) -> T {
+        debug!("instantiate_opaque_types_in_map(value={:?})", value);
         let tcx = self.infcx.tcx;
         value.fold_with(&mut BottomUpFolder {
             tcx,
             reg_op: |reg| reg,
             fldop: |ty| {
-                if let ty::Anon(def_id, substs) = ty.sty {
+                if let ty::Opaque(def_id, substs) = ty.sty {
                     // Check that this is `impl Trait` type is
                     // declared by `parent_def_id` -- i.e., one whose
                     // value we are inferring.  At present, this is
@@ -680,7 +682,7 @@ impl<'a, 'gcx, 'tcx> Instantiator<'a, 'gcx, 'tcx> {
                     // ```
                     //
                     // Here, the return type of `foo` references a
-                    // `Anon` indeed, but not one whose value is
+                    // `Opaque` indeed, but not one whose value is
                     // presently being inferred. You can get into a
                     // similar situation with closure return types
                     // today:
@@ -688,16 +690,16 @@ impl<'a, 'gcx, 'tcx> Instantiator<'a, 'gcx, 'tcx> {
                     // ```rust
                     // fn foo() -> impl Iterator { .. }
                     // fn bar() {
-                    //     let x = || foo(); // returns the Anon assoc with `foo`
+                    //     let x = || foo(); // returns the Opaque assoc with `foo`
                     // }
                     // ```
-                    if let Some(anon_node_id) = tcx.hir.as_local_node_id(def_id) {
+                    if let Some(opaque_node_id) = tcx.hir.as_local_node_id(def_id) {
                         let parent_def_id = self.parent_def_id;
                         let def_scope_default = || {
-                            let anon_parent_node_id = tcx.hir.get_parent(anon_node_id);
-                            parent_def_id == tcx.hir.local_def_id(anon_parent_node_id)
+                            let opaque_parent_node_id = tcx.hir.get_parent(opaque_node_id);
+                            parent_def_id == tcx.hir.local_def_id(opaque_parent_node_id)
                         };
-                        let in_definition_scope = match tcx.hir.find(anon_node_id) {
+                        let in_definition_scope = match tcx.hir.find(opaque_node_id) {
                             Some(Node::Item(item)) => match item.node {
                                 // impl trait
                                 hir::ItemKind::Existential(hir::ExistTy {
@@ -711,7 +713,7 @@ impl<'a, 'gcx, 'tcx> Instantiator<'a, 'gcx, 'tcx> {
                                 }) => may_define_existential_type(
                                     tcx,
                                     self.parent_def_id,
-                                    anon_node_id,
+                                    opaque_node_id,
                                 ),
                                 _ => def_scope_default(),
                             },
@@ -719,22 +721,22 @@ impl<'a, 'gcx, 'tcx> Instantiator<'a, 'gcx, 'tcx> {
                                 hir::ImplItemKind::Existential(_) => may_define_existential_type(
                                     tcx,
                                     self.parent_def_id,
-                                    anon_node_id,
+                                    opaque_node_id,
                                 ),
                                 _ => def_scope_default(),
                             },
                             _ => bug!(
                                 "expected (impl) item, found {}",
-                                tcx.hir.node_to_string(anon_node_id),
+                                tcx.hir.node_to_string(opaque_node_id),
                             ),
                         };
                         if in_definition_scope {
-                            return self.fold_anon_ty(ty, def_id, substs);
+                            return self.fold_opaque_ty(ty, def_id, substs);
                         }
 
                         debug!(
-                            "instantiate_anon_types_in_map: \
-                             encountered anon outside it's definition scope \
+                            "instantiate_opaque_types_in_map: \
+                             encountered opaque outside it's definition scope \
                              def_id={:?}",
                             def_id,
                         );
@@ -746,7 +748,7 @@ impl<'a, 'gcx, 'tcx> Instantiator<'a, 'gcx, 'tcx> {
         })
     }
 
-    fn fold_anon_ty(
+    fn fold_opaque_ty(
         &mut self,
         ty: Ty<'tcx>,
         def_id: DefId,
@@ -756,29 +758,29 @@ impl<'a, 'gcx, 'tcx> Instantiator<'a, 'gcx, 'tcx> {
         let tcx = infcx.tcx;
 
         debug!(
-            "instantiate_anon_types: Anon(def_id={:?}, substs={:?})",
+            "instantiate_opaque_types: Opaque(def_id={:?}, substs={:?})",
             def_id, substs
         );
 
-        // Use the same type variable if the exact same Anon appears more
+        // Use the same type variable if the exact same Opaque appears more
         // than once in the return type (e.g. if it's passed to a type alias).
-        if let Some(anon_defn) = self.anon_types.get(&def_id) {
-            return anon_defn.concrete_ty;
+        if let Some(opaque_defn) = self.opaque_types.get(&def_id) {
+            return opaque_defn.concrete_ty;
         }
         let span = tcx.def_span(def_id);
         let ty_var = infcx.next_ty_var(TypeVariableOrigin::TypeInference(span));
 
         let predicates_of = tcx.predicates_of(def_id);
         debug!(
-            "instantiate_anon_types: predicates: {:#?}",
+            "instantiate_opaque_types: predicates: {:#?}",
             predicates_of,
         );
         let bounds = predicates_of.instantiate(tcx, substs);
-        debug!("instantiate_anon_types: bounds={:?}", bounds);
+        debug!("instantiate_opaque_types: bounds={:?}", bounds);
 
         let required_region_bounds = tcx.required_region_bounds(ty, bounds.predicates.clone());
         debug!(
-            "instantiate_anon_types: required_region_bounds={:?}",
+            "instantiate_opaque_types: required_region_bounds={:?}",
             required_region_bounds
         );
 
@@ -786,34 +788,34 @@ impl<'a, 'gcx, 'tcx> Instantiator<'a, 'gcx, 'tcx> {
         // e.g. `existential type Foo<T: Bound>: Bar;` needs to be
         // defined by a function like `fn foo<T: Bound>() -> Foo<T>`.
         debug!(
-            "instantiate_anon_types: param_env: {:#?}",
+            "instantiate_opaque_types: param_env: {:#?}",
             self.param_env,
         );
         debug!(
-            "instantiate_anon_types: generics: {:#?}",
+            "instantiate_opaque_types: generics: {:#?}",
             tcx.generics_of(def_id),
         );
 
-        self.anon_types.insert(
+        self.opaque_types.insert(
             def_id,
-            AnonTypeDecl {
+            OpaqueTypeDecl {
                 substs,
                 concrete_ty: ty_var,
                 has_required_region_bounds: !required_region_bounds.is_empty(),
             },
         );
-        debug!("instantiate_anon_types: ty_var={:?}", ty_var);
+        debug!("instantiate_opaque_types: ty_var={:?}", ty_var);
 
         for predicate in bounds.predicates {
             // Change the predicate to refer to the type variable,
-            // which will be the concrete type, instead of the Anon.
+            // which will be the concrete type, instead of the Opaque.
             // This also instantiates nested `impl Trait`.
-            let predicate = self.instantiate_anon_types_in_map(&predicate);
+            let predicate = self.instantiate_opaque_types_in_map(&predicate);
 
             let cause = traits::ObligationCause::new(span, self.body_id, traits::SizedReturnType);
 
             // Require that the predicate holds for the concrete type.
-            debug!("instantiate_anon_types: predicate={:?}", predicate);
+            debug!("instantiate_opaque_types: predicate={:?}", predicate);
             self.obligations
                 .push(traits::Obligation::new(cause, self.param_env, predicate));
         }
@@ -822,7 +824,7 @@ impl<'a, 'gcx, 'tcx> Instantiator<'a, 'gcx, 'tcx> {
     }
 }
 
-/// Whether `anon_node_id` is a sibling or a child of a sibling of `def_id`
+/// Whether `opaque_node_id` is a sibling or a child of a sibling of `def_id`
 ///
 /// ```rust
 /// pub mod foo {
@@ -837,13 +839,14 @@ impl<'a, 'gcx, 'tcx> Instantiator<'a, 'gcx, 'tcx> {
 /// ```
 ///
 /// Here, `def_id` will be the `DefId` of the existential type `Baz`.
-/// `anon_node_id` is the `NodeId` of the reference to Baz -- so either the return type of f1 or f2.
+/// `opaque_node_id` is the `NodeId` of the reference to Baz --
+///  so either the return type of f1 or f2.
 /// We will return true if the reference is within the same module as the existential type
 /// So true for f1, false for f2.
 pub fn may_define_existential_type(
     tcx: TyCtxt,
     def_id: DefId,
-    anon_node_id: ast::NodeId,
+    opaque_node_id: ast::NodeId,
 ) -> bool {
     let mut node_id = tcx
         .hir
@@ -851,9 +854,9 @@ pub fn may_define_existential_type(
         .unwrap();
     // named existential types can be defined by any siblings or
     // children of siblings
-    let mod_id = tcx.hir.get_parent(anon_node_id);
+    let mod_id = tcx.hir.get_parent(opaque_node_id);
     // so we walk up the node tree until we hit the root or the parent
-    // of the anon type
+    // of the opaque type
     while node_id != mod_id && node_id != ast::CRATE_NODE_ID {
         node_id = tcx.hir.get_parent(node_id);
     }
diff --git a/src/librustc/traits/coherence.rs b/src/librustc/traits/coherence.rs
index c283c4d3cab..b8dd2a12fb5 100644
--- a/src/librustc/traits/coherence.rs
+++ b/src/librustc/traits/coherence.rs
@@ -483,7 +483,7 @@ fn ty_is_local_constructor(ty: Ty, in_crate: InCrate) -> bool {
         ty::Closure(..) |
         ty::Generator(..) |
         ty::GeneratorWitness(..) |
-        ty::Anon(..) => {
+        ty::Opaque(..) => {
             bug!("ty_is_local invoked on unexpected type: {:?}", ty)
         }
     }
diff --git a/src/librustc/traits/error_reporting.rs b/src/librustc/traits/error_reporting.rs
index b34378151cc..a7c697c1cba 100644
--- a/src/librustc/traits/error_reporting.rs
+++ b/src/librustc/traits/error_reporting.rs
@@ -258,7 +258,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
                 ty::Tuple(..) => Some(10),
                 ty::Projection(..) => Some(11),
                 ty::Param(..) => Some(12),
-                ty::Anon(..) => Some(13),
+                ty::Opaque(..) => Some(13),
                 ty::Never => Some(14),
                 ty::Adt(adt, ..) => match adt.adt_kind() {
                     AdtKind::Struct => Some(15),
diff --git a/src/librustc/traits/project.rs b/src/librustc/traits/project.rs
index 939ba92c7ba..e50f59cbc82 100644
--- a/src/librustc/traits/project.rs
+++ b/src/librustc/traits/project.rs
@@ -366,7 +366,7 @@ impl<'a, 'b, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for AssociatedTypeNormalizer<'a,
 
         let ty = ty.super_fold_with(self);
         match ty.sty {
-            ty::Anon(def_id, substs) if !substs.has_escaping_regions() => { // (*)
+            ty::Opaque(def_id, substs) if !substs.has_escaping_regions() => { // (*)
                 // Only normalize `impl Trait` after type-checking, usually in codegen.
                 match self.param_env.reveal {
                     Reveal::UserFacing => ty,
@@ -986,7 +986,7 @@ fn assemble_candidates_from_trait_def<'cx, 'gcx, 'tcx>(
         ty::Projection(ref data) => {
             (data.trait_ref(tcx).def_id, data.substs)
         }
-        ty::Anon(def_id, substs) => (def_id, substs),
+        ty::Opaque(def_id, substs) => (def_id, substs),
         ty::Infer(ty::TyVar(_)) => {
             // If the self-type is an inference variable, then it MAY wind up
             // being a projected type, so induce an ambiguity.
@@ -1518,7 +1518,7 @@ fn confirm_impl_candidate<'cx, 'gcx, 'tcx>(
     let substs = translate_substs(selcx.infcx(), param_env, impl_def_id, substs, assoc_ty.node);
     let ty = if let ty::AssociatedKind::Existential = assoc_ty.item.kind {
         let item_substs = Substs::identity_for_item(tcx, assoc_ty.item.def_id);
-        tcx.mk_anon(assoc_ty.item.def_id, item_substs)
+        tcx.mk_opaque(assoc_ty.item.def_id, item_substs)
     } else {
         tcx.type_of(assoc_ty.item.def_id)
     };
diff --git a/src/librustc/traits/query/dropck_outlives.rs b/src/librustc/traits/query/dropck_outlives.rs
index 3a0f7700824..fd8898dffd4 100644
--- a/src/librustc/traits/query/dropck_outlives.rs
+++ b/src/librustc/traits/query/dropck_outlives.rs
@@ -258,7 +258,7 @@ pub fn trivial_dropck_outlives<'tcx>(tcx: TyCtxt<'_, '_, 'tcx>, ty: Ty<'tcx>) ->
         ty::Dynamic(..)
         | ty::Projection(..)
         | ty::Param(_)
-        | ty::Anon(..)
+        | ty::Opaque(..)
         | ty::Infer(_)
         | ty::Generator(..) => false,
     }
diff --git a/src/librustc/traits/query/normalize.rs b/src/librustc/traits/query/normalize.rs
index 8b4954cc501..ea8bc3b20aa 100644
--- a/src/librustc/traits/query/normalize.rs
+++ b/src/librustc/traits/query/normalize.rs
@@ -99,7 +99,7 @@ impl<'cx, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for QueryNormalizer<'cx, 'gcx, 'tcx
     fn fold_ty(&mut self, ty: Ty<'tcx>) -> Ty<'tcx> {
         let ty = ty.super_fold_with(self);
         match ty.sty {
-            ty::Anon(def_id, substs) if !substs.has_escaping_regions() => {
+            ty::Opaque(def_id, substs) if !substs.has_escaping_regions() => {
                 // (*)
                 // Only normalize `impl Trait` after type-checking, usually in codegen.
                 match self.param_env.reveal {
diff --git a/src/librustc/traits/select.rs b/src/librustc/traits/select.rs
index 69bdeec6eea..232ef108537 100644
--- a/src/librustc/traits/select.rs
+++ b/src/librustc/traits/select.rs
@@ -1492,7 +1492,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
         // before we go into the whole skolemization thing, just
         // quickly check if the self-type is a projection at all.
         match obligation.predicate.skip_binder().trait_ref.self_ty().sty {
-            ty::Projection(_) | ty::Anon(..) => {}
+            ty::Projection(_) | ty::Opaque(..) => {}
             ty::Infer(ty::TyVar(_)) => {
                 span_bug!(obligation.cause.span,
                     "Self=_ should have been handled by assemble_candidates");
@@ -1528,7 +1528,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
         let (def_id, substs) = match skol_trait_predicate.trait_ref.self_ty().sty {
             ty::Projection(ref data) =>
                 (data.trait_ref(self.tcx()).def_id, data.substs),
-            ty::Anon(def_id, substs) => (def_id, substs),
+            ty::Opaque(def_id, substs) => (def_id, substs),
             _ => {
                 span_bug!(
                     obligation.cause.span,
@@ -2203,7 +2203,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
                 ))
             }
 
-            ty::Projection(_) | ty::Param(_) | ty::Anon(..) => None,
+            ty::Projection(_) | ty::Param(_) | ty::Opaque(..) => None,
             ty::Infer(ty::TyVar(_)) => Ambiguous,
 
             ty::Infer(ty::CanonicalTy(_)) |
@@ -2265,7 +2265,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
                 }
             }
 
-            ty::Adt(..) | ty::Projection(..) | ty::Param(..) | ty::Anon(..) => {
+            ty::Adt(..) | ty::Projection(..) | ty::Param(..) | ty::Opaque(..) => {
                 // Fallback to whatever user-defined impls exist in this case.
                 None
             }
@@ -2369,7 +2369,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
                     .collect()
             }
 
-            ty::Anon(def_id, substs) => {
+            ty::Opaque(def_id, substs) => {
                 // We can resolve the `impl Trait` to its concrete type,
                 // which enforces a DAG between the functions requiring
                 // the auto trait bounds in question.
diff --git a/src/librustc/ty/context.rs b/src/librustc/ty/context.rs
index 6981d92f05f..eb6f7140a7d 100644
--- a/src/librustc/ty/context.rs
+++ b/src/librustc/ty/context.rs
@@ -2136,7 +2136,7 @@ impl<'a, 'tcx> TyCtxt<'a, 'tcx, 'tcx> {
             self,
             Adt, Array, Slice, RawPtr, Ref, FnDef, FnPtr,
             Generator, GeneratorWitness, Dynamic, Closure, Tuple,
-            Param, Infer, Projection, Anon, Foreign);
+            Param, Infer, Projection, Opaque, Foreign);
 
         println!("Substs interner: #{}", self.interners.substs.borrow().len());
         println!("Region interner: #{}", self.interners.region.borrow().len());
@@ -2606,8 +2606,8 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
         }
     }
 
-    pub fn mk_anon(self, def_id: DefId, substs: &'tcx Substs<'tcx>) -> Ty<'tcx> {
-        self.mk_ty(Anon(def_id, substs))
+    pub fn mk_opaque(self, def_id: DefId, substs: &'tcx Substs<'tcx>) -> Ty<'tcx> {
+        self.mk_ty(Opaque(def_id, substs))
     }
 
     pub fn intern_existential_predicates(self, eps: &[ExistentialPredicate<'tcx>])
diff --git a/src/librustc/ty/error.rs b/src/librustc/ty/error.rs
index aa6ee420a21..2b833c57140 100644
--- a/src/librustc/ty/error.rs
+++ b/src/librustc/ty/error.rs
@@ -229,7 +229,7 @@ impl<'a, 'gcx, 'lcx, 'tcx> ty::TyS<'tcx> {
                     "type parameter".to_string()
                 }
             }
-            ty::Anon(..) => "anonymized type".to_string(),
+            ty::Opaque(..) => "opaque type".to_string(),
             ty::Error => "type error".to_string(),
         }
     }
diff --git a/src/librustc/ty/fast_reject.rs b/src/librustc/ty/fast_reject.rs
index 567d1c668f7..22a77bd6253 100644
--- a/src/librustc/ty/fast_reject.rs
+++ b/src/librustc/ty/fast_reject.rs
@@ -47,7 +47,7 @@ pub enum SimplifiedTypeGen<D>
     ClosureSimplifiedType(D),
     GeneratorSimplifiedType(D),
     GeneratorWitnessSimplifiedType(usize),
-    AnonSimplifiedType(D),
+    OpaqueSimplifiedType(D),
     FunctionSimplifiedType(usize),
     ParameterSimplifiedType,
     ForeignSimplifiedType(DefId),
@@ -115,8 +115,8 @@ pub fn simplify_type<'a, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, 'tcx>,
                 None
             }
         }
-        ty::Anon(def_id, _) => {
-            Some(AnonSimplifiedType(def_id))
+        ty::Opaque(def_id, _) => {
+            Some(OpaqueSimplifiedType(def_id))
         }
         ty::Foreign(def_id) => {
             Some(ForeignSimplifiedType(def_id))
@@ -146,7 +146,7 @@ impl<D: Copy + Debug + Ord + Eq + Hash> SimplifiedTypeGen<D> {
             ClosureSimplifiedType(d) => ClosureSimplifiedType(map(d)),
             GeneratorSimplifiedType(d) => GeneratorSimplifiedType(map(d)),
             GeneratorWitnessSimplifiedType(n) => GeneratorWitnessSimplifiedType(n),
-            AnonSimplifiedType(d) => AnonSimplifiedType(map(d)),
+            OpaqueSimplifiedType(d) => OpaqueSimplifiedType(map(d)),
             FunctionSimplifiedType(n) => FunctionSimplifiedType(n),
             ParameterSimplifiedType => ParameterSimplifiedType,
             ForeignSimplifiedType(d) => ForeignSimplifiedType(d),
@@ -181,7 +181,7 @@ impl<'a, 'gcx, D> HashStable<StableHashingContext<'a>> for SimplifiedTypeGen<D>
             ClosureSimplifiedType(d) => d.hash_stable(hcx, hasher),
             GeneratorSimplifiedType(d) => d.hash_stable(hcx, hasher),
             GeneratorWitnessSimplifiedType(n) => n.hash_stable(hcx, hasher),
-            AnonSimplifiedType(d) => d.hash_stable(hcx, hasher),
+            OpaqueSimplifiedType(d) => d.hash_stable(hcx, hasher),
             FunctionSimplifiedType(n) => n.hash_stable(hcx, hasher),
             ForeignSimplifiedType(d) => d.hash_stable(hcx, hasher),
         }
diff --git a/src/librustc/ty/flags.rs b/src/librustc/ty/flags.rs
index b9371ec39cc..341ce40d153 100644
--- a/src/librustc/ty/flags.rs
+++ b/src/librustc/ty/flags.rs
@@ -150,7 +150,7 @@ impl FlagComputation {
                 self.add_projection_ty(data);
             }
 
-            &ty::Anon(_, substs) => {
+            &ty::Opaque(_, substs) => {
                 self.add_flags(TypeFlags::HAS_PROJECTION);
                 self.add_substs(substs);
             }
diff --git a/src/librustc/ty/fold.rs b/src/librustc/ty/fold.rs
index 26010c3d5f5..a661125d1ca 100644
--- a/src/librustc/ty/fold.rs
+++ b/src/librustc/ty/fold.rs
@@ -771,7 +771,7 @@ impl<'tcx> TypeVisitor<'tcx> for LateBoundRegionsCollector {
         // in the normalized form
         if self.just_constrained {
             match t.sty {
-                ty::Projection(..) | ty::Anon(..) => { return false; }
+                ty::Projection(..) | ty::Opaque(..) => { return false; }
                 _ => { }
             }
         }
diff --git a/src/librustc/ty/item_path.rs b/src/librustc/ty/item_path.rs
index e38bb411a14..0272865bda4 100644
--- a/src/librustc/ty/item_path.rs
+++ b/src/librustc/ty/item_path.rs
@@ -385,7 +385,7 @@ pub fn characteristic_def_id_of_type(ty: Ty) -> Option<DefId> {
         ty::FnPtr(_) |
         ty::Projection(_) |
         ty::Param(_) |
-        ty::Anon(..) |
+        ty::Opaque(..) |
         ty::Infer(_) |
         ty::Error |
         ty::GeneratorWitness(..) |
diff --git a/src/librustc/ty/layout.rs b/src/librustc/ty/layout.rs
index 4524c486272..17d613a2b18 100644
--- a/src/librustc/ty/layout.rs
+++ b/src/librustc/ty/layout.rs
@@ -1103,7 +1103,7 @@ impl<'a, 'tcx> LayoutCx<'tcx, TyCtxt<'a, 'tcx, 'tcx>> {
             }
 
             // Types with no meaningful known layout.
-            ty::Projection(_) | ty::Anon(..) => {
+            ty::Projection(_) | ty::Opaque(..) => {
                 let normalized = tcx.normalize_erasing_regions(param_env, ty);
                 if ty == normalized {
                     return Err(LayoutError::Unknown(ty));
@@ -1373,7 +1373,7 @@ impl<'a, 'tcx> SizeSkeleton<'tcx> {
                 }
             }
 
-            ty::Projection(_) | ty::Anon(..) => {
+            ty::Projection(_) | ty::Opaque(..) => {
                 let normalized = tcx.normalize_erasing_regions(param_env, ty);
                 if ty == normalized {
                     Err(err)
@@ -1685,7 +1685,7 @@ impl<'a, 'tcx, C> TyLayoutMethods<'tcx, C> for Ty<'tcx>
                 }
             }
 
-            ty::Projection(_) | ty::Anon(..) | ty::Param(_) |
+            ty::Projection(_) | ty::Opaque(..) | 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 5e2093d0356..a48aabc3cd7 100644
--- a/src/librustc/ty/mod.rs
+++ b/src/librustc/ty/mod.rs
@@ -559,7 +559,7 @@ impl<'tcx> TyS<'tcx> {
 
     pub fn is_suggestable(&self) -> bool {
         match self.sty {
-            TyKind::Anon(..) |
+            TyKind::Opaque(..) |
             TyKind::FnDef(..) |
             TyKind::FnPtr(..) |
             TyKind::Dynamic(..) |
@@ -2320,7 +2320,7 @@ impl<'a, 'gcx, 'tcx> AdtDef {
                     .collect()
             }
 
-            Projection(..) | Anon(..) => {
+            Projection(..) | Opaque(..) => {
                 // must calculate explicitly.
                 // FIXME: consider special-casing always-Sized projections
                 vec![ty]
diff --git a/src/librustc/ty/outlives.rs b/src/librustc/ty/outlives.rs
index 5171bfb7e06..68f67070876 100644
--- a/src/librustc/ty/outlives.rs
+++ b/src/librustc/ty/outlives.rs
@@ -144,7 +144,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
             ty::Float(..) |       // OutlivesScalar
             ty::Never |           // ...
             ty::Adt(..) |         // OutlivesNominalType
-            ty::Anon(..) |        // OutlivesNominalType (ish)
+            ty::Opaque(..) |        // OutlivesNominalType (ish)
             ty::Foreign(..) |     // OutlivesNominalType
             ty::Str |             // OutlivesScalar (ish)
             ty::Array(..) |       // ...
diff --git a/src/librustc/ty/relate.rs b/src/librustc/ty/relate.rs
index d72e48c04fe..8f84fb7e391 100644
--- a/src/librustc/ty/relate.rs
+++ b/src/librustc/ty/relate.rs
@@ -564,11 +564,11 @@ pub fn super_relate_tys<'a, 'gcx, 'tcx, R>(relation: &mut R,
             Ok(tcx.mk_projection(projection_ty.item_def_id, projection_ty.substs))
         }
 
-        (&ty::Anon(a_def_id, a_substs), &ty::Anon(b_def_id, b_substs))
+        (&ty::Opaque(a_def_id, a_substs), &ty::Opaque(b_def_id, b_substs))
             if a_def_id == b_def_id =>
         {
             let substs = relate_substs(relation, None, a_substs, b_substs)?;
-            Ok(tcx.mk_anon(a_def_id, substs))
+            Ok(tcx.mk_opaque(a_def_id, substs))
         }
 
         _ =>
diff --git a/src/librustc/ty/structural_impls.rs b/src/librustc/ty/structural_impls.rs
index 60b85e8a8eb..737878375ec 100644
--- a/src/librustc/ty/structural_impls.rs
+++ b/src/librustc/ty/structural_impls.rs
@@ -865,7 +865,7 @@ impl<'tcx> TypeFoldable<'tcx> for Ty<'tcx> {
             ty::GeneratorWitness(types) => ty::GeneratorWitness(types.fold_with(folder)),
             ty::Closure(did, substs) => ty::Closure(did, substs.fold_with(folder)),
             ty::Projection(ref data) => ty::Projection(data.fold_with(folder)),
-            ty::Anon(did, substs) => ty::Anon(did, substs.fold_with(folder)),
+            ty::Opaque(did, substs) => ty::Opaque(did, substs.fold_with(folder)),
             ty::Bool | ty::Char | ty::Str | ty::Int(_) |
             ty::Uint(_) | ty::Float(_) | ty::Error | ty::Infer(_) |
             ty::Param(..) | ty::Never | ty::Foreign(..) => return self
@@ -900,7 +900,7 @@ impl<'tcx> TypeFoldable<'tcx> for Ty<'tcx> {
             ty::GeneratorWitness(ref types) => types.visit_with(visitor),
             ty::Closure(_did, ref substs) => substs.visit_with(visitor),
             ty::Projection(ref data) => data.visit_with(visitor),
-            ty::Anon(_, ref substs) => substs.visit_with(visitor),
+            ty::Opaque(_, ref substs) => substs.visit_with(visitor),
             ty::Bool | ty::Char | ty::Str | ty::Int(_) |
             ty::Uint(_) | ty::Float(_) | ty::Error | ty::Infer(_) |
             ty::Param(..) | ty::Never | ty::Foreign(..) => false,
diff --git a/src/librustc/ty/sty.rs b/src/librustc/ty/sty.rs
index b5ec1ad36ab..962b115f187 100644
--- a/src/librustc/ty/sty.rs
+++ b/src/librustc/ty/sty.rs
@@ -157,13 +157,13 @@ pub enum TyKind<'tcx> {
     /// `<T as Trait<..>>::N`.
     Projection(ProjectionTy<'tcx>),
 
-    /// Anonymized (`impl Trait`) type found in a return type.
+    /// Opaque (`impl Trait`) type found in a return type.
     /// The DefId comes either from
     /// * the `impl Trait` ast::Ty node,
     /// * or the `existential type` declaration
     /// The substitutions are for the generics of the function in question.
     /// After typeck, the concrete type can be found in the `types` map.
-    Anon(DefId, &'tcx Substs<'tcx>),
+    Opaque(DefId, &'tcx Substs<'tcx>),
 
     /// A type parameter; for example, `T` in `fn f<T>(x: T) {}
     Param(ParamTy),
@@ -1755,7 +1755,7 @@ impl<'a, 'gcx, 'tcx> TyS<'tcx> {
 
     pub fn is_impl_trait(&self) -> bool {
         match self.sty {
-            Anon(..) => true,
+            Opaque(..) => true,
             _ => false,
         }
     }
@@ -1782,7 +1782,7 @@ impl<'a, 'gcx, 'tcx> TyS<'tcx> {
                 }
                 v
             }
-            Adt(_, substs) | Anon(_, substs) => {
+            Adt(_, substs) | Opaque(_, substs) => {
                 substs.regions().collect()
             }
             Closure(_, ClosureSubsts { ref substs }) |
@@ -1867,7 +1867,7 @@ impl<'a, 'gcx, 'tcx> TyS<'tcx> {
             ty::Adt(def, _substs) =>
                 def.sized_constraint(tcx).is_empty(),
 
-            ty::Projection(_) | ty::Param(_) | ty::Anon(..) => false,
+            ty::Projection(_) | ty::Param(_) | ty::Opaque(..) => false,
 
             ty::Infer(ty::TyVar(_)) => false,
 
diff --git a/src/librustc/ty/util.rs b/src/librustc/ty/util.rs
index f7679dc8ce0..cc0429de2f6 100644
--- a/src/librustc/ty/util.rs
+++ b/src/librustc/ty/util.rs
@@ -956,7 +956,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::Param(_) |
-        ty::Anon(..) | ty::Infer(_) | ty::Error => true,
+        ty::Opaque(..) | ty::Infer(_) | ty::Error => true,
 
         // Structural recursion.
         ty::Array(ty, _) | ty::Slice(ty) => needs_drop(ty),
diff --git a/src/librustc/ty/walk.rs b/src/librustc/ty/walk.rs
index 6d3ba22c57f..cf87c2d4574 100644
--- a/src/librustc/ty/walk.rs
+++ b/src/librustc/ty/walk.rs
@@ -114,7 +114,7 @@ fn push_subtypes<'tcx>(stack: &mut TypeWalkerStack<'tcx>, parent_ty: Ty<'tcx>) {
                 substs.types().rev().chain(opt_ty)
             }));
         }
-        ty::Adt(_, substs) | ty::Anon(_, substs) => {
+        ty::Adt(_, substs) | ty::Opaque(_, substs) => {
             stack.extend(substs.types().rev());
         }
         ty::Closure(_, ref substs) => {
diff --git a/src/librustc/ty/wf.rs b/src/librustc/ty/wf.rs
index fc55d8f34a2..63206a660df 100644
--- a/src/librustc/ty/wf.rs
+++ b/src/librustc/ty/wf.rs
@@ -360,7 +360,7 @@ impl<'a, 'gcx, 'tcx> WfPredicates<'a, 'gcx, 'tcx> {
                     // types appearing in the fn signature
                 }
 
-                ty::Anon(did, substs) => {
+                ty::Opaque(did, substs) => {
                     // all of the requirements on type parameters
                     // should've been checked by the instantiation
                     // of whatever returned this exact `impl Trait`.
diff --git a/src/librustc/util/ppaux.rs b/src/librustc/util/ppaux.rs
index e8236e21e24..ddcc0fa9c92 100644
--- a/src/librustc/util/ppaux.rs
+++ b/src/librustc/util/ppaux.rs
@@ -17,7 +17,7 @@ use ty::{BrAnon, BrEnv, BrFresh, BrNamed};
 use ty::{Bool, Char, Adt};
 use ty::{Error, Str, Array, Slice, Float, FnDef, FnPtr};
 use ty::{Param, RawPtr, Ref, Never, Tuple};
-use ty::{Closure, Generator, GeneratorWitness, Foreign, Projection, Anon};
+use ty::{Closure, Generator, GeneratorWitness, Foreign, Projection, Opaque};
 use ty::{Dynamic, Int, Uint, Infer};
 use ty::{self, RegionVid, Ty, TyCtxt, TypeFoldable, GenericParamCount, GenericParamDefKind};
 use util::nodemap::FxHashSet;
@@ -1102,9 +1102,9 @@ define_print! {
                 }
                 Foreign(def_id) => parameterized(f, subst::Substs::empty(), def_id, &[]),
                 Projection(ref data) => data.print(f, cx),
-                Anon(def_id, substs) => {
+                Opaque(def_id, substs) => {
                     if cx.is_verbose {
-                        return write!(f, "Anon({:?}, {:?})", def_id, substs);
+                        return write!(f, "Opaque({:?}, {:?})", def_id, substs);
                     }
 
                     ty::tls::with(|tcx| {
diff --git a/src/librustc_codegen_llvm/debuginfo/type_names.rs b/src/librustc_codegen_llvm/debuginfo/type_names.rs
index a08b964cd72..95a094bf909 100644
--- a/src/librustc_codegen_llvm/debuginfo/type_names.rs
+++ b/src/librustc_codegen_llvm/debuginfo/type_names.rs
@@ -174,7 +174,7 @@ pub fn push_debuginfo_type_name<'a, 'tcx>(cx: &CodegenCx<'a, 'tcx>,
         ty::Error |
         ty::Infer(_) |
         ty::Projection(..) |
-        ty::Anon(..) |
+        ty::Opaque(..) |
         ty::GeneratorWitness(..) |
         ty::Param(_) => {
             bug!("debuginfo: Trying to create type name for \
diff --git a/src/librustc_lint/types.rs b/src/librustc_lint/types.rs
index 2c410e8efb1..33181bd80e9 100644
--- a/src/librustc_lint/types.rs
+++ b/src/librustc_lint/types.rs
@@ -721,7 +721,7 @@ impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> {
             ty::Generator(..) |
             ty::GeneratorWitness(..) |
             ty::Projection(..) |
-            ty::Anon(..) |
+            ty::Opaque(..) |
             ty::FnDef(..) => bug!("Unexpected type in foreign function"),
         }
     }
diff --git a/src/librustc_mir/borrow_check/nll/type_check/input_output.rs b/src/librustc_mir/borrow_check/nll/type_check/input_output.rs
index af426670167..265cd305eb9 100644
--- a/src/librustc_mir/borrow_check/nll/type_check/input_output.rs
+++ b/src/librustc_mir/borrow_check/nll/type_check/input_output.rs
@@ -72,7 +72,7 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> {
         // types.
         let param_env = self.param_env;
         let mir_output_ty = mir.local_decls[RETURN_PLACE].ty;
-        let anon_type_map =
+        let opaque_type_map =
             self.fully_perform_op(
                 Locations::All,
                 CustomTypeOp::new(
@@ -80,8 +80,8 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> {
                         let mut obligations = ObligationAccumulator::default();
 
                         let dummy_body_id = ObligationCause::dummy().body_id;
-                        let (output_ty, anon_type_map) =
-                            obligations.add(infcx.instantiate_anon_types(
+                        let (output_ty, opaque_type_map) =
+                            obligations.add(infcx.instantiate_opaque_types(
                                 mir_def_id,
                                 dummy_body_id,
                                 param_env,
@@ -92,8 +92,8 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> {
                             output_ty
                         );
                         debug!(
-                            "equate_inputs_and_outputs: anon_type_map={:#?}",
-                            anon_type_map
+                            "equate_inputs_and_outputs: opaque_type_map={:#?}",
+                            opaque_type_map
                         );
 
                         debug!(
@@ -106,29 +106,30 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> {
                                 .eq(output_ty, mir_output_ty)?,
                         );
 
-                        for (&anon_def_id, anon_decl) in &anon_type_map {
-                            let anon_defn_ty = tcx.type_of(anon_def_id);
-                            let anon_defn_ty = anon_defn_ty.subst(tcx, anon_decl.substs);
-                            let anon_defn_ty = renumber::renumber_regions(
+                        for (&opaque_def_id, opaque_decl) in &opaque_type_map {
+                            let opaque_defn_ty = tcx.type_of(opaque_def_id);
+                            let opaque_defn_ty = opaque_defn_ty.subst(tcx, opaque_decl.substs);
+                            let opaque_defn_ty = renumber::renumber_regions(
                                 infcx,
-                                &anon_defn_ty,
+                                &opaque_defn_ty,
                             );
                             debug!(
                                 "equate_inputs_and_outputs: concrete_ty={:?}",
-                                anon_decl.concrete_ty
+                                opaque_decl.concrete_ty
                             );
-                            debug!("equate_inputs_and_outputs: anon_defn_ty={:?}", anon_defn_ty);
+                            debug!("equate_inputs_and_outputs: opaque_defn_ty={:?}",
+                                   opaque_defn_ty);
                             obligations.add(
                                 infcx
                                     .at(&ObligationCause::dummy(), param_env)
-                                    .eq(anon_decl.concrete_ty, anon_defn_ty)?,
+                                    .eq(opaque_decl.concrete_ty, opaque_defn_ty)?,
                             );
                         }
 
                         debug!("equate_inputs_and_outputs: equated");
 
                         Ok(InferOk {
-                            value: Some(anon_type_map),
+                            value: Some(opaque_type_map),
                             obligations: obligations.into_vec(),
                         })
                     },
@@ -146,22 +147,22 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> {
                 None
             });
 
-        // Finally, if we instantiated the anon types successfully, we
+        // Finally, if we instantiated the opaque types successfully, we
         // have to solve any bounds (e.g., `-> impl Iterator` needs to
         // prove that `T: Iterator` where `T` is the type we
         // instantiated it with).
-        if let Some(anon_type_map) = anon_type_map {
+        if let Some(opaque_type_map) = opaque_type_map {
             self.fully_perform_op(
                 Locations::All,
                 CustomTypeOp::new(
                     |_cx| {
-                        infcx.constrain_anon_types(&anon_type_map, universal_region_relations);
+                        infcx.constrain_opaque_types(&opaque_type_map, universal_region_relations);
                         Ok(InferOk {
                             value: (),
                             obligations: vec![],
                         })
                     },
-                    || "anon_type_map".to_string(),
+                    || "opaque_type_map".to_string(),
                 ),
             ).unwrap();
         }
diff --git a/src/librustc_mir/monomorphize/item.rs b/src/librustc_mir/monomorphize/item.rs
index 3187a91e225..dc437ee8510 100644
--- a/src/librustc_mir/monomorphize/item.rs
+++ b/src/librustc_mir/monomorphize/item.rs
@@ -385,7 +385,7 @@ impl<'a, 'tcx> DefPathBasedNames<'a, 'tcx> {
             ty::Projection(..) |
             ty::Param(_) |
             ty::GeneratorWitness(_) |
-            ty::Anon(..) => {
+            ty::Opaque(..) => {
                 bug!("DefPathBasedNames: Trying to create type name for \
                                          unexpected type: {:?}", t);
             }
diff --git a/src/librustc_mir/transform/qualify_min_const_fn.rs b/src/librustc_mir/transform/qualify_min_const_fn.rs
index 56e32ea5d1a..eacc23c9c4f 100644
--- a/src/librustc_mir/transform/qualify_min_const_fn.rs
+++ b/src/librustc_mir/transform/qualify_min_const_fn.rs
@@ -100,7 +100,7 @@ fn check_ty(
                 span,
                 "mutable references in const fn are unstable".into(),
             )),
-            ty::Anon(..) => return Err((span, "`impl Trait` in const fn is unstable".into())),
+            ty::Opaque(..) => return Err((span, "`impl Trait` in const fn is unstable".into())),
             ty::FnPtr(..) => {
                 return Err((span, "function pointers in const fn are unstable".into()))
             }
diff --git a/src/librustc_privacy/lib.rs b/src/librustc_privacy/lib.rs
index 4245136ef21..fe66110120d 100644
--- a/src/librustc_privacy/lib.rs
+++ b/src/librustc_privacy/lib.rs
@@ -490,7 +490,7 @@ impl<'b, 'a, 'tcx> TypeVisitor<'tcx> for ReachEverythingInTheInterfaceVisitor<'b
             ty::FnDef(def_id, ..) |
             ty::Closure(def_id, ..) |
             ty::Generator(def_id, ..) |
-            ty::Anon(def_id, _) => Some(def_id),
+            ty::Opaque(def_id, _) => Some(def_id),
             _ => None
         };
 
@@ -652,7 +652,7 @@ struct TypePrivacyVisitor<'a, 'tcx: 'a> {
     in_body: bool,
     span: Span,
     empty_tables: &'a ty::TypeckTables<'tcx>,
-    visited_anon_tys: FxHashSet<DefId>
+    visited_opaque_tys: FxHashSet<DefId>
 }
 
 impl<'a, 'tcx> TypePrivacyVisitor<'a, 'tcx> {
@@ -956,7 +956,7 @@ impl<'a, 'tcx> TypeVisitor<'tcx> for TypePrivacyVisitor<'a, 'tcx> {
                     return true;
                 }
             }
-            ty::Anon(def_id, ..) => {
+            ty::Opaque(def_id, ..) => {
                 for predicate in &self.tcx.predicates_of(def_id).predicates {
                     let trait_ref = match *predicate {
                         ty::Predicate::Trait(ref poly_trait_predicate) => {
@@ -979,10 +979,10 @@ impl<'a, 'tcx> TypeVisitor<'tcx> for TypePrivacyVisitor<'a, 'tcx> {
                             return true;
                         }
                         for subst in trait_ref.substs.iter() {
-                            // Skip repeated `Anon`s to avoid infinite recursion.
+                            // Skip repeated `Opaque`s to avoid infinite recursion.
                             if let UnpackedKind::Type(ty) = subst.unpack() {
-                                if let ty::Anon(def_id, ..) = ty.sty {
-                                    if !self.visited_anon_tys.insert(def_id) {
+                                if let ty::Opaque(def_id, ..) = ty.sty {
+                                    if !self.visited_opaque_tys.insert(def_id) {
                                         continue;
                                     }
                                 }
@@ -1728,7 +1728,7 @@ fn privacy_access_levels<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
         in_body: false,
         span: krate.span,
         empty_tables: &empty_tables,
-        visited_anon_tys: FxHashSet()
+        visited_opaque_tys: FxHashSet()
     };
     intravisit::walk_crate(&mut visitor, krate);
 
diff --git a/src/librustc_traits/dropck_outlives.rs b/src/librustc_traits/dropck_outlives.rs
index a27a447ad4b..e3ec2e6b9ce 100644
--- a/src/librustc_traits/dropck_outlives.rs
+++ b/src/librustc_traits/dropck_outlives.rs
@@ -123,7 +123,7 @@ fn dropck_outlives<'tcx>(
 
                             // A projection that we couldn't resolve - it
                             // might have a destructor.
-                            ty::Projection(..) | ty::Anon(..) => {
+                            ty::Projection(..) | ty::Opaque(..) => {
                                 result.kinds.push(ty.into());
                             }
 
@@ -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::Param(..) => Ok(DtorckConstraint {
+        ty::Projection(..) | ty::Opaque(..) | 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 65dd71de144..eaf1d03de7d 100644
--- a/src/librustc_typeck/astconv.rs
+++ b/src/librustc_typeck/astconv.rs
@@ -1350,7 +1350,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx>+'o {
                 let substs = self.ast_path_substs_for_ty(span, did, item_segment.0);
                 self.normalize_ty(
                     span,
-                    tcx.mk_anon(did, substs),
+                    tcx.mk_opaque(did, substs),
                 )
             }
             Def::Enum(did) | Def::TyAlias(did) | Def::Struct(did) |
@@ -1543,7 +1543,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx>+'o {
         });
         debug!("impl_trait_ty_to_ty: final substs = {:?}", substs);
 
-        let ty = tcx.mk_anon(def_id, substs);
+        let ty = tcx.mk_opaque(def_id, substs);
         debug!("impl_trait_ty_to_ty: {}", ty);
         ty
     }
diff --git a/src/librustc_typeck/check/cast.rs b/src/librustc_typeck/check/cast.rs
index 52e5e57f747..ebe0c279aaf 100644
--- a/src/librustc_typeck/check/cast.rs
+++ b/src/librustc_typeck/check/cast.rs
@@ -78,8 +78,8 @@ enum PointerKind<'tcx> {
     Length,
     /// The unsize info of this projection
     OfProjection(&'tcx ty::ProjectionTy<'tcx>),
-    /// The unsize info of this anon ty
-    OfAnon(DefId, &'tcx Substs<'tcx>),
+    /// The unsize info of this opaque ty
+    OfOpaque(DefId, &'tcx Substs<'tcx>),
     /// The unsize info of this parameter
     OfParam(&'tcx ty::ParamTy),
 }
@@ -124,7 +124,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
             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::Opaque(def_id, substs) => Some(PointerKind::OfOpaque(def_id, substs)),
             ty::Param(ref p) => Some(PointerKind::OfParam(p)),
             // Insufficient type information.
             ty::Infer(_) => None,
diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs
index a1e4c85f821..9ab269702db 100644
--- a/src/librustc_typeck/check/mod.rs
+++ b/src/librustc_typeck/check/mod.rs
@@ -91,7 +91,7 @@ use hir::def_id::{CrateNum, DefId, LOCAL_CRATE};
 use std::slice;
 use namespace::Namespace;
 use rustc::infer::{self, InferCtxt, InferOk, RegionVariableOrigin};
-use rustc::infer::anon_types::AnonTypeDecl;
+use rustc::infer::opaque_types::OpaqueTypeDecl;
 use rustc::infer::type_variable::{TypeVariableOrigin};
 use rustc::middle::region;
 use rustc::mir::interpret::{ConstValue, GlobalId};
@@ -212,11 +212,11 @@ pub struct Inherited<'a, 'gcx: 'a+'tcx, 'tcx: 'a> {
 
     deferred_generator_interiors: RefCell<Vec<(hir::BodyId, Ty<'tcx>)>>,
 
-    // Anonymized types found in explicit return types and their
+    // Opaque types found in explicit return types and their
     // associated fresh inference variable. Writeback resolves these
     // variables to get the concrete type, which can be used to
-    // deanonymize Anon, after typeck is done with all functions.
-    anon_types: RefCell<DefIdMap<AnonTypeDecl<'tcx>>>,
+    // 'de-opaque' OpaqueTypeDecl, after typeck is done with all functions.
+    opaque_types: RefCell<DefIdMap<OpaqueTypeDecl<'tcx>>>,
 
     /// Each type parameter has an implicit region bound that
     /// indicates it must outlive at least the function body (the user
@@ -635,7 +635,7 @@ impl<'a, 'gcx, 'tcx> Inherited<'a, 'gcx, 'tcx> {
             deferred_call_resolutions: RefCell::new(DefIdMap()),
             deferred_cast_checks: RefCell::new(Vec::new()),
             deferred_generator_interiors: RefCell::new(Vec::new()),
-            anon_types: RefCell::new(DefIdMap()),
+            opaque_types: RefCell::new(DefIdMap()),
             implicit_region_bound,
             body_id,
         }
@@ -1024,7 +1024,7 @@ fn check_fn<'a, 'gcx, 'tcx>(inherited: &'a Inherited<'a, 'gcx, 'tcx>,
 
     let declared_ret_ty = fn_sig.output();
     fcx.require_type_is_sized(declared_ret_ty, decl.output.span(), traits::SizedReturnType);
-    let revealed_ret_ty = fcx.instantiate_anon_types_from_return_value(fn_id, &declared_ret_ty);
+    let revealed_ret_ty = fcx.instantiate_opaque_types_from_return_value(fn_id, &declared_ret_ty);
     fcx.ret_coercion = Some(RefCell::new(CoerceMany::new(revealed_ret_ty)));
     fn_sig = fcx.tcx.mk_fn_sig(
         fn_sig.inputs().iter().cloned(),
@@ -2222,24 +2222,24 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
         result
     }
 
-    /// Replace the anonymized types from the return value of the
-    /// function with type variables and records the `AnonTypeMap` for
+    /// Replace the opaque types from the return value of the
+    /// function with type variables and records the `OpaqueTypeMap` for
     /// later use during writeback. See
-    /// `InferCtxt::instantiate_anon_types` for more details.
-    fn instantiate_anon_types_from_return_value<T: TypeFoldable<'tcx>>(
+    /// `InferCtxt::instantiate_opaque_types` for more details.
+    fn instantiate_opaque_types_from_return_value<T: TypeFoldable<'tcx>>(
         &self,
         fn_id: ast::NodeId,
         value: &T,
     ) -> T {
         let fn_def_id = self.tcx.hir.local_def_id(fn_id);
         debug!(
-            "instantiate_anon_types_from_return_value(fn_def_id={:?}, value={:?})",
+            "instantiate_opaque_types_from_return_value(fn_def_id={:?}, value={:?})",
             fn_def_id,
             value
         );
 
-        let (value, anon_type_map) = self.register_infer_ok_obligations(
-            self.instantiate_anon_types(
+        let (value, opaque_type_map) = self.register_infer_ok_obligations(
+            self.instantiate_opaque_types(
                 fn_def_id,
                 self.body_id,
                 self.param_env,
@@ -2247,9 +2247,9 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
             )
         );
 
-        let mut anon_types = self.anon_types.borrow_mut();
-        for (ty, decl) in anon_type_map {
-            let old_value = anon_types.insert(ty, decl);
+        let mut opaque_types = self.opaque_types.borrow_mut();
+        for (ty, decl) in opaque_type_map {
+            let old_value = opaque_types.insert(ty, decl);
             assert!(old_value.is_none(), "instantiated twice: {:?}/{:?}", ty, decl);
         }
 
diff --git a/src/librustc_typeck/check/regionck.rs b/src/librustc_typeck/check/regionck.rs
index 867864b3853..05fe0cb9262 100644
--- a/src/librustc_typeck/check/regionck.rs
+++ b/src/librustc_typeck/check/regionck.rs
@@ -347,8 +347,8 @@ impl<'a, 'gcx, 'tcx> RegionCtxt<'a, 'gcx, 'tcx> {
                                        body_hir_id,
                                        call_site_region);
 
-        self.constrain_anon_types(
-            &self.fcx.anon_types.borrow(),
+        self.constrain_opaque_types(
+            &self.fcx.opaque_types.borrow(),
             self.outlives_environment.free_region_map(),
         );
     }
diff --git a/src/librustc_typeck/check/wfcheck.rs b/src/librustc_typeck/check/wfcheck.rs
index 99e0e8775b0..9e09f2cd185 100644
--- a/src/librustc_typeck/check/wfcheck.rs
+++ b/src/librustc_typeck/check/wfcheck.rs
@@ -18,7 +18,7 @@ use rustc::ty::subst::{Subst, Substs};
 use rustc::ty::util::ExplicitSelf;
 use rustc::util::nodemap::{FxHashSet, FxHashMap};
 use rustc::middle::lang_items;
-use rustc::infer::anon_types::may_define_existential_type;
+use rustc::infer::opaque_types::may_define_existential_type;
 
 use syntax::ast;
 use syntax::feature_gate::{self, GateIssue};
@@ -576,13 +576,13 @@ fn check_existential_types<'a, 'fcx, 'gcx, 'tcx>(
     ty.fold_with(&mut ty::fold::BottomUpFolder {
         tcx: fcx.tcx,
         fldop: |ty| {
-            if let ty::Anon(def_id, substs) = ty.sty {
-                trace!("check_existential_types: anon_ty, {:?}, {:?}", def_id, substs);
+            if let ty::Opaque(def_id, substs) = ty.sty {
+                trace!("check_existential_types: opaque_ty, {:?}, {:?}", def_id, substs);
                 let generics = tcx.generics_of(def_id);
                 // only check named existential types
                 if generics.parent.is_none() {
-                    let anon_node_id = tcx.hir.as_local_node_id(def_id).unwrap();
-                    if may_define_existential_type(tcx, fn_def_id, anon_node_id) {
+                    let opaque_node_id = tcx.hir.as_local_node_id(def_id).unwrap();
+                    if may_define_existential_type(tcx, fn_def_id, opaque_node_id) {
                         trace!("check_existential_types may define. Generics: {:#?}", generics);
                         let mut seen: FxHashMap<_, Vec<_>> = FxHashMap();
                         for (subst, param) in substs.iter().zip(&generics.params) {
@@ -674,7 +674,7 @@ fn check_existential_types<'a, 'fcx, 'gcx, 'tcx>(
                         }
                     }
                 } // if is_named_existential_type
-            } // if let Anon
+            } // if let Opaque
             ty
         },
         reg_op: |reg| reg,
diff --git a/src/librustc_typeck/check/writeback.rs b/src/librustc_typeck/check/writeback.rs
index 0d8401c1c86..0b2f92ac4bc 100644
--- a/src/librustc_typeck/check/writeback.rs
+++ b/src/librustc_typeck/check/writeback.rs
@@ -48,7 +48,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
         wbcx.visit_closures();
         wbcx.visit_liberated_fn_sigs();
         wbcx.visit_fru_field_types();
-        wbcx.visit_anon_types(body.value.span);
+        wbcx.visit_opaque_types(body.value.span);
         wbcx.visit_cast_types();
         wbcx.visit_free_region_map();
         wbcx.visit_user_provided_tys();
@@ -393,18 +393,18 @@ impl<'cx, 'gcx, 'tcx> WritebackCx<'cx, 'gcx, 'tcx> {
         }
     }
 
-    fn visit_anon_types(&mut self, span: Span) {
-        for (&def_id, anon_defn) in self.fcx.anon_types.borrow().iter() {
+    fn visit_opaque_types(&mut self, span: Span) {
+        for (&def_id, opaque_defn) in self.fcx.opaque_types.borrow().iter() {
             let node_id = self.tcx().hir.as_local_node_id(def_id).unwrap();
-            let instantiated_ty = self.resolve(&anon_defn.concrete_ty, &node_id);
+            let instantiated_ty = self.resolve(&opaque_defn.concrete_ty, &node_id);
 
             let generics = self.tcx().generics_of(def_id);
 
             let definition_ty = if generics.parent.is_some() {
                 // impl trait
-                self.fcx.infer_anon_definition_from_instantiation(
+                self.fcx.infer_opaque_definition_from_instantiation(
                     def_id,
-                    anon_defn,
+                    opaque_defn,
                     instantiated_ty,
                 )
             } else {
@@ -427,8 +427,8 @@ impl<'cx, 'gcx, 'tcx> WritebackCx<'cx, 'gcx, 'tcx> {
                         // find a type parameter
                         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) {
+                            assert_eq!(opaque_defn.substs.len(), generics.params.len());
+                            for (subst, param) in opaque_defn.substs.iter().zip(&generics.params) {
                                 if let UnpackedKind::Type(subst) = subst.unpack() {
                                     if subst == ty {
                                         // found it in the substitution list, replace with the
@@ -460,7 +460,7 @@ impl<'cx, 'gcx, 'tcx> WritebackCx<'cx, 'gcx, 'tcx> {
                             ty::ReStatic => region,
                             _ => {
                                 trace!("checking {:?}", region);
-                                for (subst, p) in anon_defn.substs.iter().zip(&generics.params) {
+                                for (subst, p) in opaque_defn.substs.iter().zip(&generics.params) {
                                     if let UnpackedKind::Lifetime(subst) = subst.unpack() {
                                         if subst == region {
                                             // found it in the substitution list, replace with the
@@ -477,7 +477,7 @@ impl<'cx, 'gcx, 'tcx> WritebackCx<'cx, 'gcx, 'tcx> {
                                         }
                                     }
                                 }
-                                trace!("anon_defn: {:#?}", anon_defn);
+                                trace!("opaque_defn: {:#?}", opaque_defn);
                                 trace!("generics: {:#?}", generics);
                                 self.tcx()
                                     .sess
@@ -501,7 +501,7 @@ impl<'cx, 'gcx, 'tcx> WritebackCx<'cx, 'gcx, 'tcx> {
                 })
             };
 
-            if let ty::Anon(defin_ty_def_id, _substs) = definition_ty.sty {
+            if let ty::Opaque(defin_ty_def_id, _substs) = definition_ty.sty {
                 if def_id == defin_ty_def_id {
                     // Concrete type resolved to the existential type itself
                     // Force a cycle error
@@ -516,8 +516,8 @@ impl<'cx, 'gcx, 'tcx> WritebackCx<'cx, 'gcx, 'tcx> {
                 if old != definition_ty {
                     span_bug!(
                         span,
-                        "visit_anon_types tried to write \
-                         different types for the same existential type: {:?}, {:?}, {:?}",
+                        "visit_opaque_types tried to write \
+                        different types for the same existential type: {:?}, {:?}, {:?}",
                         def_id,
                         definition_ty,
                         old,
diff --git a/src/librustc_typeck/collect.rs b/src/librustc_typeck/collect.rs
index 7997801a9a5..cc83c24e51c 100644
--- a/src/librustc_typeck/collect.rs
+++ b/src/librustc_typeck/collect.rs
@@ -1646,18 +1646,18 @@ fn explicit_predicates_of<'a, 'tcx>(
         Node::ImplItem(item) => match item.node {
             ImplItemKind::Existential(ref bounds) => {
                 let substs = Substs::identity_for_item(tcx, def_id);
-                let anon_ty = tcx.mk_anon(def_id, substs);
+                let opaque_ty = tcx.mk_opaque(def_id, substs);
 
                 // Collect the bounds, i.e. the `A+B+'c` in `impl A+B+'c`.
                 let bounds = compute_bounds(
                     &icx,
-                    anon_ty,
+                    opaque_ty,
                     bounds,
                     SizedByDefault::Yes,
                     tcx.def_span(def_id),
                 );
 
-                predicates.extend(bounds.predicates(tcx, anon_ty));
+                predicates.extend(bounds.predicates(tcx, opaque_ty));
                 &item.generics
             }
             _ => &item.generics,
@@ -1687,12 +1687,12 @@ fn explicit_predicates_of<'a, 'tcx>(
                     ref generics,
                 }) => {
                     let substs = Substs::identity_for_item(tcx, def_id);
-                    let anon_ty = tcx.mk_anon(def_id, substs);
+                    let opaque_ty = tcx.mk_opaque(def_id, substs);
 
                     // Collect the bounds, i.e. the `A+B+'c` in `impl A+B+'c`.
                     let bounds = compute_bounds(
                         &icx,
-                        anon_ty,
+                        opaque_ty,
                         bounds,
                         SizedByDefault::Yes,
                         tcx.def_span(def_id),
@@ -1702,11 +1702,11 @@ fn explicit_predicates_of<'a, 'tcx>(
                         // impl Trait
                         return ty::GenericPredicates {
                             parent: None,
-                            predicates: bounds.predicates(tcx, anon_ty),
+                            predicates: bounds.predicates(tcx, opaque_ty),
                         };
                     } else {
                         // named existential types
-                        predicates.extend(bounds.predicates(tcx, anon_ty));
+                        predicates.extend(bounds.predicates(tcx, opaque_ty));
                         generics
                     }
                 }
diff --git a/src/librustc_typeck/constrained_type_params.rs b/src/librustc_typeck/constrained_type_params.rs
index 37b0b83ccd0..1b481fc5a7d 100644
--- a/src/librustc_typeck/constrained_type_params.rs
+++ b/src/librustc_typeck/constrained_type_params.rs
@@ -62,7 +62,7 @@ struct ParameterCollector {
 impl<'tcx> TypeVisitor<'tcx> for ParameterCollector {
     fn visit_ty(&mut self, t: Ty<'tcx>) -> bool {
         match t.sty {
-            ty::Projection(..) | ty::Anon(..) if !self.include_nonconstraining => {
+            ty::Projection(..) | ty::Opaque(..) if !self.include_nonconstraining => {
                 // projections are not injective
                 return false;
             }
diff --git a/src/librustc_typeck/variance/constraints.rs b/src/librustc_typeck/variance/constraints.rs
index a7921549718..95544da0b8e 100644
--- a/src/librustc_typeck/variance/constraints.rs
+++ b/src/librustc_typeck/variance/constraints.rs
@@ -302,7 +302,7 @@ impl<'a, 'tcx> ConstraintContext<'a, 'tcx> {
                 self.add_constraints_from_trait_ref(current, data.trait_ref(tcx), variance);
             }
 
-            ty::Anon(_, substs) => {
+            ty::Opaque(_, substs) => {
                 self.add_constraints_from_invariant_substs(current, substs, variance);
             }
 
diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs
index da18e3e6b91..20b17afeab2 100644
--- a/src/librustdoc/clean/mod.rs
+++ b/src/librustdoc/clean/mod.rs
@@ -2678,11 +2678,11 @@ impl<'tcx> Clean<Type> for Ty<'tcx> {
 
             ty::Param(ref p) => Generic(p.name.to_string()),
 
-            ty::Anon(def_id, substs) => {
+            ty::Opaque(def_id, substs) => {
                 // Grab the "TraitA + TraitB" from `impl TraitA + TraitB`,
                 // by looking up the projections associated with the def_id.
                 let predicates_of = cx.tcx.predicates_of(def_id);
-                let substs = cx.tcx.lift(&substs).expect("Anon lift failed");
+                let substs = cx.tcx.lift(&substs).expect("Opaque lift failed");
                 let bounds = predicates_of.instantiate(cx.tcx, substs);
                 let mut regions = vec![];
                 let mut has_sized = false;
diff --git a/src/test/ui/existential_types/generic_type_does_not_live_long_enough.nll.stderr b/src/test/ui/existential_types/generic_type_does_not_live_long_enough.nll.stderr
index a480f54ac18..471eda45daf 100644
--- a/src/test/ui/existential_types/generic_type_does_not_live_long_enough.nll.stderr
+++ b/src/test/ui/existential_types/generic_type_does_not_live_long_enough.nll.stderr
@@ -2,7 +2,7 @@ error[E0308]: mismatched types
   --> $DIR/generic_type_does_not_live_long_enough.rs:16:18
    |
 LL |     let z: i32 = x; //~ ERROR mismatched types
-   |                  ^ expected i32, found anonymized type
+   |                  ^ expected i32, found opaque type
    |
    = note: expected type `i32`
               found type `WrongGeneric::<&{integer}>`
diff --git a/src/test/ui/existential_types/generic_type_does_not_live_long_enough.stderr b/src/test/ui/existential_types/generic_type_does_not_live_long_enough.stderr
index 189ad7d49a4..f1773b7c2fc 100644
--- a/src/test/ui/existential_types/generic_type_does_not_live_long_enough.stderr
+++ b/src/test/ui/existential_types/generic_type_does_not_live_long_enough.stderr
@@ -2,7 +2,7 @@ error[E0308]: mismatched types
   --> $DIR/generic_type_does_not_live_long_enough.rs:16:18
    |
 LL |     let z: i32 = x; //~ ERROR mismatched types
-   |                  ^ expected i32, found anonymized type
+   |                  ^ expected i32, found opaque type
    |
    = note: expected type `i32`
               found type `WrongGeneric::<&{integer}>`
diff --git a/src/test/ui/existential_types/never_reveal_concrete_type.stderr b/src/test/ui/existential_types/never_reveal_concrete_type.stderr
index 449799c91b7..ab937a9483c 100644
--- a/src/test/ui/existential_types/never_reveal_concrete_type.stderr
+++ b/src/test/ui/existential_types/never_reveal_concrete_type.stderr
@@ -2,7 +2,7 @@ error[E0308]: mismatched types
   --> $DIR/never_reveal_concrete_type.rs:24:27
    |
 LL |     let _: &'static str = x; //~ mismatched types
-   |                           ^ expected reference, found anonymized type
+   |                           ^ expected reference, found opaque type
    |
    = note: expected type `&'static str`
               found type `NoReveal`
diff --git a/src/test/ui/existential_types/no_revealing_outside_defining_module.stderr b/src/test/ui/existential_types/no_revealing_outside_defining_module.stderr
index a1c98c6d4b8..3f03174a491 100644
--- a/src/test/ui/existential_types/no_revealing_outside_defining_module.stderr
+++ b/src/test/ui/existential_types/no_revealing_outside_defining_module.stderr
@@ -2,7 +2,7 @@ error[E0308]: mismatched types
   --> $DIR/no_revealing_outside_defining_module.rs:26:19
    |
 LL |     let _: &str = bomp(); //~ ERROR mismatched types
-   |                   ^^^^^^ expected &str, found anonymized type
+   |                   ^^^^^^ expected &str, found opaque type
    |
    = note: expected type `&str`
               found type `Boo`
@@ -13,7 +13,7 @@ error[E0308]: mismatched types
 LL | fn bomp() -> boo::Boo {
    |              -------- expected `Boo` because of return type
 LL |     "" //~ ERROR mismatched types
-   |     ^^ expected anonymized type, found reference
+   |     ^^ expected opaque type, found reference
    |
    = note: expected type `Boo`
               found type `&'static str`
diff --git a/src/test/ui/impl-trait/equality2.rs b/src/test/ui/impl-trait/equality2.rs
index ec3dc15d846..2ce24cf789d 100644
--- a/src/test/ui/impl-trait/equality2.rs
+++ b/src/test/ui/impl-trait/equality2.rs
@@ -36,7 +36,7 @@ fn main() {
     //~^ ERROR mismatched types
     //~| expected type `u32`
     //~| found type `impl Foo`
-    //~| expected u32, found anonymized type
+    //~| expected u32, found opaque type
 
     let _: i32 = Leak::leak(hide(0_i32));
     //~^ ERROR mismatched types
diff --git a/src/test/ui/impl-trait/equality2.stderr b/src/test/ui/impl-trait/equality2.stderr
index e4ff2f68247..da51e35947a 100644
--- a/src/test/ui/impl-trait/equality2.stderr
+++ b/src/test/ui/impl-trait/equality2.stderr
@@ -2,7 +2,7 @@ error[E0308]: mismatched types
   --> $DIR/equality2.rs:35:18
    |
 LL |     let _: u32 = hide(0_u32);
-   |                  ^^^^^^^^^^^ expected u32, found anonymized type
+   |                  ^^^^^^^^^^^ expected u32, found opaque type
    |
    = note: expected type `u32`
               found type `impl Foo`