Auto merge of #17799 - Veykril:syntax-bridge, r=Veykril

Split out syntax-bridge into a separate crate

This functionality is not really tied to mbe macros, so imo it has no place in that crate.
This commit is contained in:
bors 2024-08-05 12:31:45 +00:00
commit fbed308ebe
30 changed files with 268 additions and 140 deletions

View file

@ -126,9 +126,12 @@ pub(super) mod token_stream {
/// change these errors into `LexError`s later.
impl<S: Copy + fmt::Debug> TokenStream<S> {
pub(crate) fn from_str(src: &str, call_site: S) -> Result<TokenStream<S>, String> {
let subtree =
mbe::parse_to_token_tree_static_span(span::Edition::CURRENT_FIXME, call_site, src)
.ok_or("lexing error")?;
let subtree = syntax_bridge::parse_to_token_tree_static_span(
span::Edition::CURRENT_FIXME,
call_site,
src,
)
.ok_or("lexing error")?;
Ok(TokenStream::with_subtree(subtree))
}