about summary refs log tree commit diff
diff options
context:
space:
mode:
authorVadim Petrochenkov <vadim.petrochenkov@gmail.com>2019-06-19 01:08:45 +0300
committerVadim Petrochenkov <vadim.petrochenkov@gmail.com>2019-07-11 00:12:07 +0300
commit16918a8e28d4e7a476f31ff3d3c1e2d998c086af (patch)
treedfb8cbb1c6f60085551a0dd32c57fda7b56c8396
parentec376c783e3a64445c4b55fb5980ae922319a916 (diff)
downloadrust-16918a8e28d4e7a476f31ff3d3c1e2d998c086af.tar.gz
rust-16918a8e28d4e7a476f31ff3d3c1e2d998c086af.zip
Rename some things in `syntax_pos/hygiene`
More consistent with other naming:
ExpnFormat -> ExpnKind
ExpnKind::name -> ExpnKind::descr
DesugaringKind::name -> DesugaringKind::descr

Shorter, no tautology:
CompilerDesugaring -> Desugaring
CompilerDesugaringKind -> DesugaringKind
-rw-r--r--src/librustc/hir/lowering.rs35
-rw-r--r--src/librustc/ich/impls_syntax.rs8
-rw-r--r--src/librustc/infer/error_reporting/need_type_info.rs6
-rw-r--r--src/librustc/lint/internal.rs4
-rw-r--r--src/librustc/lint/mod.rs16
-rw-r--r--src/librustc/mir/mod.rs2
-rw-r--r--src/librustc/traits/error_reporting.rs8
-rw-r--r--src/librustc_allocator/expand.rs5
-rw-r--r--src/librustc_borrowck/borrowck/mod.rs6
-rw-r--r--src/librustc_mir/borrow_check/conflict_errors.rs4
-rw-r--r--src/librustc_mir/borrow_check/mod.rs2
-rw-r--r--src/librustc_save_analysis/lib.rs5
-rw-r--r--src/librustc_typeck/check/_match.rs4
-rw-r--r--src/librustc_typeck/check/mod.rs4
-rw-r--r--src/libsyntax/ext/base.rs14
-rw-r--r--src/libsyntax/ext/derive.rs4
-rw-r--r--src/libsyntax/ext/expand.rs2
-rw-r--r--src/libsyntax/source_map.rs4
-rw-r--r--src/libsyntax/std_inject.rs4
-rw-r--r--src/libsyntax/test.rs4
-rw-r--r--src/libsyntax_ext/proc_macro_decls.rs4
-rw-r--r--src/libsyntax_ext/test.rs4
-rw-r--r--src/libsyntax_ext/test_case.rs4
-rw-r--r--src/libsyntax_pos/hygiene.rs44
-rw-r--r--src/libsyntax_pos/lib.rs24
25 files changed, 111 insertions, 110 deletions
diff --git a/src/librustc/hir/lowering.rs b/src/librustc/hir/lowering.rs
index 2a9fd58f84b..549c34d961a 100644
--- a/src/librustc/hir/lowering.rs
+++ b/src/librustc/hir/lowering.rs
@@ -62,8 +62,7 @@ use syntax::ast::*;
 use syntax::errors;
 use syntax::ext::hygiene::{Mark, SyntaxContext};
 use syntax::print::pprust;
-use syntax::source_map::{self, respan, ExpnInfo, CompilerDesugaringKind, Spanned};
-use syntax::source_map::CompilerDesugaringKind::CondTemporary;
+use syntax::source_map::{respan, ExpnInfo, ExpnKind, DesugaringKind, Spanned};
 use syntax::std_inject;
 use syntax::symbol::{kw, sym, Symbol};
 use syntax::tokenstream::{TokenStream, TokenTree};
