Fix .to_string() of proc_macro::Literal (properly print cstr literals)

This commit is contained in:
Maybe Waffle 2023-09-24 20:05:27 +00:00
parent 19c65022fc
commit 285e574b8e

View File

@ -1411,7 +1411,15 @@ impl Literal {
let hashes = get_hashes_str(n);
f(&["br", hashes, "\"", symbol, "\"", hashes, suffix])
}
_ => f(&[symbol, suffix]),
bridge::LitKind::CStr => f(&["c\"", symbol, "\"", suffix]),
bridge::LitKind::CStrRaw(n) => {
let hashes = get_hashes_str(n);
f(&["cr", hashes, "\"", symbol, "\"", hashes, suffix])
}
bridge::LitKind::Integer | bridge::LitKind::Float | bridge::LitKind::Err => {
f(&[symbol, suffix])
}
})
}
}