Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider removing invalid span workaround form join_spans #222

Closed
mystor opened this issue Jun 19, 2022 · 0 comments · Fixed by #224
Closed

Consider removing invalid span workaround form join_spans #222

mystor opened this issue Jun 19, 2022 · 0 comments · Fixed by #224

Comments

@mystor
Copy link
Collaborator

mystor commented Jun 19, 2022

In the internal join_spans function, there is some old code which filters out invalid tokens from the input stream by debug-printing the Span object, and inspecting the output.

quote/src/spanned.rs

Lines 21 to 32 in 7d5d360

let mut iter = tokens.into_iter().filter_map(|tt| {
// FIXME: This shouldn't be required, since optimally spans should
// never be invalid. This filter_map can probably be removed when
// https://github.com/rust-lang/rust/issues/43081 is resolved.
let span = tt.span();
let debug = format!("{:?}", span);
if debug.ends_with("bytes(0..0)") {
None
} else {
Some(span)
}
});

Given that rust-lang/rust#43081 appears to have been fixed for a bit over a year (rust-lang/rust#43081 (comment)), perhaps this code could be disabled on versions with the fix (appears to be rustc 1.53+)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant