Rust code highlighting - character highlighting incorrectly used for lifetime identifiers.
I know highlighting is always in the works, just wanted to leave this issue to help with tracking.
In Rust, 'a' is a a character. 'a is a lifetime identifier. This isn't limited to 'a, but can be any number of letters, including:
'b
'bar, 'baz
'static
Expected behaviour
Correct highlighting:
struct Foo<'a> {
a: 'a char, // variable with name "a" will be of type character with a lifetime of 'a
}
fn main() {
let f = Foo { a: 'a' }; // "variable a = the char 'a'"
}
Actual behaviour
Everything between a pair of "''s" is highlighted (sorta:).
Steps to reproduce
Write
impl<'a> Foo<'a> for Bar {
type Baz = (
a<'a, x>,
b<'a, y>,
c<'a, z>,
);
surrounded with a rust block quote. In the preview window, everything between two "''s" is highlighted no matter how far away the next one is (which potentially just makes your near-entire codeblock highlighted in 1 color). In the writing window, everything between two "''s" or a a "''" and a linebreak is highlighted, whichever comes first.
@Waqar144? :grin:
In Rust, 'a' is a a character.
Indeed.
This isn't really difficult to implement, but I don't want every language to go through this check.