mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-29 05:15:04 +00:00
Escape characters in builtin macros correctly
This commit is contained in:
parent
cf4d4f646b
commit
01ce37c805
2 changed files with 4 additions and 4 deletions
|
@ -788,9 +788,9 @@ mod tests {
|
||||||
r##"
|
r##"
|
||||||
#[rustc_builtin_macro]
|
#[rustc_builtin_macro]
|
||||||
macro_rules! concat {}
|
macro_rules! concat {}
|
||||||
concat!("foo", "r", 0, r#"bar"#, false);
|
concat!("foo", "r", 0, r#"bar"#, "\n", false);
|
||||||
"##,
|
"##,
|
||||||
expect![[r#""foor0barfalse""#]],
|
expect![[r#""foor0bar\nfalse""#]],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -196,8 +196,8 @@ impl_to_to_tokentrees! {
|
||||||
tt::Literal => self { self };
|
tt::Literal => self { self };
|
||||||
tt::Ident => self { self };
|
tt::Ident => self { self };
|
||||||
tt::Punct => self { self };
|
tt::Punct => self { self };
|
||||||
&str => self { tt::Literal{text: format!("{:?}", self.escape_default().to_string()).into(), id: tt::TokenId::unspecified()}};
|
&str => self { tt::Literal{text: format!("\"{}\"", self.escape_debug()).into(), id: tt::TokenId::unspecified()}};
|
||||||
String => self { tt::Literal{text: format!("{:?}", self.escape_default().to_string()).into(), id: tt::TokenId::unspecified()}}
|
String => self { tt::Literal{text: format!("\"{}\"", self.escape_debug()).into(), id: tt::TokenId::unspecified()}}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue