The Expr_
variant ExprLit
with a LitStr
now no longer contains the string as it appears in the code, but already backslash-escaped.
I noticed this when clippy failed its dogfooding test on zero-width-whitespace because of the string literal “\u{200B}” – which does not even contain a non-latin1 character, but because of escaping was tripping the lint.
To solve this, I had to use codemap
's span_to_snippet
function, which fortunately works as expected. Whoever tries to use the new hir
functions to extract strings should probably be mindful of this.