about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorSeiichi Uchida <seuchida@gmail.com>2019-09-06 22:41:03 +0900
committerGitHub <noreply@github.com>2019-09-06 22:41:03 +0900
commit5baba86fe554424e8a58e3f1a3f29c258fce3296 (patch)
tree2fd322b9bfd583bca41d1ec2ef3c1a67e0a666c9 /src
parent1ded995ee79c44069b7832e5aba00162fc2113fa (diff)
Update rustc-ap-* crates to 581.0.0 (#3783)
Diffstat (limited to 'src')
-rw-r--r--src/attr.rs2
-rw-r--r--src/expr.rs4
-rw-r--r--src/items.rs92
-rw-r--r--src/macros.rs15
-rw-r--r--src/modules.rs4
-rw-r--r--src/modules/visitor.rs9
-rw-r--r--src/patterns.rs41
-rw-r--r--src/spanned.rs2
-rw-r--r--src/utils.rs4
-rw-r--r--src/visitor.rs29
10 files changed, 130 insertions, 72 deletions
diff --git a/src/attr.rs b/src/attr.rs
index 1c9092ea629..7270215ccbb 100644
--- a/src/attr.rs
+++ b/src/attr.rs
@@ -340,7 +340,7 @@ impl Rewrite for ast::Attribute {
 
                         let literal_str = literal.as_str();
                         let doc_comment_formatter =
-                            DocCommentFormatter::new(literal_str.get(), comment_style);
+                            DocCommentFormatter::new(&*literal_str, comment_style);
                         let doc_comment = format!("{}", doc_comment_formatter);
                         return rewrite_doc_comment(
                             &doc_comment,
diff --git a/src/expr.rs b/src/expr.rs
index 9030d876b40..02bf1fa20e4 100644
--- a/src/expr.rs
+++ b/src/expr.rs
@@ -1316,8 +1316,8 @@ pub(crate) fn can_be_overflowed_expr(
             context.config.overflow_delimited_expr()
                 || (context.use_block_indent() && args_len == 1)
         }
-        ast::ExprKind::Mac(ref macro_) => {
-            match (macro_.node.delim, context.config.overflow_delimited_expr()) {
+        ast::ExprKind::Mac(ref mac) => {
+            match (mac.delim, context.config.overflow_delimited_expr()) {
                 (ast::MacDelimiter::Bracket, true) | (ast::MacDelimiter::Brace, true) => true,
                 _ => context.use_block_indent() && args_len == 1,
             }
diff --git a/src/items.rs b/src/items.rs
index 0943122b090..613f9b5b729 100644
--- a/src/items.rs
+++ b/src/items.rs
@@ -473,8 +473,8 @@ impl<'a> FmtVisitor<'a> {
         let discr_ident_lens: Vec<usize> = enum_def
             .variants
             .iter()
-            .filter(|var| var.node.disr_expr.is_some())
-            .map(|var| rewrite_ident(&self.get_context(), var.node.ident).len())
+            .filter(|var| var.disr_expr.is_some())
+            .map(|var| rewrite_ident(&self.get_context(), var.ident).len())
             .collect();
         // cut the list at the point of longest discrim shorter than the threshold
         // All of the discrims under the threshold will get padded, and all above - left as is.
@@ -491,8 +491,8 @@ impl<'a> FmtVisitor<'a> {
                 "}",
                 ",",
                 |f| {
-                    if !f.node.attrs.is_empty() {
-                        f.node.attrs[0].span.lo()
+                    if !f.attrs.is_empty() {
+                        f.attrs[0].span.lo()
                     } else {
                         f.span.lo()
                     }
@@ -533,8 +533,8 @@ impl<'a> FmtVisitor<'a> {
         one_line_width: usize,
         pad_discrim_ident_to: usize,
     ) -> Option<String> {
-        if contains_skip(&field.node.attrs) {
-            let lo = field.node.attrs[0].span.lo();
+        if contains_skip(&field.attrs) {
+            let lo = field.attrs[0].span.lo();
             let span = mk_sp(lo, field.span.hi());
             return Some(self.snippet(span).to_owned());
         }
@@ -542,25 +542,24 @@ impl<'a> FmtVisitor<'a> {
         let context = self.get_context();
         // 1 = ','
         let shape = self.shape().sub_width(1)?;
-        let attrs_str = field.node.attrs.rewrite(&context, shape)?;
+        let attrs_str = field.attrs.rewrite(&context, shape)?;
         let lo = field
-            .node
             .attrs
             .last()
             .map_or(field.span.lo(), |attr| attr.span.hi());
         let span = mk_sp(lo, field.span.lo());
 
-        let variant_body = match field.node.data {
+        let variant_body = match field.data {
             ast::VariantData::Tuple(..) | ast::VariantData::Struct(..) => format_struct(
                 &context,
                 &StructParts::from_variant(field),
                 self.block_indent,
                 Some(one_line_width),
             )?,
-            ast::VariantData::Unit(..) => rewrite_ident(&context, field.node.ident).to_owned(),
+            ast::VariantData::Unit(..) => rewrite_ident(&context, field.ident).to_owned(),
         };
 
-        let variant_body = if let Some(ref expr) = field.node.disr_expr {
+        let variant_body = if let Some(ref expr) = field.disr_expr {
             let lhs = format!("{:1$} =", variant_body, pad_discrim_ident_to);
             rewrite_assign_rhs_with(
                 &context,
@@ -585,27 +584,27 @@ impl<'a> FmtVisitor<'a> {
                 buffer.push((self.buffer.clone(), item.clone()));
                 self.buffer.clear();
             }
-            // type -> existential -> const -> macro -> method
+            // type -> opaque -> const -> macro -> method
             use crate::ast::ImplItemKind::*;
             fn need_empty_line(a: &ast::ImplItemKind, b: &ast::ImplItemKind) -> bool {
                 match (a, b) {
-                    (Type(..), Type(..))
+                    (TyAlias(..), TyAlias(..))
                     | (Const(..), Const(..))
-                    | (Existential(..), Existential(..)) => false,
+                    | (OpaqueTy(..), OpaqueTy(..)) => false,
                     _ => true,
                 }
             }
 
             buffer.sort_by(|(_, a), (_, b)| match (&a.node, &b.node) {
-                (Type(..), Type(..))
+                (TyAlias(..), TyAlias(..))
                 | (Const(..), Const(..))
                 | (Macro(..), Macro(..))
-                | (Existential(..), Existential(..)) => a.ident.as_str().cmp(&b.ident.as_str()),
+                | (OpaqueTy(..), OpaqueTy(..)) => a.ident.as_str().cmp(&b.ident.as_str()),
                 (Method(..), Method(..)) => a.span.lo().cmp(&b.span.lo()),
-                (Type(..), _) => Ordering::Less,
-                (_, Type(..)) => Ordering::Greater,
-                (Existential(..), _) => Ordering::Less,
-                (_, Existential(..)) => Ordering::Greater,
+                (TyAlias(..), _) => Ordering::Less,
+                (_, TyAlias(..)) => Ordering::Greater,
+                (OpaqueTy(..), _) => Ordering::Less,
+                (_, OpaqueTy(..)) => Ordering::Greater,
                 (Const(..), _) => Ordering::Less,
                 (_, Const(..)) => Ordering::Greater,
                 (Macro(..), _) => Ordering::Less,
@@ -920,9 +919,9 @@ impl<'a> StructParts<'a> {
     fn from_variant(variant: &'a ast::Variant) -> Self {
         StructParts {
             prefix: "",
-            ident: variant.node.ident,
+            ident: variant.ident,
             vis: &DEFAULT_VISIBILITY,
-            def: &variant.node.data,
+            def: &variant.data,
             generics: None,
             span: variant.span,
         }
@@ -1517,7 +1516,7 @@ pub(crate) fn rewrite_type_alias(
     rewrite_type_item(context, indent, "type", " =", ident, ty, generics, vis)
 }
 
-pub(crate) fn rewrite_existential_type(
+pub(crate) fn rewrite_opaque_type(
     context: &RewriteContext<'_>,
     indent: Indent,
     ident: ast::Ident,
@@ -1528,8 +1527,8 @@ pub(crate) fn rewrite_existential_type(
     rewrite_type_item(
         context,
         indent,
-        "existential type",
-        ":",
+        "type",
+        " =",
         ident,
         generic_bounds,
         generics,
@@ -1786,15 +1785,42 @@ pub(crate) fn rewrite_associated_type(
     }
 }
 
-pub(crate) fn rewrite_existential_impl_type(
+struct OpaqueType<'a> {
+    bounds: &'a ast::GenericBounds,
+}
+
+impl<'a> Rewrite for OpaqueType<'a> {
+    fn rewrite(&self, context: &RewriteContext<'_>, shape: Shape) -> Option<String> {
+        let shape = shape.offset_left(5)?; // `impl `
+        self.bounds
+            .rewrite(context, shape)
+            .map(|s| format!("impl {}", s))
+    }
+}
+
+pub(crate) fn rewrite_opaque_impl_type(
     context: &RewriteContext<'_>,
     ident: ast::Ident,
     generics: &ast::Generics,
     generic_bounds: &ast::GenericBounds,
     indent: Indent,
 ) -> Option<String> {
-    rewrite_associated_type(ident, None, generics, Some(generic_bounds), context, indent)
-        .map(|s| format!("existential {}", s))
+    let ident_str = rewrite_ident(context, ident);
+    // 5 = "type "
+    let generics_shape = Shape::indented(indent, context.config).offset_left(5)?;
+    let generics_str = rewrite_generics(context, ident_str, generics, generics_shape)?;
+    let prefix = format!("type {} =", generics_str);
+    let rhs = OpaqueType {
+        bounds: generic_bounds,
+    };
+
+    rewrite_assign_rhs(
+        context,
+        &prefix,
+        &rhs,
+        Shape::indented(indent, context.config).sub_width(1)?,
+    )
+    .map(|s| s + ";")
 }
 
 pub(crate) fn rewrite_associated_impl_type(
@@ -1877,7 +1903,7 @@ fn get_missing_arg_comments(
     (comment_before_colon, comment_after_colon)
 }
 
-impl Rewrite for ast::Arg {
+impl Rewrite for ast::Param {
     fn rewrite(&self, context: &RewriteContext<'_>, shape: Shape) -> Option<String> {
         if let Some(ref explicit_self) = self.to_self() {
             rewrite_explicit_self(context, explicit_self)
@@ -1941,7 +1967,7 @@ fn rewrite_explicit_self(
     }
 }
 
-pub(crate) fn span_lo_for_arg(arg: &ast::Arg) -> BytePos {
+pub(crate) fn span_lo_for_arg(arg: &ast::Param) -> BytePos {
     if is_named_arg(arg) {
         arg.pat.span.lo()
     } else {
@@ -1949,7 +1975,7 @@ pub(crate) fn span_lo_for_arg(arg: &ast::Arg) -> BytePos {
     }
 }
 
-pub(crate) fn span_hi_for_arg(context: &RewriteContext<'_>, arg: &ast::Arg) -> BytePos {
+pub(crate) fn span_hi_for_arg(context: &RewriteContext<'_>, arg: &ast::Param) -> BytePos {
     match arg.ty.node {
         ast::TyKind::Infer if context.snippet(arg.ty.span) == "_" => arg.ty.span.hi(),
         ast::TyKind::Infer if is_named_arg(arg) => arg.pat.span.hi(),
@@ -1957,7 +1983,7 @@ pub(crate) fn span_hi_for_arg(context: &RewriteContext<'_>, arg: &ast::Arg) -> B
     }
 }
 
-pub(crate) fn is_named_arg(arg: &ast::Arg) -> bool {
+pub(crate) fn is_named_arg(arg: &ast::Param) -> bool {
     if let ast::PatKind::Ident(_, ident, _) = arg.pat.node {
         ident.name != symbol::kw::Invalid
     } else {
@@ -2349,7 +2375,7 @@ impl WhereClauseOption {
 
 fn rewrite_args(
     context: &RewriteContext<'_>,
-    args: &[ast::Arg],
+    args: &[ast::Param],
     one_line_budget: usize,
     multi_line_budget: usize,
     indent: Indent,
diff --git a/src/macros.rs b/src/macros.rs
index dfc27c5fa5a..08f83b7e826 100644
--- a/src/macros.rs
+++ b/src/macros.rs
@@ -199,7 +199,7 @@ pub(crate) fn rewrite_macro(
 ) -> Option<String> {
     let should_skip = context
         .skip_context
-        .skip_macro(&context.snippet(mac.node.path.span).to_owned());
+        .skip_macro(&context.snippet(mac.path.span).to_owned());
     if should_skip {
         None
     } else {
@@ -235,7 +235,7 @@ fn check_keyword<'a, 'b: 'a>(parser: &'a mut Parser<'b>) -> Option<MacroArg> {
         {
             parser.bump();
             let macro_arg =
-                MacroArg::Keyword(ast::Ident::with_empty_ctxt(keyword), parser.prev_span);
+                MacroArg::Keyword(ast::Ident::with_dummy_span(keyword), parser.prev_span);
             return Some(macro_arg);
         }
     }
@@ -259,7 +259,7 @@ fn rewrite_macro_inner(
 
     let original_style = macro_style(mac, context);
 
-    let macro_name = rewrite_macro_name(context, &mac.node.path, extra_ident);
+    let macro_name = rewrite_macro_name(context, &mac.path, extra_ident);
 
     let style = if FORCED_BRACKET_MACROS.contains(&&macro_name[..]) && !is_nested_macro {
         DelimToken::Bracket
@@ -267,7 +267,7 @@ fn rewrite_macro_inner(
         original_style
     };
 
-    let ts: TokenStream = mac.node.stream();
+    let ts: TokenStream = mac.stream();
     let has_comment = contains_comment(context.snippet(mac.span));
     if ts.is_empty() && !has_comment {
         return match style {
@@ -1190,8 +1190,8 @@ fn next_space(tok: &TokenKind) -> SpaceState {
 /// when the macro is not an instance of `try!` (or parsing the inner expression
 /// failed).
 pub(crate) fn convert_try_mac(mac: &ast::Mac, context: &RewriteContext<'_>) -> Option<ast::Expr> {
-    if &mac.node.path.to_string() == "try" {
-        let ts: TokenStream = mac.node.tts.clone();
+    if &mac.path.to_string() == "try" {
+        let ts: TokenStream = mac.tts.clone();
         let mut parser = new_parser_from_tts(context.parse_session, ts.trees().collect());
 
         Some(ast::Expr {
@@ -1532,7 +1532,7 @@ fn rewrite_macro_with_items(
     Some(result)
 }
 
-const RUST_KW: [Symbol; 60] = [
+const RUST_KW: [Symbol; 59] = [
     kw::PathRoot,
     kw::DollarCrate,
     kw::Underscore,
@@ -1591,6 +1591,5 @@ const RUST_KW: [Symbol; 60] = [
     kw::Auto,
     kw::Catch,
     kw::Default,
-    kw::Existential,
     kw::Union,
 ];
diff --git a/src/modules.rs b/src/modules.rs
index 655d17d47a0..0c1ea008f68 100644
--- a/src/modules.rs
+++ b/src/modules.rs
@@ -442,7 +442,7 @@ fn parse_inner_attributes<'a>(parser: &mut parser::Parser<'a>) -> PResult<'a, Ve
             }
             TokenKind::DocComment(s) => {
                 // we need to get the position of this token before we bump.
-                let attr = attr::mk_sugared_doc_attr(attr::mk_attr_id(), s, parser.token.span);
+                let attr = attr::mk_sugared_doc_attr(s, parser.token.span);
                 if attr.style == ast::AttrStyle::Inner {
                     attrs.push(attr);
                     parser.bump();
@@ -478,7 +478,7 @@ fn parse_mod_items<'a>(parser: &mut parser::Parser<'a>, inner_lo: Span) -> PResu
 fn is_cfg_if(item: &ast::Item) -> bool {
     match item.node {
         ast::ItemKind::Mac(ref mac) => {
-            if let Some(first_segment) = mac.node.path.segments.first() {
+            if let Some(first_segment) = mac.path.segments.first() {
                 if first_segment.ident.name == Symbol::intern("cfg_if") {
                     return true;
                 }
diff --git a/src/modules/visitor.rs b/src/modules/visitor.rs
index 48b56d4d102..34b7e346334 100644
--- a/src/modules/visitor.rs
+++ b/src/modules/visitor.rs
@@ -54,7 +54,7 @@ impl<'a, 'ast: 'a> CfgIfVisitor<'a> {
         // extern crate cfg_if;
         // cfg_if! {..}
         // ```
-        match mac.node.path.segments.first() {
+        match mac.path.segments.first() {
             Some(first_segment) => {
                 if first_segment.ident.name != Symbol::intern("cfg_if") {
                     return Err("Expected cfg_if");
@@ -65,11 +65,8 @@ impl<'a, 'ast: 'a> CfgIfVisitor<'a> {
             }
         };
 
-        let mut parser = stream_to_parser_with_base_dir(
-            self.parse_sess,
-            mac.node.tts.clone(),
-            self.base_dir.clone(),
-        );
+        let mut parser =
+            stream_to_parser_with_base_dir(self.parse_sess, mac.tts.clone(), self.base_dir.clone());
         parser.cfg_mods = false;
         let mut process_if_cfg = true;
 
diff --git a/src/patterns.rs b/src/patterns.rs
index a0493be0f1c..96d45c6ac55 100644
--- a/src/patterns.rs
+++ b/src/patterns.rs
@@ -1,13 +1,13 @@
 use syntax::ast::{self, BindingMode, FieldPat, Pat, PatKind, RangeEnd, RangeSyntax};
 use syntax::ptr;
-use syntax::source_map::{self, BytePos, Span};
+use syntax::source_map::{BytePos, Span};
 
 use crate::comment::{combine_strs_with_missing_comments, FindUncommented};
 use crate::config::lists::*;
 use crate::expr::{can_be_overflowed_expr, rewrite_unary_prefix, wrap_struct_field};
 use crate::lists::{
-    itemize_list, shape_for_tactic, struct_lit_formatting, struct_lit_shape, struct_lit_tactic,
-    write_list,
+    definitive_tactic, itemize_list, shape_for_tactic, struct_lit_formatting, struct_lit_shape,
+    struct_lit_tactic, write_list, ListFormatting, Separator,
 };
 use crate::macros::{rewrite_macro, MacroPosition};
 use crate::overflow;
@@ -51,12 +51,39 @@ fn is_short_pattern_inner(pat: &ast::Pat) -> bool {
         ast::PatKind::Box(ref p) | ast::PatKind::Ref(ref p, _) | ast::PatKind::Paren(ref p) => {
             is_short_pattern_inner(&*p)
         }
+        PatKind::Or(ref pats) => pats.iter().all(|p| is_short_pattern_inner(p)),
     }
 }
 
 impl Rewrite for Pat {
     fn rewrite(&self, context: &RewriteContext<'_>, shape: Shape) -> Option<String> {
         match self.node {
+            PatKind::Or(ref pats) => {
+                let pat_items = itemize_list(
+                    context.snippet_provider,
+                    pats.iter(),
+                    "",
+                    "|",
+                    |pat| pat.span().lo(),
+                    |pat| pat.span().hi(),
+                    |pat| pat.rewrite(context, shape),
+                    self.span.lo(),
+                    self.span.hi(),
+                    false,
+                );
+                let pat_vec: Vec<_> = pat_items.collect();
+                let tactic = definitive_tactic(
+                    &pat_vec,
+                    ListTactic::HorizontalVertical,
+                    Separator::VerticalBar,
+                    shape.width,
+                );
+                let fmt = ListFormatting::new(shape, context.config)
+                    .tactic(tactic)
+                    .trailing_separator(SeparatorTactic::Never)
+                    .separator(" |");
+                write_list(&pat_vec, &fmt)
+            }
             PatKind::Box(ref pat) => rewrite_unary_prefix(context, "box ", &**pat, shape),
             PatKind::Ident(binding_mode, ident, ref sub_pat) => {
                 let (prefix, mutability) = match binding_mode {
@@ -154,7 +181,7 @@ impl Rewrite for Pat {
 
 fn rewrite_struct_pat(
     path: &ast::Path,
-    fields: &[source_map::Spanned<ast::FieldPat>],
+    fields: &[ast::FieldPat],
     ellipsis: bool,
     span: Span,
     context: &RewriteContext<'_>,
@@ -180,14 +207,14 @@ fn rewrite_struct_pat(
         terminator,
         ",",
         |f| {
-            if f.node.attrs.is_empty() {
+            if f.attrs.is_empty() {
                 f.span.lo()
             } else {
-                f.node.attrs.first().unwrap().span.lo()
+                f.attrs.first().unwrap().span.lo()
             }
         },
         |f| f.span.hi(),
-        |f| f.node.rewrite(context, v_shape),
+        |f| f.rewrite(context, v_shape),
         context.snippet_provider.span_after(span, "{"),
         span.hi(),
         false,
diff --git a/src/spanned.rs b/src/spanned.rs
index 00dd24a0f06..bbdee6ccf4b 100644
--- a/src/spanned.rs
+++ b/src/spanned.rs
@@ -104,7 +104,7 @@ impl Spanned for ast::Arm {
     }
 }
 
-impl Spanned for ast::Arg {
+impl Spanned for ast::Param {
     fn span(&self) -> Span {
         if crate::items::is_named_arg(self) {
             mk_sp(self.pat.span.lo(), self.ty.span.hi())
diff --git a/src/utils.rs b/src/utils.rs
index 498608d4179..5b0d94e4780 100644
--- a/src/utils.rs
+++ b/src/utils.rs
@@ -8,7 +8,7 @@ use syntax::ast::{
     VisibilityKind,
 };
 use syntax::ptr;
-use syntax::source_map::{BytePos, Span, NO_EXPANSION};
+use syntax::source_map::{BytePos, Span, SyntaxContext};
 use syntax::symbol::{sym, Symbol};
 use syntax_pos::ExpnId;
 use unicode_width::UnicodeWidthStr;
@@ -335,7 +335,7 @@ macro_rules! source {
 }
 
 pub(crate) fn mk_sp(lo: BytePos, hi: BytePos) -> Span {
-    Span::new(lo, hi, NO_EXPANSION)
+    Span::new(lo, hi, SyntaxContext::root())
 }
 
 // Returns `true` if the given span does not intersect with file lines.
diff --git a/src/visitor.rs b/src/visitor.rs
index dec39489a5e..831fd56819f 100644
--- a/src/visitor.rs
+++ b/src/visitor.rs
@@ -11,8 +11,8 @@ use crate::config::{BraceStyle, Config};
 use crate::coverage::transform_missing_snippet;
 use crate::items::{
     format_impl, format_trait, format_trait_alias, is_mod_decl, is_use_item,
-    rewrite_associated_impl_type, rewrite_associated_type, rewrite_existential_impl_type,
-    rewrite_existential_type, rewrite_extern_crate, rewrite_type_alias, FnBraceStyle, FnSig,
+    rewrite_associated_impl_type, rewrite_associated_type, rewrite_extern_crate,
+    rewrite_opaque_impl_type, rewrite_opaque_type, rewrite_type_alias, FnBraceStyle, FnSig,
     StaticParts, StructParts,
 };
 use crate::macros::{rewrite_macro, rewrite_macro_def, MacroPosition};
@@ -97,11 +97,20 @@ impl<'b, 'a: 'b> FmtVisitor<'a> {
 
     fn visit_stmt(&mut self, stmt: &Stmt<'_>) {
         debug!(
-            "visit_stmt: {:?} {:?}",
+            "visit_stmt: {:?} {:?} `{}`",
             self.source_map.lookup_char_pos(stmt.span().lo()),
-            self.source_map.lookup_char_pos(stmt.span().hi())
+            self.source_map.lookup_char_pos(stmt.span().hi()),
+            self.snippet(stmt.span()),
         );
 
+        // https://github.com/rust-lang/rust/issues/63679.
+        let is_all_semicolons =
+            |snippet: &str| snippet.chars().all(|c| c.is_whitespace() || c == ';');
+        if is_all_semicolons(&self.snippet(stmt.span())) {
+            self.last_pos = stmt.span().hi();
+            return;
+        }
+
         match stmt.as_ast_node().node {
             ast::StmtKind::Item(ref item) => {
                 self.visit_item(item);
@@ -468,7 +477,7 @@ impl<'b, 'a: 'b> FmtVisitor<'a> {
                         Some(&inner_attrs),
                     )
                 }
-                ast::ItemKind::Ty(ref ty, ref generics) => {
+                ast::ItemKind::TyAlias(ref ty, ref generics) => {
                     let rewrite = rewrite_type_alias(
                         &self.get_context(),
                         self.block_indent,
@@ -479,8 +488,8 @@ impl<'b, 'a: 'b> FmtVisitor<'a> {
                     );
                     self.push_rewrite(item.span, rewrite);
                 }
-                ast::ItemKind::Existential(ref generic_bounds, ref generics) => {
-                    let rewrite = rewrite_existential_type(
+                ast::ItemKind::OpaqueTy(ref generic_bounds, ref generics) => {
+                    let rewrite = rewrite_opaque_type(
                         &self.get_context(),
                         self.block_indent,
                         item.ident,
@@ -576,7 +585,7 @@ impl<'b, 'a: 'b> FmtVisitor<'a> {
                 );
             }
             ast::ImplItemKind::Const(..) => self.visit_static(&StaticParts::from_impl_item(ii)),
-            ast::ImplItemKind::Type(ref ty) => {
+            ast::ImplItemKind::TyAlias(ref ty) => {
                 let rewrite = rewrite_associated_impl_type(
                     ii.ident,
                     ii.defaultness,
@@ -587,8 +596,8 @@ impl<'b, 'a: 'b> FmtVisitor<'a> {
                 );
                 self.push_rewrite(ii.span, rewrite);
             }
-            ast::ImplItemKind::Existential(ref generic_bounds) => {
-                let rewrite = rewrite_existential_impl_type(
+            ast::ImplItemKind::OpaqueTy(ref generic_bounds) => {
+                let rewrite = rewrite_opaque_impl_type(
                     &self.get_context(),
                     ii.ident,
                     &ii.generics,