<p dir="auto">It seems that once emacs parses a <code class="notranslate">'"'</code> (that is, a double-quote character literal), in rust code it interprets this as the beginning of a string and highlights accordingly. This is very easy to spot, for example, in the file <code class="notranslate">src/libextra/json.rs</code> (which is where I discovered it).</p>
<p dir="auto">The latest version of <code class="notranslate">rust-mode</code> for Emacs (20130928.1740) has issues with<br>
single-quoted characters, especially when that character is a <code class="notranslate">"</code> (double<br>
quote). The following program executes correctly in Rust 0.8, but is font-locked<br>
improperly in Emacs:</p>
<div class="highlight highlight-source-rust notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="fn main() {
    println!(&quot;{}&quot;, '&quot;');
}"><pre class="notranslate"><span class="pl-k">fn</span> <span class="pl-en">main</span><span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
    <span class="pl-en">println</span><span class="pl-en">!</span><span class="pl-kos">(</span><span class="pl-s">"{}"</span>, <span class="pl-s">'"'</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
<span class="pl-kos">}</span></pre></div>
<p dir="auto">It treats the double quote as the beginning of a string which runs to the end of<br>
the file. If the double quote character is escaped like so:</p>
<div class="highlight highlight-source-rust notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="fn main() {
    println!(&quot;{}&quot;, '\&quot;');
}"><pre class="notranslate"><span class="pl-k">fn</span> <span class="pl-en">main</span><span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
    <span class="pl-en">println</span><span class="pl-en">!</span><span class="pl-kos">(</span><span class="pl-s">"{}"</span>, <span class="pl-s">'\"'</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
<span class="pl-kos">}</span></pre></div>
<p dir="auto">Then there is not a problem with an unterminated string, but the characters<br>
inside the single quotes are not fontified at all.</p>
<p dir="auto">Note: Both programs compile and execute successfully under Rust 0.8.</p>
<p dir="auto">This is related to <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="18609957" data-permission-text="Title is private" data-url="https://github.com/rust-lang/rust/issues/8793" data-hovercard-type="issue" data-hovercard-url="/rust-lang/rust/issues/8793/hovercard" href="https://github.com/rust-lang/rust/issues/8793">#8793</a></p>