Unnamed repository; edit this file 'description' to name the repository.
Merge #10193
10193: fix: fix type mismatches with `panic!()` on Rust 1.55.0 r=jonas-schievink a=jonas-schievink This addresses the regression mentioned in https://github.com/rust-analyzer/rust-analyzer/issues/8961#issuecomment-916332702 (no test because https://github.com/rust-analyzer/rust-analyzer/issues/10192 makes that rather hard, but I've checked that the analysis-stats are back to normal) bors r+ Co-authored-by: Jonas Schievink <[email protected]>
bors[bot] 2021-09-10
parent 8e47e35 · parent 9a320bc · commit 21a1ced
-rw-r--r--crates/hir_def/src/nameres/collector.rs15
1 files changed, 14 insertions, 1 deletions
diff --git a/crates/hir_def/src/nameres/collector.rs b/crates/hir_def/src/nameres/collector.rs
index 165cdcba00..24083172b3 100644
--- a/crates/hir_def/src/nameres/collector.rs
+++ b/crates/hir_def/src/nameres/collector.rs
@@ -1812,7 +1812,20 @@ impl ModCollector<'_, '_> {
name = tt::Ident { text: it.clone(), id: tt::TokenId::unspecified() }.as_name();
&name
}
- None => &mac.name,
+ None => {
+ match attrs.by_key("rustc_builtin_macro").tt_values().next().and_then(|tt| {
+ match tt.token_trees.first() {
+ Some(tt::TokenTree::Leaf(tt::Leaf::Ident(name))) => Some(name),
+ _ => None,
+ }
+ }) {
+ Some(ident) => {
+ name = ident.as_name();
+ &name
+ }
+ None => &mac.name,
+ }
+ }
};
let krate = self.def_collector.def_map.krate;
match find_builtin_macro(name, krate, ast_id) {