Skip to content

Commit 006d135

Browse files
authored
Merge pull request #367 from dtolnay/fallback
Rename 'stable' terminology to 'fallback'
2 parents 65699c4 + 96da1a2 commit 006d135

File tree

5 files changed

+16
-16
lines changed

5 files changed

+16
-16
lines changed

src/extra.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ impl DelimSpan {
5858
match &self.inner {
5959
#[cfg(wrap_proc_macro)]
6060
DelimSpanEnum::Compiler { join, .. } => Span::_new(imp::Span::Compiler(*join)),
61-
DelimSpanEnum::Fallback(span) => Span::_new_stable(*span),
61+
DelimSpanEnum::Fallback(span) => Span::_new_fallback(*span),
6262
}
6363
}
6464

@@ -73,7 +73,7 @@ impl DelimSpan {
7373
join: open,
7474
..
7575
} => Span::_new(imp::Span::Compiler(*open)),
76-
DelimSpanEnum::Fallback(span) => Span::_new_stable(span.first_byte()),
76+
DelimSpanEnum::Fallback(span) => Span::_new_fallback(span.first_byte()),
7777
}
7878
}
7979

@@ -88,7 +88,7 @@ impl DelimSpan {
8888
join: close,
8989
..
9090
} => Span::_new(imp::Span::Compiler(*close)),
91-
DelimSpanEnum::Fallback(span) => Span::_new_stable(span.last_byte()),
91+
DelimSpanEnum::Fallback(span) => Span::_new_fallback(span.last_byte()),
9292
}
9393
}
9494
}

src/fallback.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ fn push_token_from_proc_macro(mut vec: RcVecMut<TokenTree>, token: TokenTree) {
9494
if literal.repr.starts_with('-') {
9595
push_negative_literal(vec, literal);
9696
} else {
97-
vec.push(TokenTree::Literal(crate::Literal::_new_stable(literal)));
97+
vec.push(TokenTree::Literal(crate::Literal::_new_fallback(literal)));
9898
}
9999
}
100100
_ => vec.push(token),
@@ -104,9 +104,9 @@ fn push_token_from_proc_macro(mut vec: RcVecMut<TokenTree>, token: TokenTree) {
104104
fn push_negative_literal(mut vec: RcVecMut<TokenTree>, mut literal: Literal) {
105105
literal.repr.remove(0);
106106
let mut punct = crate::Punct::new('-', Spacing::Alone);
107-
punct.set_span(crate::Span::_new_stable(literal.span));
107+
punct.set_span(crate::Span::_new_fallback(literal.span));
108108
vec.push(TokenTree::Punct(punct));
109-
vec.push(TokenTree::Literal(crate::Literal::_new_stable(literal)));
109+
vec.push(TokenTree::Literal(crate::Literal::_new_fallback(literal)));
110110
}
111111
}
112112

src/lib.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ impl TokenStream {
187187
}
188188
}
189189

190-
fn _new_stable(inner: fallback::TokenStream) -> Self {
190+
fn _new_fallback(inner: fallback::TokenStream) -> Self {
191191
TokenStream {
192192
inner: inner.into(),
193193
_marker: Marker,
@@ -381,7 +381,7 @@ impl Span {
381381
}
382382
}
383383

384-
fn _new_stable(inner: fallback::Span) -> Self {
384+
fn _new_fallback(inner: fallback::Span) -> Self {
385385
Span {
386386
inner: inner.into(),
387387
_marker: Marker,
@@ -668,7 +668,7 @@ impl Group {
668668
Group { inner }
669669
}
670670

671-
fn _new_stable(inner: fallback::Group) -> Self {
671+
fn _new_fallback(inner: fallback::Group) -> Self {
672672
Group {
673673
inner: inner.into(),
674674
}
@@ -1093,7 +1093,7 @@ impl Literal {
10931093
}
10941094
}
10951095

1096-
fn _new_stable(inner: fallback::Literal) -> Self {
1096+
fn _new_fallback(inner: fallback::Literal) -> Self {
10971097
Literal {
10981098
inner: inner.into(),
10991099
_marker: Marker,

src/parse.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -217,13 +217,13 @@ pub(crate) fn token_stream(mut input: Cursor) -> Result<TokenStream, LexError> {
217217
hi: input.off,
218218
});
219219
trees = outer;
220-
trees.push_token_from_parser(TokenTree::Group(crate::Group::_new_stable(g)));
220+
trees.push_token_from_parser(TokenTree::Group(crate::Group::_new_fallback(g)));
221221
} else {
222222
let (rest, mut tt) = match leaf_token(input) {
223223
Ok((rest, tt)) => (rest, tt),
224224
Err(Reject) => return Err(lex_error(input)),
225225
};
226-
tt.set_span(crate::Span::_new_stable(Span {
226+
tt.set_span(crate::Span::_new_fallback(Span {
227227
#[cfg(span_locations)]
228228
lo,
229229
#[cfg(span_locations)]
@@ -251,7 +251,7 @@ fn lex_error(cursor: Cursor) -> LexError {
251251
fn leaf_token(input: Cursor) -> PResult<TokenTree> {
252252
if let Ok((input, l)) = literal(input) {
253253
// must be parsed before ident
254-
Ok((input, TokenTree::Literal(crate::Literal::_new_stable(l))))
254+
Ok((input, TokenTree::Literal(crate::Literal::_new_fallback(l))))
255255
} else if let Ok((input, p)) = punct(input) {
256256
Ok((input, TokenTree::Punct(p)))
257257
} else if let Ok((input, i)) = ident(input) {
@@ -795,7 +795,7 @@ fn doc_comment<'a>(input: Cursor<'a>, trees: &mut TokenStreamBuilder) -> PResult
795795
#[cfg(span_locations)]
796796
let lo = input.off;
797797
let (rest, (comment, inner)) = doc_comment_contents(input)?;
798-
let span = crate::Span::_new_stable(Span {
798+
let span = crate::Span::_new_fallback(Span {
799799
#[cfg(span_locations)]
800800
lo,
801801
#[cfg(span_locations)]
@@ -831,7 +831,7 @@ fn doc_comment<'a>(input: Cursor<'a>, trees: &mut TokenStreamBuilder) -> PResult
831831
bracketed.push_token_from_parser(TokenTree::Punct(equal));
832832
bracketed.push_token_from_parser(TokenTree::Literal(literal));
833833
let group = Group::new(Delimiter::Bracket, bracketed.build());
834-
let mut group = crate::Group::_new_stable(group);
834+
let mut group = crate::Group::_new_fallback(group);
835835
group.set_span(span);
836836
trees.push_token_from_parser(TokenTree::Group(group));
837837

src/wrapper.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ impl LexError {
4040
}
4141

4242
fn mismatch() -> ! {
43-
panic!("stable/nightly mismatch")
43+
panic!("compiler/fallback mismatch")
4444
}
4545

4646
impl DeferredTokenStream {

0 commit comments

Comments
 (0)