Update stderr

The spans generated by `quote!` are (intentionally) no longer all the
same, so I removed that check entirely.
This commit is contained in:
Aaron Hill 2021-05-08 21:33:04 -04:00
parent f916b0474a
commit dbf49102aa
No known key found for this signature in database
GPG Key ID: B4087E510E98B164
3 changed files with 9 additions and 24 deletions

View File

@ -20,7 +20,7 @@ fn y /* 0#0 */() { }
/*
Expansions:
0: parent: ExpnId(0), call_site_ctxt: #0, def_site_ctxt: #0, kind: Root
1: parent: ExpnId(0), call_site_ctxt: #0, def_site_ctxt: #0, kind: Macro(Bang, "foo")
1: parent: ExpnId(0), call_site_ctxt: #0, def_site_ctxt: #0, kind: Macro { kind: Bang, name: "foo", proc_macro: false }
SyntaxContexts:
#0: parent: #0, outer_mark: (ExpnId(0), Opaque)

View File

@ -23,24 +23,5 @@ pub fn make_foo(_: TokenStream) -> TokenStream {
}
};
// Check that all spans are equal.
// FIXME: `quote!` gives def-site spans to idents and literals,
// but leaves (default) call-site spans on groups and punctuation.
let mut span_call = None;
let mut span_def = None;
for tt in result.clone() {
match tt {
TokenTree::Ident(..) | TokenTree::Literal(..) => match span_def {
None => span_def = Some(tt.span()),
Some(span) => assert_same_span(tt.span(), span),
}
TokenTree::Punct(..) | TokenTree::Group(..) => match span_call {
None => span_call = Some(tt.span()),
Some(span) => assert_same_span(tt.span(), span),
}
}
}
result
}

View File

@ -17,11 +17,15 @@ LL | $(= $z:tt)*
error: `$x:expr` may be followed by `$y:tt`, which is not allowed for `expr` fragments
--> $DIR/same-sequence-span.rs:19:1
|
LL | proc_macro_sequence::make_foo!();
| ---------------------------------^^^^^^^^^^^^^
LL | proc_macro_sequence::make_foo!();
| ^--------------------------------
| |
| _in this macro invocation
| |
| not allowed after `expr` fragments
| in this macro invocation
LL | |
LL | |
LL | | fn main() {}
| |_________________________________^ not allowed after `expr` fragments
|
= note: allowed there are: `=>`, `,` or `;`
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)