Merge #10870
10870: ide: fix macro expansion for 'as _' r=Veykril a=jhgg fixes: #10862 Co-authored-by: Jake Heinz <jh@discordapp.com>
This commit is contained in:
commit
90c435519d
@ -176,6 +176,10 @@ fn insert_whitespaces(syn: SyntaxNode) -> String {
|
||||
res.push_str(token.text());
|
||||
res.push(' ');
|
||||
}
|
||||
AS_KW => {
|
||||
res.push_str(token.text());
|
||||
res.push(' ');
|
||||
}
|
||||
T![;] => {
|
||||
res.push_str(";\n");
|
||||
res.extend(iter::repeat(" ").take(2 * indent));
|
||||
@ -210,6 +214,23 @@ mod tests {
|
||||
expect.assert_eq(&actual);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn macro_expand_as_keyword() {
|
||||
check(
|
||||
r#"
|
||||
macro_rules! bar {
|
||||
($i:tt) => { $i as _ }
|
||||
}
|
||||
fn main() {
|
||||
let x: u64 = ba$0r!(5i64);
|
||||
}
|
||||
"#,
|
||||
expect![[r#"
|
||||
bar
|
||||
5i64 as _"#]],
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn macro_expand_recursive_expansion() {
|
||||
check(
|
||||
|
Loading…
x
Reference in New Issue
Block a user