@@ -872,7 +871,7 @@ impl<'a> LoweringContext<'a> {
     /// allowed inside this span.
     fn mark_span_with_reason(
         &self,
-        reason: CompilerDesugaringKind,
+        reason: DesugaringKind,
         span: Span,
         allow_internal_unstable: Option<Lrc<[Symbol]>>,
     ) -> Span {
@@ -880,7 +879,7 @@ impl<'a> LoweringContext<'a> {
         mark.set_expn_info(ExpnInfo {
             def_site: Some(span),
             allow_internal_unstable,
-            ..ExpnInfo::default(source_map::CompilerDesugaring(reason), span, self.sess.edition())
+            ..ExpnInfo::default(ExpnKind::Desugaring(reason), span, self.sess.edition())
         });
         span.with_ctxt(SyntaxContext::empty().apply_mark(mark))
     }
@@ -1188,7 +1187,7 @@ impl<'a> LoweringContext<'a> {
         };
 
         let unstable_span = self.mark_span_with_reason(
-            CompilerDesugaringKind::Async,
+            DesugaringKind::Async,
             span,
             self.allow_gen_future.clone(),
         );
@@ -1733,7 +1732,7 @@ impl<'a> LoweringContext<'a> {
         // Not tracking it makes lints in rustc and clippy very fragile, as
         // frequently opened issues show.
         let exist_ty_span = self.mark_span_with_reason(
-            CompilerDesugaringKind::ExistentialType,
+            DesugaringKind::ExistentialType,
             span,
             None,
         );
@@ -2603,7 +2602,7 @@ impl<'a> LoweringContext<'a> {
         let span = output.span();
 
         let exist_ty_span = self.mark_span_with_reason(
-            CompilerDesugaringKind::Async,
+            DesugaringKind::Async,
             span,
             None,
         );
@@ -3275,7 +3274,7 @@ impl<'a> LoweringContext<'a> {
                 };
 
                 let desugared_span =
-                    this.mark_span_with_reason(CompilerDesugaringKind::Async, span, None);
+                    this.mark_span_with_reason(DesugaringKind::Async, span, None);
 
                 // Construct an argument representing `__argN: <ty>` to replace the argument of the
                 // async function.
@@ -4410,7 +4409,9 @@ impl<'a> LoweringContext<'a> {
                     _ => {
                         // Lower condition:
                         let cond = self.lower_expr(cond);
-                        let span_block = self.mark_span_with_reason(CondTemporary, cond.span, None);
+                        let span_block = self.mark_span_with_reason(
+                            DesugaringKind::CondTemporary, cond.span, None
+                        );
                         // Wrap in a construct equivalent to `{ let _t = $cond; _t }`
                         // to preserve drop semantics since `if cond { ... }` does not
                         // let temporaries live outside of `cond`.
@@ -4469,7 +4470,9 @@ impl<'a> LoweringContext<'a> {
 
                         // Lower condition:
                         let cond = this.with_loop_condition_scope(|this| this.lower_expr(cond));
-                        let span_block = this.mark_span_with_reason(CondTemporary, cond.span, None);
+                        let span_block = this.mark_span_with_reason(
+                            DesugaringKind::CondTemporary, cond.span, None
+                        );
                         // Wrap in a construct equivalent to `{ let _t = $cond; _t }`
                         // to preserve drop semantics since `while cond { ... }` does not
                         // let temporaries live outside of `cond`.
@@ -4508,7 +4511,7 @@ impl<'a> LoweringContext<'a> {
             ExprKind::TryBlock(ref body) => {
                 self.with_catch_scope(body.id, |this| {
                     let unstable_span = this.mark_span_with_reason(
-                        CompilerDesugaringKind::TryBlock,
+                        DesugaringKind::TryBlock,
                         body.span,
                         this.allow_try_trait.clone(),
                     );
@@ -4836,7 +4839,7 @@ impl<'a> LoweringContext<'a> {
                 let mut head = self.lower_expr(head);
                 let head_sp = head.span;
                 let desugared_span = self.mark_span_with_reason(
-                    CompilerDesugaringKind::ForLoop,
+                    DesugaringKind::ForLoop,
                     head_sp,
                     None,
                 );
@@ -4990,13 +4993,13 @@ impl<'a> LoweringContext<'a> {
                 // }
 
                 let unstable_span = self.mark_span_with_reason(
-                    CompilerDesugaringKind::QuestionMark,
+                    DesugaringKind::QuestionMark,
                     e.span,
                     self.allow_try_trait.clone(),
                 );
                 let try_span = self.sess.source_map().end_point(e.span);
                 let try_span = self.mark_span_with_reason(
-                    CompilerDesugaringKind::QuestionMark,
+                    DesugaringKind::QuestionMark,
                     try_span,
                     self.allow_try_trait.clone(),
                 );
@@ -5811,12 +5814,12 @@ impl<'a> LoweringContext<'a> {
             }
         }
         let span = self.mark_span_with_reason(
-            CompilerDesugaringKind::Await,
+            DesugaringKind::Await,
             await_span,
             None,
         );
         let gen_future_span = self.mark_span_with_reason(
-            CompilerDesugaringKind::Await,
+            DesugaringKind::Await,
             await_span,
             self.allow_gen_future.clone(),
         );
diff --git a/src/librustc/ich/impls_syntax.rs b/src/librustc/ich/impls_syntax.rs
index c09b2003f38..f679a65c642 100644
--- a/src/librustc/ich/impls_syntax.rs
+++ b/src/librustc/ich/impls_syntax.rs
@@ -398,7 +398,7 @@ impl_stable_hash_for!(enum ::syntax_pos::hygiene::Transparency {
 
 impl_stable_hash_for!(struct ::syntax_pos::hygiene::ExpnInfo {
     call_site,
-    format,
+    kind,
     def_site,
     default_transparency,
     allow_internal_unstable,
@@ -407,13 +407,13 @@ impl_stable_hash_for!(struct ::syntax_pos::hygiene::ExpnInfo {
     edition
 });
 
-impl_stable_hash_for!(enum ::syntax_pos::hygiene::ExpnFormat {
+impl_stable_hash_for!(enum ::syntax_pos::hygiene::ExpnKind {
     MacroAttribute(sym),
     MacroBang(sym),
-    CompilerDesugaring(kind)
+    Desugaring(kind)
 });
 
-impl_stable_hash_for!(enum ::syntax_pos::hygiene::CompilerDesugaringKind {
+impl_stable_hash_for!(enum ::syntax_pos::hygiene::DesugaringKind {
     CondTemporary,
     Async,
     Await,
diff --git a/src/librustc/infer/error_reporting/need_type_info.rs b/src/librustc/infer/error_reporting/need_type_info.rs
index 4426b5c0e85..770d5155777 100644
--- a/src/librustc/infer/error_reporting/need_type_info.rs
+++ b/src/librustc/infer/error_reporting/need_type_info.rs
@@ -5,7 +5,7 @@ use crate::infer::InferCtxt;
 use crate::infer::type_variable::TypeVariableOriginKind;
 use crate::ty::{self, Ty, Infer, TyVar};
 use crate::ty::print::Print;
-use syntax::source_map::CompilerDesugaringKind;
+use syntax::source_map::DesugaringKind;
 use syntax_pos::Span;
 use errors::DiagnosticBuilder;
 
@@ -194,12 +194,12 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
             ));
         } else if let Some(pattern) = local_visitor.found_local_pattern {
             if let Some(simple_ident) = pattern.simple_ident() {
-                match pattern.span.compiler_desugaring_kind() {
+                match pattern.span.desugaring_kind() {
                     None => labels.push((
                         pattern.span,
                         format!("consider giving `{}` {}", simple_ident, suffix),
                     )),
-                    Some(CompilerDesugaringKind::ForLoop) => labels.push((
+                    Some(DesugaringKind::ForLoop) => labels.push((
                         pattern.span,
                         "the element type for this iterator is not specified".to_owned(),
                     )),
diff --git a/src/librustc/lint/internal.rs b/src/librustc/lint/internal.rs
index 34899736949..0b514f5927d 100644
--- a/src/librustc/lint/internal.rs
+++ b/src/librustc/lint/internal.rs
@@ -247,10 +247,10 @@ impl EarlyLintPass for LintPassImpl {
 }
 
 fn is_lint_pass_expansion(expn_info: &ExpnInfo) -> bool {
-    if expn_info.format.name() == sym::impl_lint_pass {
+    if expn_info.kind.descr() == sym::impl_lint_pass {
         true
     } else if let Some(info) = expn_info.call_site.ctxt().outer_expn_info() {
-        info.format.name() == sym::declare_lint_pass
+        info.kind.descr() == sym::declare_lint_pass
     } else {
         false
     }
diff --git a/src/librustc/lint/mod.rs b/src/librustc/lint/mod.rs
index 59b08b832d2..2bf4f1d3cfb 100644
--- a/src/librustc/lint/mod.rs
+++ b/src/librustc/lint/mod.rs
@@ -35,7 +35,7 @@ use crate::util::nodemap::NodeMap;
 use errors::{DiagnosticBuilder, DiagnosticId};
 use std::{hash, ptr};
 use syntax::ast;
-use syntax::source_map::{MultiSpan, ExpnFormat, CompilerDesugaringKind};
+use syntax::source_map::{MultiSpan, ExpnKind, DesugaringKind};
 use syntax::early_buffered_lints::BufferedEarlyLintId;
 use syntax::edition::Edition;
 use syntax::symbol::{Symbol, sym};
@@ -883,11 +883,11 @@ pub fn in_external_macro(sess: &Session, span: Span) -> bool {
         None => return false,
     };
 
-    match info.format {
-        ExpnFormat::MacroAttribute(..) => true, // definitely a plugin
-        ExpnFormat::CompilerDesugaring(CompilerDesugaringKind::ForLoop) => false,
-        ExpnFormat::CompilerDesugaring(_) => true, // well, it's "external"
-        ExpnFormat::MacroBang(..) => {
+    match info.kind {
+        ExpnKind::MacroAttribute(..) => true, // definitely a plugin
+        ExpnKind::Desugaring(DesugaringKind::ForLoop) => false,
+        ExpnKind::Desugaring(_) => true, // well, it's "external"
+        ExpnKind::MacroBang(..) => {
             let def_site = match info.def_site {
                 Some(span) => span,
                 // no span for the def_site means it's an external macro
@@ -911,8 +911,8 @@ pub fn in_derive_expansion(span: Span) -> bool {
         None => return false,
     };
 
-    match info.format {
-        ExpnFormat::MacroAttribute(symbol) => symbol.as_str().starts_with("derive("),
+    match info.kind {
+        ExpnKind::MacroAttribute(symbol) => symbol.as_str().starts_with("derive("),
         _ => false,
     }
 }
diff --git a/src/librustc/mir/mod.rs b/src/librustc/mir/mod.rs
index 59a032d53cf..ff868bf2a2a 100644
--- a/src/librustc/mir/mod.rs
+++ b/src/librustc/mir/mod.rs
@@ -928,7 +928,7 @@ impl<'tcx> LocalDecl<'tcx> {
     /// `__next` from a `for` loop.
     #[inline]
     pub fn from_compiler_desugaring(&self) -> bool {
-        self.source_info.span.compiler_desugaring_kind().is_some()
+        self.source_info.span.desugaring_kind().is_some()
     }
 
     /// Creates a new `LocalDecl` for a temporary.
diff --git a/src/librustc/traits/error_reporting.rs b/src/librustc/traits/error_reporting.rs
index d6cc68bcdab..fb7ed147445 100644
--- a/src/librustc/traits/error_reporting.rs
+++ b/src/librustc/traits/error_reporting.rs
@@ -36,7 +36,7 @@ use errors::{Applicability, DiagnosticBuilder};
 use std::fmt;
 use syntax::ast;
 use syntax::symbol::sym;
-use syntax_pos::{DUMMY_SP, Span, ExpnInfo, ExpnFormat};
+use syntax_pos::{DUMMY_SP, Span, ExpnInfo, ExpnKind};
 
 impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
     pub fn report_fulfillment_errors(&self,
@@ -62,7 +62,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
             // if one is the result of a desugaring and the other is not.
             let mut span = error.obligation.cause.span;
             if let Some(ExpnInfo {
-                format: ExpnFormat::CompilerDesugaring(_),
+                kind: ExpnKind::Desugaring(_),
                 def_site: Some(def_span),
                 ..
             }) = span.ctxt().outer_expn_info() {
@@ -373,9 +373,9 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
             flags.push((sym::parent_trait, Some(t)));
         }
 
-        if let Some(k) = obligation.cause.span.compiler_desugaring_kind() {
+        if let Some(k) = obligation.cause.span.desugaring_kind() {
             flags.push((sym::from_desugaring, None));
-            flags.push((sym::from_desugaring, Some(k.name().to_string())));
+            flags.push((sym::from_desugaring, Some(k.descr().to_string())));
         }
         let generics = self.tcx.generics_of(def_id);
         let self_ty = trait_ref.self_ty();
diff --git a/src/librustc_allocator/expand.rs b/src/librustc_allocator/expand.rs
index d402b0ddf6e..18bbb257128 100644
--- a/src/librustc_allocator/expand.rs
+++ b/src/librustc_allocator/expand.rs
@@ -8,7 +8,7 @@ use syntax::{
     },
     attr,
     source_map::{
-        respan, ExpnInfo, MacroAttribute,
+        respan, ExpnInfo, ExpnKind,
     },
     ext::{
         base::{ExtCtxt, Resolver},
@@ -87,7 +87,8 @@ impl MutVisitor for ExpandAllocatorDirectives<'_> {
         // Create a fresh Mark for the new macro expansion we are about to do
         let mark = Mark::fresh(Mark::root());
         mark.set_expn_info(ExpnInfo::with_unstable(
-            MacroAttribute(sym::global_allocator), item.span, self.sess.edition, &[sym::rustc_attrs]
+            ExpnKind::MacroAttribute(sym::global_allocator), item.span, self.sess.edition,
+            &[sym::rustc_attrs],
         ));
 
         // Tie the span to the macro expansion info we just created
diff --git a/src/librustc_borrowck/borrowck/mod.rs b/src/librustc_borrowck/borrowck/mod.rs
index 34db080ef66..9a581cb03ec 100644
--- a/src/librustc_borrowck/borrowck/mod.rs
+++ b/src/librustc_borrowck/borrowck/mod.rs
@@ -33,7 +33,7 @@ use std::cell::{Cell, RefCell};
 use std::fmt;
 use std::rc::Rc;
 use std::hash::{Hash, Hasher};
-use syntax::source_map::CompilerDesugaringKind;
+use syntax::source_map::DesugaringKind;
 use syntax_pos::{MultiSpan, Span};
 use errors::{Applicability, DiagnosticBuilder, DiagnosticId};
 use log::debug;
@@ -734,8 +734,8 @@ impl BorrowckCtxt<'_, 'tcx> {
                 },
                 moved_lp.ty));
         }
-        if let (Some(CompilerDesugaringKind::ForLoop), Ok(snippet)) = (
-            move_span.compiler_desugaring_kind(),
+        if let (Some(DesugaringKind::ForLoop), Ok(snippet)) = (
+            move_span.desugaring_kind(),
             self.tcx.sess.source_map().span_to_snippet(move_span),
          ) {
             if !snippet.starts_with("&") {
diff --git a/src/librustc_mir/borrow_check/conflict_errors.rs b/src/librustc_mir/borrow_check/conflict_errors.rs
index f23cffeda68..7b5fce4abbc 100644
--- a/src/librustc_mir/borrow_check/conflict_errors.rs
+++ b/src/librustc_mir/borrow_check/conflict_errors.rs
@@ -10,7 +10,7 @@ use rustc_data_structures::fx::FxHashSet;
 use rustc_data_structures::indexed_vec::Idx;
 use rustc_errors::{Applicability, DiagnosticBuilder};
 use syntax_pos::Span;
-use syntax::source_map::CompilerDesugaringKind;
+use syntax::source_map::DesugaringKind;
 
 use super::nll::explain_borrow::BorrowExplanation;
 use super::nll::region_infer::{RegionName, RegionNameSource};
@@ -174,7 +174,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
                         format!("variable moved due to use{}", move_spans.describe()),
                     );
                 }
-                if Some(CompilerDesugaringKind::ForLoop) == move_span.compiler_desugaring_kind() {
+                if Some(DesugaringKind::ForLoop) == move_span.desugaring_kind() {
                     if let Ok(snippet) = self.infcx.tcx.sess.source_map().span_to_snippet(span) {
                         err.span_suggestion(
                             move_span,
diff --git a/src/librustc_mir/borrow_check/mod.rs b/src/librustc_mir/borrow_check/mod.rs
index 25ac93cc242..31a9766af30 100644
--- a/src/librustc_mir/borrow_check/mod.rs
+++ b/src/librustc_mir/borrow_check/mod.rs
@@ -335,7 +335,7 @@ fn do_mir_borrowck<'a, 'tcx>(
             }
 
             let span = local_decl.source_info.span;
-            if span.compiler_desugaring_kind().is_some() {
+            if span.desugaring_kind().is_some() {
                 // If the `mut` arises as part of a desugaring, we should ignore it.
                 continue;
             }
diff --git a/src/librustc_save_analysis/lib.rs b/src/librustc_save_analysis/lib.rs
index effd69dc61d..fab2537f9d8 100644
--- a/src/librustc_save_analysis/lib.rs
+++ b/src/librustc_save_analysis/lib.rs
@@ -37,7 +37,6 @@ use syntax::parse::lexer::comments::strip_doc_comment_decoration;
 use syntax::print::pprust;
 use syntax::visit::{self, Visitor};
 use syntax::print::pprust::{arg_to_string, ty_to_string};
-use syntax::source_map::MacroAttribute;
 use syntax_pos::*;
 
 use json_dumper::JsonDumper;
@@ -845,7 +844,7 @@ impl<'l, 'tcx> SaveContext<'l, 'tcx> {
         let callee_span = callee.def_site?;
 
         // Ignore attribute macros, their spans are usually mangled
-        if let MacroAttribute(_) = callee.format {
+        if let ExpnKind::MacroAttribute(_) = callee.kind {
             return None;
         }
 
@@ -870,7 +869,7 @@ impl<'l, 'tcx> SaveContext<'l, 'tcx> {
         let callee_span = self.span_from_span(callee_span);
         Some(MacroRef {
             span: callsite_span,
-            qualname: callee.format.name().to_string(), // FIXME: generate the real qualname
+            qualname: callee.kind.descr().to_string(), // FIXME: generate the real qualname
             callee_span,
         })
     }
diff --git a/src/librustc_typeck/check/_match.rs b/src/librustc_typeck/check/_match.rs
index d24f92a6faf..de42a6a35c8 100644
--- a/src/librustc_typeck/check/_match.rs
+++ b/src/librustc_typeck/check/_match.rs
@@ -15,7 +15,7 @@ use syntax::ast;
 use syntax::source_map::Spanned;
 use syntax::util::lev_distance::find_best_match_for_name;
 use syntax_pos::Span;
-use syntax_pos::hygiene::CompilerDesugaringKind;
+use syntax_pos::hygiene::DesugaringKind;
 
 use std::collections::hash_map::Entry::{Occupied, Vacant};
 use std::cmp;
@@ -184,7 +184,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
                             // In the case of `if`- and `while`-expressions we've already checked
                             // that `scrutinee: bool`. We know that the pattern is `true`,
                             // so an error here would be a duplicate and from the wrong POV.
-                            s.is_compiler_desugaring(CompilerDesugaringKind::CondTemporary)
+                            s.is_desugaring(DesugaringKind::CondTemporary)
                         })
                         .is_some());
                 }
diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs
index 4acba6d38fa..d32ee67f745 100644
--- a/src/librustc_typeck/check/mod.rs
+++ b/src/librustc_typeck/check/mod.rs
@@ -119,7 +119,7 @@ use rustc::ty::subst::{UnpackedKind, Subst, InternalSubsts, SubstsRef, UserSelfT
 use rustc::ty::util::{Representability, IntTypeExt, Discr};
 use rustc::ty::layout::VariantIdx;
 use syntax_pos::{self, BytePos, Span, MultiSpan};
-use syntax_pos::hygiene::CompilerDesugaringKind;
+use syntax_pos::hygiene::DesugaringKind;
 use syntax::ast;
 use syntax::attr;
 use syntax::feature_gate::{GateIssue, emit_feature_err};
@@ -2165,7 +2165,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
             // If span arose from a desugaring of `if` or `while`, then it is the condition itself,
             // which diverges, that we are about to lint on. This gives suboptimal diagnostics.
             // Instead, stop here so that the `if`- or `while`-expression's block is linted instead.
-            !span.is_compiler_desugaring(CompilerDesugaringKind::CondTemporary) {
+            !span.is_desugaring(DesugaringKind::CondTemporary) {
             self.diverges.set(Diverges::WarnedAlways);
 
             debug!("warn_if_unreachable: id={:?} span={:?} kind={}", id, span, kind);
diff --git a/src/libsyntax/ext/base.rs b/src/libsyntax/ext/base.rs
index 09ff44115b4..0c986574cec 100644
--- a/src/libsyntax/ext/base.rs
+++ b/src/libsyntax/ext/base.rs
@@ -15,7 +15,7 @@ use crate::tokenstream::{self, TokenStream};
 use errors::{DiagnosticBuilder, DiagnosticId};
 use smallvec::{smallvec, SmallVec};
 use syntax_pos::{Span, MultiSpan, DUMMY_SP};
-use syntax_pos::hygiene::{ExpnInfo, ExpnFormat};
+use syntax_pos::hygiene::{ExpnInfo, ExpnKind};
 
 use rustc_data_structures::fx::FxHashMap;
 use rustc_data_structures::sync::{self, Lrc};
@@ -642,18 +642,18 @@ impl SyntaxExtension {
         }
     }
 
-    fn expn_format(&self, symbol: Symbol) -> ExpnFormat {
+    fn expn_kind(&self, descr: Symbol) -> ExpnKind {
         match self.kind {
             SyntaxExtensionKind::Bang(..) |
-            SyntaxExtensionKind::LegacyBang(..) => ExpnFormat::MacroBang(symbol),
-            _ => ExpnFormat::MacroAttribute(symbol),
+            SyntaxExtensionKind::LegacyBang(..) => ExpnKind::MacroBang(descr),
+            _ => ExpnKind::MacroAttribute(descr),
         }
     }
 
-    pub fn expn_info(&self, call_site: Span, format: &str) -> ExpnInfo {
+    pub fn expn_info(&self, call_site: Span, descr: &str) -> ExpnInfo {
         ExpnInfo {
             call_site,
-            format: self.expn_format(Symbol::intern(format)),
+            kind: self.expn_kind(Symbol::intern(descr)),
             def_site: Some(self.span),
             default_transparency: self.default_transparency,
             allow_internal_unstable: self.allow_internal_unstable.clone(),
@@ -780,7 +780,7 @@ impl<'a> ExtCtxt<'a> {
         let mut last_macro = None;
         loop {
             if ctxt.outer_expn_info().map_or(None, |info| {
-                if info.format.name() == sym::include {
+                if info.kind.descr() == sym::include {
                     // Stop going up the backtrace once include! is encountered
                     return None;
                 }
diff --git a/src/libsyntax/ext/derive.rs b/src/libsyntax/ext/derive.rs
index 2a56f3dd756..24050be792b 100644
--- a/src/libsyntax/ext/derive.rs
+++ b/src/libsyntax/ext/derive.rs
@@ -1,6 +1,6 @@
 use crate::attr::HasAttrs;
 use crate::ast;
-use crate::source_map::{ExpnInfo, ExpnFormat};
+use crate::source_map::{ExpnInfo, ExpnKind};
 use crate::ext::base::ExtCtxt;
 use crate::ext::build::AstBuilder;
 use crate::parse::parser::PathStyle;
@@ -57,7 +57,7 @@ pub fn add_derived_markers<T>(cx: &mut ExtCtxt<'_>, span: Span, traits: &[ast::P
     pretty_name.push(')');
 
     cx.current_expansion.mark.set_expn_info(ExpnInfo::with_unstable(
-        ExpnFormat::MacroAttribute(Symbol::intern(&pretty_name)), span, cx.parse_sess.edition,
+        ExpnKind::MacroAttribute(Symbol::intern(&pretty_name)), span, cx.parse_sess.edition,
         &[sym::rustc_attrs, sym::structural_match],
     ));
 
diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs
index 053686b8b1f..879069c1418 100644
--- a/src/libsyntax/ext/expand.rs
+++ b/src/libsyntax/ext/expand.rs
@@ -506,7 +506,7 @@ impl<'a, 'b> MacroExpander<'a, 'b> {
             let suggested_limit = self.cx.ecfg.recursion_limit * 2;
             let mut err = self.cx.struct_span_err(info.call_site,
                 &format!("recursion limit reached while expanding the macro `{}`",
-                         info.format.name()));
+                         info.kind.descr()));
             err.help(&format!(
                 "consider adding a `#![recursion_limit=\"{}\"]` attribute to your crate",
                 suggested_limit));
diff --git a/src/libsyntax/source_map.rs b/src/libsyntax/source_map.rs
index ac30cbb471a..bbf62ef1e23 100644
--- a/src/libsyntax/source_map.rs
+++ b/src/libsyntax/source_map.rs
@@ -7,10 +7,8 @@
 //! within the SourceMap, which upon request can be converted to line and column
 //! information, source code snippets, etc.
 
-
 pub use syntax_pos::*;
-pub use syntax_pos::hygiene::{ExpnFormat, ExpnInfo};
-pub use ExpnFormat::*;
+pub use syntax_pos::hygiene::{ExpnKind, ExpnInfo};
 
 use rustc_data_structures::fx::FxHashMap;
 use rustc_data_structures::stable_hasher::StableHasher;
diff --git a/src/libsyntax/std_inject.rs b/src/libsyntax/std_inject.rs
index 6630bf90815..7ee073117e9 100644
--- a/src/libsyntax/std_inject.rs
+++ b/src/libsyntax/std_inject.rs
@@ -3,7 +3,7 @@ use crate::attr;
 use crate::edition::Edition;
 use crate::ext::hygiene::{Mark, SyntaxContext};
 use crate::symbol::{Ident, Symbol, kw, sym};
-use crate::source_map::{ExpnInfo, MacroAttribute, dummy_spanned, respan};
+use crate::source_map::{ExpnInfo, ExpnKind, dummy_spanned, respan};
 use crate::ptr::P;
 use crate::tokenstream::TokenStream;
 
@@ -17,7 +17,7 @@ use syntax_pos::{DUMMY_SP, Span};
 fn ignored_span(sp: Span, edition: Edition) -> Span {
     let mark = Mark::fresh(Mark::root());
     mark.set_expn_info(ExpnInfo::with_unstable(
-        MacroAttribute(Symbol::intern("std_inject")), sp, edition, &[sym::prelude_import]
+        ExpnKind::MacroAttribute(Symbol::intern("std_inject")), sp, edition, &[sym::prelude_import]
     ));
     sp.with_ctxt(SyntaxContext::empty().apply_mark(mark))
 }
diff --git a/src/libsyntax/test.rs b/src/libsyntax/test.rs
index c717f140ca3..35a1a552a13 100644
--- a/src/libsyntax/test.rs
+++ b/src/libsyntax/test.rs
@@ -15,7 +15,7 @@ use smallvec::{smallvec, SmallVec};
 use syntax_pos::{DUMMY_SP, NO_EXPANSION, Span, SourceFile, BytePos};
 
 use crate::attr::{self, HasAttrs};
-use crate::source_map::{self, SourceMap, ExpnInfo, MacroAttribute, dummy_spanned, respan};
+use crate::source_map::{self, SourceMap, ExpnInfo, ExpnKind, dummy_spanned, respan};
 use crate::config;
 use crate::entry::{self, EntryPointType};
 use crate::ext::base::{ExtCtxt, Resolver};
@@ -280,7 +280,7 @@ fn generate_test_harness(sess: &ParseSess,
     };
 
     mark.set_expn_info(ExpnInfo::with_unstable(
-        MacroAttribute(sym::test_case), DUMMY_SP, sess.edition,
+        ExpnKind::MacroAttribute(sym::test_case), DUMMY_SP, sess.edition,
         &[sym::main, sym::test, sym::rustc_attrs],
     ));
 
diff --git a/src/libsyntax_ext/proc_macro_decls.rs b/src/libsyntax_ext/proc_macro_decls.rs
index 45e65288a24..dee8f4b3eb5 100644
--- a/src/libsyntax_ext/proc_macro_decls.rs
+++ b/src/libsyntax_ext/proc_macro_decls.rs
@@ -4,7 +4,7 @@ use crate::deriving;
 
 use syntax::ast::{self, Ident};
 use syntax::attr;
-use syntax::source_map::{ExpnInfo, MacroAttribute, respan};
+use syntax::source_map::{ExpnInfo, ExpnKind, respan};
 use syntax::ext::base::ExtCtxt;
 use syntax::ext::build::AstBuilder;
 use syntax::ext::expand::ExpansionConfig;
@@ -348,7 +348,7 @@ fn mk_decls(
 ) -> P<ast::Item> {
     let mark = Mark::fresh(Mark::root());
     mark.set_expn_info(ExpnInfo::with_unstable(
-        MacroAttribute(sym::proc_macro), DUMMY_SP, cx.parse_sess.edition,
+        ExpnKind::MacroAttribute(sym::proc_macro), DUMMY_SP, cx.parse_sess.edition,
         &[sym::rustc_attrs, Symbol::intern("proc_macro_internals")],
     ));
     let span = DUMMY_SP.apply_mark(mark);
diff --git a/src/libsyntax_ext/test.rs b/src/libsyntax_ext/test.rs
index 24d3055e711..7f4f1fd7e01 100644
--- a/src/libsyntax_ext/test.rs
+++ b/src/libsyntax_ext/test.rs
@@ -9,7 +9,7 @@ use syntax::ast;
 use syntax::print::pprust;
 use syntax::symbol::{Symbol, sym};
 use syntax_pos::Span;
-use syntax::source_map::{ExpnInfo, MacroAttribute};
+use syntax::source_map::{ExpnInfo, ExpnKind};
 use std::iter;
 
 pub fn expand_test(
@@ -63,7 +63,7 @@ pub fn expand_test_or_bench(
     let (sp, attr_sp) = {
         let mark = Mark::fresh(Mark::root());
         mark.set_expn_info(ExpnInfo::with_unstable(
-            MacroAttribute(sym::test), attr_sp, cx.parse_sess.edition,
+            ExpnKind::MacroAttribute(sym::test), attr_sp, cx.parse_sess.edition,
             &[sym::rustc_attrs, sym::test],
         ));
         (item.span.with_ctxt(SyntaxContext::empty().apply_mark(mark)),
diff --git a/src/libsyntax_ext/test_case.rs b/src/libsyntax_ext/test_case.rs
index 186673c142f..5f88e2e098a 100644
--- a/src/libsyntax_ext/test_case.rs
+++ b/src/libsyntax_ext/test_case.rs
@@ -16,7 +16,7 @@ use syntax::ast;
 use syntax::source_map::respan;
 use syntax::symbol::sym;
 use syntax_pos::Span;
-use syntax::source_map::{ExpnInfo, MacroAttribute};
+use syntax::source_map::{ExpnInfo, ExpnKind};
 
 pub fn expand(
     ecx: &mut ExtCtxt<'_>,
@@ -29,7 +29,7 @@ pub fn expand(
     let sp = {
         let mark = Mark::fresh(Mark::root());
         mark.set_expn_info(ExpnInfo::with_unstable(
-            MacroAttribute(sym::test_case), attr_sp, ecx.parse_sess.edition,
+            ExpnKind::MacroAttribute(sym::test_case), attr_sp, ecx.parse_sess.edition,
             &[sym::test, sym::rustc_attrs],
         ));
         attr_sp.with_ctxt(SyntaxContext::empty().apply_mark(mark))
diff --git a/src/libsyntax_pos/hygiene.rs b/src/libsyntax_pos/hygiene.rs
index 6a2aba17a79..f36a4d5816e 100644
--- a/src/libsyntax_pos/hygiene.rs
+++ b/src/libsyntax_pos/hygiene.rs
@@ -162,7 +162,7 @@ impl Mark {
         HygieneData::with(|data| {
             if data.default_transparency(self) == Transparency::Opaque {
                 if let Some(expn_info) = &data.marks[self.0 as usize].expn_info {
-                    if let ExpnFormat::MacroAttribute(name) = expn_info.format {
+                    if let ExpnKind::MacroAttribute(name) = expn_info.kind {
                         if name.as_str().starts_with("derive(") {
                             return true;
                         }
@@ -654,7 +654,7 @@ pub struct ExpnInfo {
     /// pointing to the `foo!` invocation.
     pub call_site: Span,
     /// The format with which the macro was invoked.
-    pub format: ExpnFormat,
+    pub kind: ExpnKind,
 
     // --- The part specific to the macro/desugaring definition.
     // --- FIXME: Share it between expansions with the same definition.
@@ -681,10 +681,10 @@ pub struct ExpnInfo {
 
 impl ExpnInfo {
     /// Constructs an expansion info with default properties.
-    pub fn default(format: ExpnFormat, call_site: Span, edition: Edition) -> ExpnInfo {
+    pub fn default(kind: ExpnKind, call_site: Span, edition: Edition) -> ExpnInfo {
         ExpnInfo {
             call_site,
-            format,
+            kind,
             def_site: None,
             default_transparency: Transparency::SemiTransparent,
             allow_internal_unstable: None,
@@ -694,31 +694,31 @@ impl ExpnInfo {
         }
     }
 
-    pub fn with_unstable(format: ExpnFormat, call_site: Span, edition: Edition,
+    pub fn with_unstable(kind: ExpnKind, call_site: Span, edition: Edition,
                          allow_internal_unstable: &[Symbol]) -> ExpnInfo {
         ExpnInfo {
             allow_internal_unstable: Some(allow_internal_unstable.into()),
-            ..ExpnInfo::default(format, call_site, edition)
+            ..ExpnInfo::default(kind, call_site, edition)
         }
     }
 }
 
 /// The source of expansion.
 #[derive(Clone, Hash, Debug, PartialEq, Eq, RustcEncodable, RustcDecodable)]
-pub enum ExpnFormat {
+pub enum ExpnKind {
     /// e.g., #[derive(...)] <item>
     MacroAttribute(Symbol),
     /// e.g., `format!()`
     MacroBang(Symbol),
     /// Desugaring done by the compiler during HIR lowering.
-    CompilerDesugaring(CompilerDesugaringKind)
+    Desugaring(DesugaringKind)
 }
 
-impl ExpnFormat {
-    pub fn name(&self) -> Symbol {
+impl ExpnKind {
+    pub fn descr(&self) -> Symbol {
         match *self {
-            ExpnFormat::MacroBang(name) | ExpnFormat::MacroAttribute(name) => name,
-            ExpnFormat::CompilerDesugaring(kind) => kind.name(),
+            ExpnKind::MacroBang(name) | ExpnKind::MacroAttribute(name) => name,
+            ExpnKind::Desugaring(kind) => kind.descr(),
         }
     }
 }
@@ -753,7 +753,7 @@ impl MacroKind {
 
 /// The kind of compiler desugaring.
 #[derive(Clone, Copy, Hash, Debug, PartialEq, Eq, RustcEncodable, RustcDecodable)]
-pub enum CompilerDesugaringKind {
+pub enum DesugaringKind {
     /// We desugar `if c { i } else { e }` to `match $ExprKind::Use(c) { true => i, _ => e }`.
     /// However, we do not want to blame `c` for unreachability but rather say that `i`
     /// is unreachable. This desugaring kind allows us to avoid blaming `c`.
@@ -770,16 +770,16 @@ pub enum CompilerDesugaringKind {
     ForLoop,
 }
 
-impl CompilerDesugaringKind {
-    pub fn name(self) -> Symbol {
+impl DesugaringKind {
+    pub fn descr(self) -> Symbol {
         Symbol::intern(match self {
-            CompilerDesugaringKind::CondTemporary => "if and while condition",
-            CompilerDesugaringKind::Async => "async",
-            CompilerDesugaringKind::Await => "await",
-            CompilerDesugaringKind::QuestionMark => "?",
-            CompilerDesugaringKind::TryBlock => "try block",
-            CompilerDesugaringKind::ExistentialType => "existential type",
-            CompilerDesugaringKind::ForLoop => "for loop",
+            DesugaringKind::CondTemporary => "if and while condition",
+            DesugaringKind::Async => "async",
+            DesugaringKind::Await => "await",
+            DesugaringKind::QuestionMark => "?",
+            DesugaringKind::TryBlock => "try block",
+            DesugaringKind::ExistentialType => "existential type",
+            DesugaringKind::ForLoop => "for loop",
         })
     }
 }
diff --git a/src/libsyntax_pos/lib.rs b/src/libsyntax_pos/lib.rs
index 07b9f609320..d4c1958f7e2 100644
--- a/src/libsyntax_pos/lib.rs
+++ b/src/libsyntax_pos/lib.rs
@@ -27,7 +27,7 @@ extern crate serialize as rustc_serialize; // used by deriving
 pub mod edition;
 use edition::Edition;
 pub mod hygiene;
-pub use hygiene::{Mark, SyntaxContext, ExpnInfo, ExpnFormat, CompilerDesugaringKind};
+pub use hygiene::{Mark, SyntaxContext, ExpnInfo, ExpnKind, DesugaringKind};
 
 mod span_encoding;
 pub use span_encoding::{Span, DUMMY_SP};
@@ -403,10 +403,10 @@ impl Span {
     }
 
     /// Checks if this span arises from a compiler desugaring of kind `kind`.
-    pub fn is_compiler_desugaring(&self, kind: CompilerDesugaringKind) -> bool {
+    pub fn is_desugaring(&self, kind: DesugaringKind) -> bool {
         match self.ctxt().outer_expn_info() {
-            Some(info) => match info.format {
-                ExpnFormat::CompilerDesugaring(k) => k == kind,
+            Some(info) => match info.kind {
+                ExpnKind::Desugaring(k) => k == kind,
                 _ => false,
             },
             None => false,
@@ -415,10 +415,10 @@ impl Span {
 
     /// Returns the compiler desugaring that created this span, or `None`
     /// if this span is not from a desugaring.
-    pub fn compiler_desugaring_kind(&self) -> Option<CompilerDesugaringKind> {
+    pub fn desugaring_kind(&self) -> Option<DesugaringKind> {
         match self.ctxt().outer_expn_info() {
-            Some(info) => match info.format {
-                ExpnFormat::CompilerDesugaring(k) => Some(k),
+            Some(info) => match info.kind {
+                ExpnKind::Desugaring(k) => Some(k),
                 _ => None
             },
             None => None
@@ -441,14 +441,14 @@ impl Span {
         while let Some(info) = self.ctxt().outer_expn_info() {
             // Don't print recursive invocations.
             if !info.call_site.source_equal(&prev_span) {
-                let (pre, post) = match info.format {
-                    ExpnFormat::MacroAttribute(..) => ("#[", "]"),
-                    ExpnFormat::MacroBang(..) => ("", "!"),
-                    ExpnFormat::CompilerDesugaring(..) => ("desugaring of `", "`"),
+                let (pre, post) = match info.kind {
+                    ExpnKind::MacroAttribute(..) => ("#[", "]"),
+                    ExpnKind::MacroBang(..) => ("", "!"),
+                    ExpnKind::Desugaring(..) => ("desugaring of `", "`"),
                 };
                 result.push(MacroBacktrace {
                     call_site: info.call_site,
-                    macro_decl_name: format!("{}{}{}", pre, info.format.name(), post),
+                    macro_decl_name: format!("{}{}{}", pre, info.kind.descr(), post),
                     def_site_span: info.def_site,
                 });
             }