minor: align with rustc on escaping characters in macro expansion
This commit is contained in:
parent
859d467276
commit
4d5873e92f
@ -295,13 +295,13 @@ fn test_concat_expand() {
|
|||||||
#[rustc_builtin_macro]
|
#[rustc_builtin_macro]
|
||||||
macro_rules! concat {}
|
macro_rules! concat {}
|
||||||
|
|
||||||
fn main() { concat!("foo", "r", 0, r#"bar"#, "\n", false, '\n'); }
|
fn main() { concat!("foo", "r", 0, r#"bar"#, "\n", false, '"', '\0'); }
|
||||||
"##,
|
"##,
|
||||||
expect![[r##"
|
expect![[r##"
|
||||||
#[rustc_builtin_macro]
|
#[rustc_builtin_macro]
|
||||||
macro_rules! concat {}
|
macro_rules! concat {}
|
||||||
|
|
||||||
fn main() { "foor0bar\nfalse\n"; }
|
fn main() { "foor0bar\nfalse\"\u{0}"; }
|
||||||
"##]],
|
"##]],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -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_debug()).into(), id: tt::TokenId::unspecified()}};
|
&str => self { tt::Literal{text: format!("\"{}\"", self.escape_default()).into(), id: tt::TokenId::unspecified()}};
|
||||||
String => self { tt::Literal{text: format!("\"{}\"", self.escape_debug()).into(), id: tt::TokenId::unspecified()}}
|
String => self { tt::Literal{text: format!("\"{}\"", self.escape_default()).into(), id: tt::TokenId::unspecified()}}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user