rust/crates
bors daa03b0b0b Auto merge of #14800 - lowr:patch/macro-subns-and-prelude, r=Veykril
Expand more single ident macro calls upon item collection

Addresses https://github.com/rust-lang/rust-analyzer/pull/14781#issuecomment-1546201022

I believe this (almost) brings the number of unresolved names back to pre-#14781:

|r-a version|`analysis-stats compiler/rustc` (rust-lang/rust@69fef92ab2) |
|---|---|
|pre-#14781 (b069eb720b) | exprs: 2747778, ??ty: 122236 (4%), ?ty: 107826 (3%), !ty: 728 |
| #14781 (a7944a93a1) | exprs: 2713080, ??ty: 139651 (5%), ?ty: 114444 (4%), !ty: 730 |
| with this fix | exprs: 2747871, ??ty: 122237 (4%), ?ty: 108171 (3%), !ty: 676 |

(I haven't investigated on the increase in some numbers but hopefully not too much of a problem)

This is only a temporary solution. The core problem is that we haven't fully implemented the textual scope of legacy macros. For example, we *have been* failing to resolve `foo` in the following snippet, even before #14781 or after this patch. As noted in a FIXME, we need a way to resolve names in textual scope without eager expansion during item collection.

```rust
//- /main.rs crate:main deps:lib
lib::mk_foo!();
const A: i32 = foo!();
             //^^^^^^ unresolved-macro-call

//- /lib.rs crate:lib
#[macro_export]
macro_rules! mk_foo {
    () => {
        macro_rules! foo { () => { 42 } }
    }
}
```
2023-05-13 18:47:42 +00:00
..
base-db fix: Fix body lowering not using block def maps 2023-05-04 20:46:05 +02:00
cfg ⬆️ rust-analyzer 2023-02-13 13:55:14 +02:00
flycheck Bump Cargo.lock 2023-03-25 15:12:39 +01:00
hir fix: Fix perf regression from symbol index refactor 2023-05-13 17:41:09 +02:00
hir-def Auto merge of #14800 - lowr:patch/macro-subns-and-prelude, r=Veykril 2023-05-13 18:47:42 +00:00
hir-expand Use double reference in debug derive 2023-05-12 12:36:57 +03:30
hir-ty Auto merge of #14781 - lowr:patch/macro-subns-and-prelude, r=Veykril 2023-05-11 14:26:59 +00:00
ide Auto merge of #14797 - Veykril:symbol-query, r=Veykril 2023-05-13 15:41:54 +00:00
ide-assists Fix pattern type mismatch in tuples 2023-05-04 16:03:36 +03:30
ide-completion Auto merge of #14513 - hecatia-elegua:alias-based-completion2, r=Veykril 2023-04-24 06:34:25 +00:00
ide-db fix: Fix perf regression from symbol index refactor 2023-05-13 17:41:09 +02:00
ide-diagnostics Use double reference in debug derive 2023-05-12 12:36:57 +03:30
ide-ssr Depend on nohash-hasher individually 2023-05-06 00:49:23 -07:00
intern Use triomphe Arc 2023-05-02 20:02:43 +03:00
limit Move Expander and LowerCtx into separate modules 2023-04-17 20:44:06 +02:00
mbe Use boxed slices instead ovecs in decl macros 2023-05-02 17:04:53 +02:00
parser Parse bare dyn types with leading lifetime 2023-05-05 04:30:37 +09:00
paths Add AbsPath::absolutize 2023-05-13 11:51:28 +02:00
proc-macro-api Use triomphe Arc 2023-05-02 20:02:43 +03:00
proc-macro-srv Encode closing delimiter span in FlatTrees 2023-04-14 10:34:41 +02:00
proc-macro-srv-cli Remove proc-macro server command from the rust-analyzer binary 2023-04-26 08:19:28 +02:00
proc-macro-test ⬆️ rust-analyzer 2023-02-13 13:55:14 +02:00
profile internal: Add some additional status ouput 2023-04-22 09:34:47 +02:00
project-model Add AbsPath::absolutize 2023-05-13 11:51:28 +02:00
rust-analyzer Remove root from patched UNC windows path drives 2023-05-13 18:38:12 +02:00
sourcegen Use retain_mut in CommentBlock::extract 2023-03-31 17:41:40 -04:00
stdx Depend on nohash-hasher individually 2023-05-06 00:49:23 -07:00
syntax Use triomphe Arc 2023-05-02 20:02:43 +03:00
test-utils Use double reference in debug derive 2023-05-12 12:36:57 +03:30
text-edit Make text-size a workspace dep 2023-05-06 00:49:23 -07:00
toolchain ⬆️ rust-analyzer 2023-03-13 10:42:24 +02:00
tt Emit function bodies in expanding builtin derives 2023-05-03 14:14:47 +03:30
vfs Depend on nohash-hasher individually 2023-05-06 00:49:23 -07:00
vfs-notify ⬆️ rust-analyzer 2023-02-13 13:55:14 +02:00