aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_def/src
diff options
context:
space:
mode:
Diffstat (limited to 'crates/hir_def/src')
-rw-r--r--crates/hir_def/src/nameres/collector.rs12
1 files changed, 11 insertions, 1 deletions
diff --git a/crates/hir_def/src/nameres/collector.rs b/crates/hir_def/src/nameres/collector.rs
index 6f946a6dd..c8f494707 100644
--- a/crates/hir_def/src/nameres/collector.rs
+++ b/crates/hir_def/src/nameres/collector.rs
@@ -1402,8 +1402,18 @@ impl ModCollector<'_, '_> {
1402 1402
1403 // Case 1: builtin macros 1403 // Case 1: builtin macros
1404 if attrs.by_key("rustc_builtin_macro").exists() { 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 let krate = self.def_collector.def_map.krate; 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 self.def_collector.define_macro_rules( 1417 self.def_collector.define_macro_rules(
1408 self.module_id, 1418 self.module_id,
1409 mac.name.clone(), 1419 mac.name.clone(),