about summary refs log tree commit diff
path: root/src/libsyntax_pos/lib.rs
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 /src/libsyntax_pos/lib.rs
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
Diffstat (limited to 'src/libsyntax_pos/lib.rs')
-rw-r--r--src/libsyntax_pos/lib.rs24
1 files changed, 12 insertions, 12 deletions
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,
                 });
             }