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

TokenStream: Pretty-printing for string and character literals is hard to read #45076

Closed
lambda-fairy opened this issue Oct 7, 2017 · 0 comments
Labels
A-syntaxext Area: Syntax extensions C-bug Category: This is a bug.

Comments

@lambda-fairy
Copy link
Contributor

When I try to println!() a TokenStream that contains a string literal, I get this back:

"\u{3c}\u{70}\u{3e}\u{3c}\u{62}\u{3e}\u{70}\u{69}\u{63}\u{6b}\u{6c}\u{65}\u{3c}\u{2f}\u{62}\u{3e}\u{62}\u{61}\u{72}\u{72}\u{65}\u{6c}\u{3c}\u{69}\u{3e}\u{6b}\u{75}\u{6d}\u{71}\u{75}\u{61}\u{74}\u{3c}\u{2f}\u{69}\u{3e}\u{3c}\u{2f}\u{70}\u{3e}"

That's much harder to read than the unescaped equivalent:

"<p><b>pickle</b>barrel<i>kumquat</i></p>"

I think we should at least render printable ASCII characters (except backslashes and quotes) without escaping, to make it easier for macro authors to debug their generated code.

@bluss bluss changed the title Pretty-printing for string and character literals is hard to read TokenStream: Pretty-printing for string and character literals is hard to read Oct 7, 2017
@bluss bluss added A-allocators Area: Custom and system allocators A-syntaxext Area: Syntax extensions C-bug Category: This is a bug. and removed A-allocators Area: Custom and system allocators labels Oct 7, 2017
kennytm added a commit to kennytm/rust that referenced this issue Oct 10, 2017
…jseyfried

Make the result of `Literal::string()` more readable

Closes rust-lang#45076
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-syntaxext Area: Syntax extensions C-bug Category: This is a bug.
Projects
None yet
Development

No branches or pull requests

2 participants