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

rustdoc: attribute string literals render with backslashes #81482

Closed
ehuss opened this issue Jan 28, 2021 · 0 comments · Fixed by #95613
Closed

rustdoc: attribute string literals render with backslashes #81482

ehuss opened this issue Jan 28, 2021 · 0 comments · Fixed by #95613
Labels
C-bug Category: This is a bug. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@ehuss
Copy link
Contributor

ehuss commented Jan 28, 2021

I tried this code:

#[must_use = "this is a \
              message"]
pub fn f() {}

I expected to see this happen: Rustdoc will render the string as #[must_use = "this is a message"]

Instead, this happened: It is rendered with a backslash:

image

Meta

rustdoc 1.51.0-nightly (f4eb5d9f7 2021-01-25)

I believe this started in 1.44 via #69686.

(This is a pretty minor issue, I'm not sure it is worth putting energy into, but it does look a little strange.)

@ehuss ehuss added the C-bug Category: This is a bug. label Jan 28, 2021
@jonas-schievink jonas-schievink added the T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. label Jan 28, 2021
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this issue Jun 14, 2021
Remove must_use from ALLOWED_ATTRIBUTES

This is a fairly common attribute on methods, but is not something you need to know when reading the method docs - the purpose of the attribute is for the compiler to tell you about it if you forget to use a value.

Removing reclaims some valuable space in the summary of methods, particularly when the attribute has a long string value.

As discussed in rust-lang#84309. Partially addresses rust-lang#81482.

r? `@Manishearth`
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this issue Jun 14, 2021
Remove must_use from ALLOWED_ATTRIBUTES

This is a fairly common attribute on methods, but is not something you need to know when reading the method docs - the purpose of the attribute is for the compiler to tell you about it if you forget to use a value.

Removing reclaims some valuable space in the summary of methods, particularly when the attribute has a long string value.

As discussed in rust-lang#84309. Partially addresses rust-lang#81482.

r? ``@Manishearth``
JohnTitor added a commit to JohnTitor/rust that referenced this issue Jun 15, 2021
Remove must_use from ALLOWED_ATTRIBUTES

This is a fairly common attribute on methods, but is not something you need to know when reading the method docs - the purpose of the attribute is for the compiler to tell you about it if you forget to use a value.

Removing reclaims some valuable space in the summary of methods, particularly when the attribute has a long string value.

As discussed in rust-lang#84309. Partially addresses rust-lang#81482.

r? ```@Manishearth```
@bors bors closed this as completed in 5925c8e Apr 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
3 participants