@@ -83,8 +83,10 @@ pub(crate) fn expand_macro(db: &RootDatabase, position: FilePosition) -> Option<
8383 }
8484 }
8585 if let Some ( mac) = ast:: MacroCall :: cast ( node) {
86+ let mut name = mac. path ( ) ?. segment ( ) ?. name_ref ( ) ?. to_string ( ) ;
87+ name. push ( '!' ) ;
8688 break (
87- mac . path ( ) ? . segment ( ) ? . name_ref ( ) ? . to_string ( ) ,
89+ name ,
8890 expand_macro_recur ( & sema, & mac) ?,
8991 mac. syntax ( ) . parent ( ) . map ( |it| it. kind ( ) ) . unwrap_or ( SyntaxKind :: MACRO_ITEMS ) ,
9092 ) ;
@@ -235,7 +237,7 @@ fn main() {
235237}
236238"# ,
237239 expect ! [ [ r#"
238- bar
240+ bar!
239241 5i64 as _"# ] ] ,
240242 ) ;
241243 }
@@ -252,7 +254,7 @@ fn main() {
252254}
253255"# ,
254256 expect ! [ [ r#"
255- bar
257+ bar!
256258 for _ in 0..42{}"# ] ] ,
257259 ) ;
258260 }
@@ -273,7 +275,7 @@ macro_rules! baz {
273275f$0oo!();
274276"# ,
275277 expect ! [ [ r#"
276- foo
278+ foo!
277279 fn b(){}
278280 "# ] ] ,
279281 ) ;
@@ -294,7 +296,7 @@ macro_rules! foo {
294296f$0oo!();
295297 "# ,
296298 expect ! [ [ r#"
297- foo
299+ foo!
298300 fn some_thing() -> u32 {
299301 let a = 0;
300302 a+10
@@ -328,16 +330,16 @@ fn main() {
328330}
329331"# ,
330332 expect ! [ [ r#"
331- match_ast
332- {
333- if let Some(it) = ast::TraitDef::cast(container.clone()){}
334- else if let Some(it) = ast::ImplDef::cast(container.clone()){}
335- else {
336- {
337- continue
338- }
339- }
340- }"# ] ] ,
333+ match_ast!
334+ {
335+ if let Some(it) = ast::TraitDef::cast(container.clone()){}
336+ else if let Some(it) = ast::ImplDef::cast(container.clone()){}
337+ else {
338+ {
339+ continue
340+ }
341+ }
342+ }"# ] ] ,
341343 ) ;
342344 }
343345
@@ -358,7 +360,7 @@ fn main() {
358360}
359361"# ,
360362 expect ! [ [ r#"
361- match_ast
363+ match_ast!
362364 {}"# ] ] ,
363365 ) ;
364366 }
@@ -383,7 +385,7 @@ fn main() {
383385}
384386 "# ,
385387 expect ! [ [ r#"
386- foo
388+ foo!
387389 {
388390 macro_rules! bar {
389391 () => {
@@ -411,7 +413,7 @@ fn main() {
411413}
412414"# ,
413415 expect ! [ [ r#"
414- foo
416+ foo!
415417 "# ] ] ,
416418 ) ;
417419 }
@@ -433,7 +435,7 @@ fn main() {
433435}
434436"# ,
435437 expect ! [ [ r#"
436- foo
438+ foo!
437439 0"# ] ] ,
438440 ) ;
439441 }
@@ -451,7 +453,7 @@ fn main() {
451453}
452454"# ,
453455 expect ! [ [ r#"
454- foo
456+ foo!
455457 fn f<T>(_: &dyn ::std::marker::Copy){}"# ] ] ,
456458 ) ;
457459 }
0 commit comments