-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Use of by rustdoc makes APIs not copyable into Rust source code #106098
Comments
For now the best workaround I've found is to comment out the whole copied code using a block comment: /*
impl Trait for MyStruct {
fn method<T>()
where
T: Default {}
}
*/ Then run /*
impl Trait for MyStruct {
fn method<T>()
where
T: Default {}
}
*/ Then you can uncomment that code: impl Trait for MyStruct {
fn method<T>()
where
T: Default {}
} and finally run rustfmt again to get normal spaces: impl Trait for MyStruct {
fn method<T>()
where
T: Default,
{
}
} |
The behaviour in rustdoc is pretty old, it occurs at least since 1.12 (haven't checked further back). What is new though is the behaviour of Firefox to translate |
That lines up. Yes I am using Firefox, and have been copying code from rustdoc rendered documentation for years, and don't remember it being a problem until recently. Would it be worth triaging this as a regression, due to the recent regression in user experience, despite not being caused by a code change in rustdoc? |
No idea really, IIRC the main purpose of those labels is to track regressions that rustc changes caused. Chromium users had the behaviour for 4+ years, maybe even since Chromium existed, so for them this is not a regression, but been the status quo. This doesn't mean that this isn't a rustc side bug though, copying code from generated rustdoc should work. I've done it in the past myself. I usually only copy single lines however, and don't copy the indentation, so I didn't notice this change. |
More firefox issue threads:
|
Emit only one nbsp error per file Fixes rust-lang#106101. See rust-lang#106098 for an explanation of how someone would end up with a large number of these nbsp characters in their source code, which is why I think rustc needs to handle this specific case in a friendlier way.
Emit only one nbsp error per file Fixes #106101. See rust-lang/rust#106098 for an explanation of how someone would end up with a large number of these nbsp characters in their source code, which is why I think rustc needs to handle this specific case in a friendlier way.
Suppose we have this trait:
Run
cargo doc
; it renders as:Now let's begin writing an impl of this trait:
and copy in the
method
method signature directly from the documentation:We get this distressing error from
cargo check
:Hopefully there is some other way rustdoc would be able to display the same content in a way that doesn't suffer this limitation.
Is this just as simple as using
white-space: pre;
in the CSS and then writing ordinary spaces instead of ? If so, that seems definitely worthwhile doing.The text was updated successfully, but these errors were encountered: