File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed
crates/hir_def/src/nameres Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -1402,8 +1402,18 @@ impl ModCollector<'_, '_> {
1402
1402
1403
1403
// Case 1: builtin macros
1404
1404
if attrs. by_key ( "rustc_builtin_macro" ) . exists ( ) {
1405
+ // `#[rustc_builtin_macro = "builtin_name"]` overrides the `macro_rules!` name.
1406
+ let name;
1407
+ let name = match attrs. by_key ( "rustc_builtin_macro" ) . string_value ( ) {
1408
+ Some ( it) => {
1409
+ // FIXME: a hacky way to create a Name from string.
1410
+ name = tt:: Ident { text : it. clone ( ) , id : tt:: TokenId :: unspecified ( ) } . as_name ( ) ;
1411
+ & name
1412
+ }
1413
+ None => & mac. name ,
1414
+ } ;
1405
1415
let krate = self . def_collector . def_map . krate ;
1406
- if let Some ( macro_id) = find_builtin_macro ( & mac . name , krate, ast_id) {
1416
+ if let Some ( macro_id) = find_builtin_macro ( name, krate, ast_id) {
1407
1417
self . def_collector . define_macro_rules (
1408
1418
self . module_id ,
1409
1419
mac. name . clone ( ) ,
You can’t perform that action at this time.
0 commit comments