@@ -177,7 +177,9 @@ fn _format(
177177 use ide_db:: base_db:: { FileLoader , SourceDatabase } ;
178178 // hack until we get hygiene working (same character amount to preserve formatting as much as possible)
179179 const DOLLAR_CRATE_REPLACE : & str = "__r_a_" ;
180- let expansion = expansion. replace ( "$crate" , DOLLAR_CRATE_REPLACE ) ;
180+ const BUILTIN_REPLACE : & str = "builtin__POUND" ;
181+ let expansion =
182+ expansion. replace ( "$crate" , DOLLAR_CRATE_REPLACE ) . replace ( "builtin #" , BUILTIN_REPLACE ) ;
181183 let ( prefix, suffix) = match kind {
182184 SyntaxKind :: MACRO_PAT => ( "fn __(" , ": u32);" ) ,
183185 SyntaxKind :: MACRO_EXPR | SyntaxKind :: MACRO_STMTS => ( "fn __() {" , "}" ) ,
@@ -206,7 +208,9 @@ fn _format(
206208 let captured_stdout = String :: from_utf8 ( output. stdout ) . ok ( ) ?;
207209
208210 if output. status . success ( ) && !captured_stdout. trim ( ) . is_empty ( ) {
209- let output = captured_stdout. replace ( DOLLAR_CRATE_REPLACE , "$crate" ) ;
211+ let output = captured_stdout
212+ . replace ( DOLLAR_CRATE_REPLACE , "$crate" )
213+ . replace ( BUILTIN_REPLACE , "builtin #" ) ;
210214 let output = output. trim ( ) . strip_prefix ( prefix) ?;
211215 let output = match kind {
212216 SyntaxKind :: MACRO_PAT => {
0 commit comments