We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 9f447ad + dca8f61 commit 90c4355Copy full SHA for 90c4355
crates/ide/src/expand_macro.rs
@@ -176,6 +176,10 @@ fn insert_whitespaces(syn: SyntaxNode) -> String {
176
res.push_str(token.text());
177
res.push(' ');
178
}
179
+ AS_KW => {
180
+ res.push_str(token.text());
181
+ res.push(' ');
182
+ }
183
T![;] => {
184
res.push_str(";\n");
185
res.extend(iter::repeat(" ").take(2 * indent));
@@ -210,6 +214,23 @@ mod tests {
210
214
expect.assert_eq(&actual);
211
215
212
216
217
+ #[test]
218
+ fn macro_expand_as_keyword() {
219
+ check(
220
+ r#"
221
+macro_rules! bar {
222
+ ($i:tt) => { $i as _ }
223
+}
224
+fn main() {
225
+ let x: u64 = ba$0r!(5i64);
226
227
+"#,
228
+ expect![[r#"
229
+ bar
230
+ 5i64 as _"#]],
231
+ );
232
233
+
213
234
#[test]
235
fn macro_expand_recursive_expansion() {
236
check(
0 commit comments