Merge pull request #367 from dtolnay/fallback

Rename 'stable' terminology to 'fallback'
This commit is contained in:
David Tolnay 2023-03-12 14:07:50 -07:00 committed by GitHub
commit 006d135ffa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 16 additions and 16 deletions

View File

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

View File

@ -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),
@ -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)));
}
}

View File

@ -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,

View File

@ -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)]
@ -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) {
@ -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));

View File

@ -40,7 +40,7 @@ impl LexError {
}
fn mismatch() -> ! {
panic!("stable/nightly mismatch")
panic!("compiler/fallback mismatch")
}
impl DeferredTokenStream {