]> git.lizzy.rs Git - rust.git/blobdiff - crates/mbe/src/lib.rs
internal: remove accidental code re-use
[rust.git] / crates / mbe / src / lib.rs
index d2b955c5c8136642e6d4b714e29cb8d42bc41429..13fec269faba764d22878568f26ce33bf2340a7e 100644 (file)
 
 use std::fmt;
 
-pub use tt::{Delimiter, DelimiterKind, Punct};
-
 use crate::{
     parser::{parse_pattern, parse_template, MetaTemplate, Op},
     tt_iter::TtIter,
 };
 
+// FIXME: we probably should re-think  `token_tree_to_syntax_node` interfaces
+pub use ::parser::FragmentKind;
+pub use tt::{Delimiter, DelimiterKind, Punct};
+
 #[derive(Debug, PartialEq, Eq)]
 pub enum ParseError {
     UnexpectedToken(String),
@@ -39,17 +41,11 @@ pub enum ExpandError {
     UnexpectedToken,
     BindingError(String),
     ConversionError,
-    ProcMacroError(tt::ExpansionError),
+    // FIXME: no way mbe should know about proc macros.
     UnresolvedProcMacro,
     Other(String),
 }
 
-impl From<tt::ExpansionError> for ExpandError {
-    fn from(it: tt::ExpansionError) -> Self {
-        ExpandError::ProcMacroError(it)
-    }
-}
-
 impl fmt::Display for ExpandError {
     fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
         match self {
@@ -57,7 +53,6 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
             ExpandError::UnexpectedToken => f.write_str("unexpected token in input"),
             ExpandError::BindingError(e) => f.write_str(e),
             ExpandError::ConversionError => f.write_str("could not convert tokens"),
-            ExpandError::ProcMacroError(e) => e.fmt(f),
             ExpandError::UnresolvedProcMacro => f.write_str("unresolved proc macro"),
             ExpandError::Other(e) => f.write_str(e),
         }
@@ -67,7 +62,7 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
 pub use crate::{
     syntax_bridge::{
         parse_exprs_with_sep, parse_to_token_tree, syntax_node_to_token_tree,
-        token_tree_to_syntax_node,
+        syntax_node_to_token_tree_censored, token_tree_to_syntax_node,
     },
     token_map::TokenMap,
 };