-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
Fix formatting generation for rustdoc code examples #35012
Conversation
ad5aaa7
to
639bece
Compare
I guess? (I didn't know it was done "correctly" before.) |
/cc @rust-lang/tools |
Is this just a matter of inserting |
@nrc: I didn't understand your comment. Why are talking about |
@GuillaumeGomez I might be mistaken, but my understanding was that #25944 is only an issue with multiline string lits, and that if one does
rather than
Then the indentation change should not be a problem. |
Ah right. Then no, I don't see why it would break it. |
sgtm |
Any news about this? |
I agree with @ollie27 that this seems like it'd be regressing the fix from earlier, and as a result may not be worth it as a standalone feature. Perhaps we could send requests to playpen which auto-format the code? |
@alexcrichton: If it's done then I'll even remove the indent/backlines when creating the URL. |
Is it possible to separate the |
So, what's the state of this PR? |
@steveklabnik: Still waiting for @alexcrichton update on play.rust-lang.org I think? |
Sorry, but what's supposed to happen? |
In my opinion, I don't think we should auto format code when loading the playpen. This seems like a bug with URL generation with rustdoc. |
@alexcrichton: You said:
So I thought something was moving in this way. Sorry if I misunderstood. @frewsxcv: So my current PR is the "correct" way to do it I guess? :p |
@GuillaumeGomez oh no I wasn't actually planning on making any changes myself, no. @frewsxcv the problem is that this documentation:
changes meaning depending on whether rustdoc snippets are auto-indented. We can auto-indent, but it changes the meaning of that string literal (the original bug) |
It looks like we're not going to accept this, so I'm giving it a close. Let me know if that reading is wrong. |
Now, when clicking on the Run link in the docs, the code is indented if it is put in a main function (I couldn't stand the horrible output we currently have).
r? @steveklabnik