You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What steps will reproduce the problem?
The highlighting for Rust does not properly handle lifetimes. It treats the
lifetime sigil ' as the start of a string instead (even though Rust doesn't
support single-quoted strings). This causes bad rendering.
This causes a problem on StackOverflow, when people post questions about Rust.
For example, in a question asked 19 hours ago
(http://stackoverflow.com/questions/24855830/how-convert-a-string-in-str-in-impl
-block-in-rust), the first code block contains a struct definition with a field
`title: &'static str`. The rest of the code block from the ' is colored red, as
if it were a string, when in fact 'static is a lifetime specifier.
In Rust, the ' token is either used to start a character literal, or a
lifetime. if the ' is followed by a single unicode character (or a single
escape, such as \n, \t, \u2022), and then another ', then it is a character
literal. Otherwise, if it's followed by a single identifier that meets the
identifier rules, the ' with the identifier are considered a lifetime
(otherwise, it's assumed to be an unterminated character literal).
Original issue reported on code.google.com by [email protected] on 21 Jul 2014 at 6:35
The text was updated successfully, but these errors were encountered:
I actually don't even see a lang-rust.js file anywhere, which leads me to
believe that SO is just using some other arbitrary language to highlight Rust
code.
I've filed an issue in the Rust repo to implement proper Rust highlighting
support (https://github.com/rust-lang/rust/issues/18931).
I removed the generic references to rust from prettify.js and added a separate
lang-rust.js file to provide better highlighting for rust.
Please review the attached diff and let me know if I need to make any further
changes.
Original issue reported on code.google.com by
[email protected]
on 21 Jul 2014 at 6:35The text was updated successfully, but these errors were encountered: