diff --git a/src/extra.rs b/src/extra.rs index daf4ba1f..cbce1626 100644 --- a/src/extra.rs +++ b/src/extra.rs @@ -58,7 +58,7 @@ impl DelimSpan { match &self.inner { #[cfg(wrap_proc_macro)] DelimSpanEnum::Compiler { join, .. } => Span::_new(imp::Span::Compiler(*join)), - DelimSpanEnum::Fallback(span) => Span::_new_stable(*span), + DelimSpanEnum::Fallback(span) => Span::_new_fallback(*span), } } @@ -73,7 +73,7 @@ impl DelimSpan { join: open, .. } => Span::_new(imp::Span::Compiler(*open)), - DelimSpanEnum::Fallback(span) => Span::_new_stable(span.first_byte()), + DelimSpanEnum::Fallback(span) => Span::_new_fallback(span.first_byte()), } } @@ -88,7 +88,7 @@ impl DelimSpan { join: close, .. } => Span::_new(imp::Span::Compiler(*close)), - DelimSpanEnum::Fallback(span) => Span::_new_stable(span.last_byte()), + DelimSpanEnum::Fallback(span) => Span::_new_fallback(span.last_byte()), } } } diff --git a/src/fallback.rs b/src/fallback.rs index 52bdcf7b..fc3cd515 100644 --- a/src/fallback.rs +++ b/src/fallback.rs @@ -94,7 +94,7 @@ fn push_token_from_proc_macro(mut vec: RcVecMut, token: TokenTree) { if literal.repr.starts_with('-') { push_negative_literal(vec, literal); } else { - vec.push(TokenTree::Literal(crate::Literal::_new_stable(literal))); + vec.push(TokenTree::Literal(crate::Literal::_new_fallback(literal))); } } _ => vec.push(token), @@ -104,9 +104,9 @@ fn push_token_from_proc_macro(mut vec: RcVecMut, token: TokenTree) { fn push_negative_literal(mut vec: RcVecMut, mut literal: Literal) { literal.repr.remove(0); let mut punct = crate::Punct::new('-', Spacing::Alone); - punct.set_span(crate::Span::_new_stable(literal.span)); + punct.set_span(crate::Span::_new_fallback(literal.span)); vec.push(TokenTree::Punct(punct)); - vec.push(TokenTree::Literal(crate::Literal::_new_stable(literal))); + vec.push(TokenTree::Literal(crate::Literal::_new_fallback(literal))); } } diff --git a/src/lib.rs b/src/lib.rs index 9e0f7fde..9b53cf99 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -187,7 +187,7 @@ impl TokenStream { } } - fn _new_stable(inner: fallback::TokenStream) -> Self { + fn _new_fallback(inner: fallback::TokenStream) -> Self { TokenStream { inner: inner.into(), _marker: Marker, @@ -381,7 +381,7 @@ impl Span { } } - fn _new_stable(inner: fallback::Span) -> Self { + fn _new_fallback(inner: fallback::Span) -> Self { Span { inner: inner.into(), _marker: Marker, @@ -668,7 +668,7 @@ impl Group { Group { inner } } - fn _new_stable(inner: fallback::Group) -> Self { + fn _new_fallback(inner: fallback::Group) -> Self { Group { inner: inner.into(), } @@ -1093,7 +1093,7 @@ impl Literal { } } - fn _new_stable(inner: fallback::Literal) -> Self { + fn _new_fallback(inner: fallback::Literal) -> Self { Literal { inner: inner.into(), _marker: Marker, diff --git a/src/parse.rs b/src/parse.rs index 2a87948a..82291da1 100644 --- a/src/parse.rs +++ b/src/parse.rs @@ -217,13 +217,13 @@ pub(crate) fn token_stream(mut input: Cursor) -> Result { hi: input.off, }); trees = outer; - trees.push_token_from_parser(TokenTree::Group(crate::Group::_new_stable(g))); + trees.push_token_from_parser(TokenTree::Group(crate::Group::_new_fallback(g))); } else { let (rest, mut tt) = match leaf_token(input) { Ok((rest, tt)) => (rest, tt), Err(Reject) => return Err(lex_error(input)), }; - tt.set_span(crate::Span::_new_stable(Span { + tt.set_span(crate::Span::_new_fallback(Span { #[cfg(span_locations)] lo, #[cfg(span_locations)] @@ -251,7 +251,7 @@ fn lex_error(cursor: Cursor) -> LexError { fn leaf_token(input: Cursor) -> PResult { if let Ok((input, l)) = literal(input) { // must be parsed before ident - Ok((input, TokenTree::Literal(crate::Literal::_new_stable(l)))) + Ok((input, TokenTree::Literal(crate::Literal::_new_fallback(l)))) } else if let Ok((input, p)) = punct(input) { Ok((input, TokenTree::Punct(p))) } else if let Ok((input, i)) = ident(input) { @@ -795,7 +795,7 @@ fn doc_comment<'a>(input: Cursor<'a>, trees: &mut TokenStreamBuilder) -> PResult #[cfg(span_locations)] let lo = input.off; let (rest, (comment, inner)) = doc_comment_contents(input)?; - let span = crate::Span::_new_stable(Span { + let span = crate::Span::_new_fallback(Span { #[cfg(span_locations)] lo, #[cfg(span_locations)] @@ -831,7 +831,7 @@ fn doc_comment<'a>(input: Cursor<'a>, trees: &mut TokenStreamBuilder) -> PResult bracketed.push_token_from_parser(TokenTree::Punct(equal)); bracketed.push_token_from_parser(TokenTree::Literal(literal)); let group = Group::new(Delimiter::Bracket, bracketed.build()); - let mut group = crate::Group::_new_stable(group); + let mut group = crate::Group::_new_fallback(group); group.set_span(span); trees.push_token_from_parser(TokenTree::Group(group)); diff --git a/src/wrapper.rs b/src/wrapper.rs index f5ec06b6..720dcdd3 100644 --- a/src/wrapper.rs +++ b/src/wrapper.rs @@ -40,7 +40,7 @@ impl LexError { } fn mismatch() -> ! { - panic!("stable/nightly mismatch") + panic!("compiler/fallback mismatch") } impl DeferredTokenStream {