diff options
| author | bors <bors@rust-lang.org> | 2023-05-13 18:47:42 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2023-05-13 18:47:42 +0000 |
| commit | daa03b0b0be6bd51dd43f4556dd4e27649bc6f57 (patch) | |
| tree | 8e273656d17347bcc25e38f674dc3ea246bfca0c /tests/mir-opt/lower_array_len.array_len.NormalizeArrayLen.panic-abort.diff | |
| parent | f38264fa567144adba2d846347d66e00b9d08f35 (diff) | |
| parent | e9ddb62c658b35e3026c470217f38a465f2a3dc7 (diff) | |
| download | rust-daa03b0b0be6bd51dd43f4556dd4e27649bc6f57.tar.gz rust-daa03b0b0be6bd51dd43f4556dd4e27649bc6f57.zip | |
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@69fef92ab2f287f072b66fb7b4f62c8bb4acba43) |
|---|---|
|pre-#14781 (b069eb720bec6ce40ab224f57d271687b19b5a07) | exprs: 2747778, ??ty: 122236 (4%), ?ty: 107826 (3%), !ty: 728 |
| #14781 (a7944a93a1520b96f079bbbcd841d6aec9e4ba5d) | 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 } }
}
}
```
Diffstat (limited to 'tests/mir-opt/lower_array_len.array_len.NormalizeArrayLen.panic-abort.diff')
0 files changed, 0 insertions, 0 deletions
