Correctly escape strings in our quote macro

This is a small change, but it was the cause of 90% of the errors in `rust-analyzer diagnostics .` 🫢

With this change and #18085 together, all remaining errors are type errors.

This may mean we can enable more errors, but this is out of scope for this PR.
This commit is contained in:
Chayim Refael Friedman 2024-09-10 18:48:54 +03:00
parent f13c776361
commit 7c44d453c8
3 changed files with 25 additions and 6 deletions

View file

@ -528,3 +528,21 @@ fn main() { foobar; }
"##]],
);
}
#[test]
fn test_quote_string() {
check(
r##"
#[rustc_builtin_macro]
macro_rules! stringify {}
fn main() { stringify!("hello"); }
"##,
expect![[r##"
#[rustc_builtin_macro]
macro_rules! stringify {}
fn main() { "\"hello\""; }
"##]],
);
}