Skip to content

Commit

Permalink
Merge pull request #367 from dtolnay/fallback
Browse files Browse the repository at this point in the history
Rename 'stable' terminology to 'fallback'
  • Loading branch information
dtolnay authored Mar 12, 2023
2 parents 65699c4 + 96da1a2 commit 006d135
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 16 deletions.
6 changes: 3 additions & 3 deletions src/extra.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
}
}

Expand All @@ -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()),
}
}

Expand All @@ -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()),
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/fallback.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ fn push_token_from_proc_macro(mut vec: RcVecMut<TokenTree>, 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),
Expand All @@ -104,9 +104,9 @@ fn push_token_from_proc_macro(mut vec: RcVecMut<TokenTree>, token: TokenTree) {
fn push_negative_literal(mut vec: RcVecMut<TokenTree>, 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)));
}
}

Expand Down
8 changes: 4 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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(),
}
Expand Down Expand Up @@ -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,
Expand Down
10 changes: 5 additions & 5 deletions src/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -217,13 +217,13 @@ pub(crate) fn token_stream(mut input: Cursor) -> Result<TokenStream, LexError> {
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)]
Expand Down Expand Up @@ -251,7 +251,7 @@ fn lex_error(cursor: Cursor) -> LexError {
fn leaf_token(input: Cursor) -> PResult<TokenTree> {
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) {
Expand Down Expand Up @@ -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)]
Expand Down Expand Up @@ -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));

Expand Down
2 changes: 1 addition & 1 deletion src/wrapper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ impl LexError {
}

fn mismatch() -> ! {
panic!("stable/nightly mismatch")
panic!("compiler/fallback mismatch")
}

impl DeferredTokenStream {
Expand Down

0 comments on commit 006d135

Please sign in to comment.