Commit Graph

28193 Commits

Author SHA1 Message Date
bors
fc0d51ae65 Auto merge of #16919 - roife:fix-issue-16800, r=Veykril
fix: handle self::super when lowering UseTree

fix #16800.
2024-03-22 07:45:50 +00:00
roife
0e8170e846 fix: handle self::super in lowering of UseTree 2024-03-22 15:36:00 +08:00
bors
5577612fd0 Auto merge of #16918 - Veykril:utf8-paths, r=Veykril
fix: Don't assert paths being utf8 when filtering them in the watcher

Closes https://github.com/rust-lang/rust-analyzer/issues/16914
2024-03-22 07:06:13 +00:00
Lukas Wirth
ea447062c4 fix: Don't assert paths being utf8 when filtering them in the watcher 2024-03-22 08:04:50 +01:00
6d7a
7c1be82cd9 fix: Prevent stack overflow in recursive const types
In the evaluation of const values of recursive types
certain declarations could cause an endless call-loop
within the interpreter (hir-ty’s create_memory_map),
which would lead to a stack overflow.
This commit adds a check that prevents values that contain
an address in their value (such as TyKind::Ref) from being
allocated at the address they contain.
The commit also adds a test for this edge case.
2024-03-21 22:57:21 +01:00
bors
7ef7f442fc Auto merge of #16913 - Veykril:client-watched-files, r=Veykril
fix: Some file watching related vfs fixes

Fixes https://github.com/rust-lang/rust-analyzer/issues/15554, additionally it seems that client side file watching was broken on windows this entire time, this PR switches `DidChangeWatchedFilesRegistrationOptions` to use relative glob patterns which do work on windows in VSCode.
2024-03-21 20:29:02 +00:00
Lukas Wirth
fe28e470cd Use relative glob patterns in DidChangeWatchedFilesRegistrationOptions 2024-03-21 21:27:34 +01:00
Lukas Wirth
23613a9de7 fix: Some file watching related vfs fixes 2024-03-21 21:22:19 +01:00
bors
4d442d84d7 Auto merge of #16912 - Veykril:span-trait, r=Veykril
internal: Remove span trait
2024-03-21 19:11:12 +00:00
Lukas Wirth
cd8eb0fe6d internal: Remove span trait 2024-03-21 20:08:30 +01:00
bors
16c8deeb86 Auto merge of #16835 - wyatt-herkamp:use_one_tt_for_a_derive, r=Veykril
Have Derive Attribute share a token tree with it's proc macros.

The goal of this PR is to stop creating a token tree for each derive proc macro.

This is done by giving the derive proc macros an id to its parent derive element.

From running the analysis stat on the rust analyzer project I did see a small memory decrease.

```
Inference:           42.80s, 362ginstr, 591mb
MIR lowering:        8.67s, 67ginstr, 291mb
Mir failed bodies: 18 (0%)
Data layouts:        85.81ms, 609minstr, 8mb
Failed data layouts: 135 (6%)
Const evaluation:    440.57ms, 5235minstr, 13mb
Failed const evals: 1 (0%)
Total:               64.16s, 552ginstr, 1731mb
```
After Change
```
Inference:           40.32s, 340ginstr, 593mb
MIR lowering:        7.95s, 62ginstr, 292mb
Mir failed bodies: 18 (0%)
Data layouts:        87.97ms, 591minstr, 8mb
Failed data layouts: 135 (6%)
Const evaluation:    433.38ms, 5226minstr, 14mb
Failed const evals: 1 (0%)
Total:               60.49s, 523ginstr, 1680mb
```

Currently this breaks the expansion for the actual derive attribute.

## TODO
- [x] Pick a better name for the function `smart_macro_arg`
2024-03-21 18:04:38 +00:00
Wyatt Herkamp
c381d0fc64 Review Updates 2024-03-21 13:41:46 -04:00
Wyatt Herkamp
262e06f1ef Remove MacroCallKind::DeriveAttr 2024-03-21 12:50:58 -04:00
bors
a3d96253a9 Auto merge of #16911 - Veykril:rustc-crates, r=Veykril
fix: Fix projects depending on `rustc_private` hanging

If loading the root fails, we'll hang up in this loop as we never inserted the entry that asserts we already visited a package. This fixes that
Fixes https://github.com/rust-lang/rust-analyzer/issues/16902
2024-03-21 15:58:27 +00:00
Lukas Wirth
2ad14b8069 fix: Fix projects depending on rustc_private hanging 2024-03-21 16:55:42 +01:00
bors
20290b2992 Auto merge of #16909 - Veykril:spans, r=Veykril
fix: Keep the span for `Attr::Literal` around
2024-03-21 15:04:17 +00:00
Wyatt Herkamp
c376addfcc Cleanup 2024-03-21 08:12:26 -04:00
Wyatt Herkamp
70f5344deb macro_arg_considering_derives is now in ExpandDatabase and now takes in the MacroCallKind 2024-03-21 08:07:54 -04:00
Wyatt Herkamp
2c2bbe07fd Treat Derive Macro specially. 2024-03-21 08:07:54 -04:00
Wyatt Herkamp
4bd2f948bb Formatting 2024-03-21 08:07:54 -04:00
Wyatt Herkamp
f499564d0a censor attribute derive 2024-03-21 08:06:43 -04:00
Wyatt Herkamp
15d183be79 Initial Attempt limiting number of token tree in macro expansion. 2024-03-21 08:06:43 -04:00
bors
83f9cc677f Auto merge of #16895 - Veykril:spans, r=Veykril
Resolve whether `$pat` is `$pat_param` or not via 🌟hygiene🌟

Before we just picked the edition from the macro def which is wrong, since a macro call can produce the fragment kind from a different definition site.
2024-03-21 11:04:41 +00:00
Lukas Wirth
0036762b9d Make use of ThinArc in RawAttrs 2024-03-21 11:49:09 +01:00
Lukas Wirth
928d847cc2 Keep the span for Attr::Literal 2024-03-21 10:28:25 +01:00
Lukas Wirth
6d1071962f Resolve whether $pat is $pat_param or not via 🌟hygiene🌟 2024-03-21 10:22:45 +01:00
Lukas Wirth
7e88fa5d3a Remove span generics from most of the mbe crate 2024-03-21 10:21:44 +01:00
Lukas Wirth
255a8aef92 Move Edition into span crate 2024-03-21 10:21:44 +01:00
bors
8d74705b43 Auto merge of #16904 - lnicola:bump-rust-cache, r=lnicola
internal: Bump rust-cache action

Fixes a Node 16 deprecation warning and also pulls in https://github.com/Swatinem/rust-cache/pull/147, which sounds interesting.
2024-03-21 06:42:21 +00:00
Laurențiu Nicola
79183394aa Bump rust-cache action 2024-03-21 08:34:18 +02:00
bors
dc2e0b35cc Auto merge of #16891 - goodmost:master, r=lnicola
chore: remove repetitive words
2024-03-21 06:29:33 +00:00
bors
5e276ae51c Auto merge of #16899 - Veykril:discover-fix, r=Veykril
fix: Fix project discovery not checking whether the `Cargo.toml` actually exists

Got dropped in https://github.com/rust-lang/rust-analyzer/pull/16889, somehow r-a's codebase itself doesn't even run into this so I didn't see it when testing ...
2024-03-20 13:41:39 +00:00
Lukas Wirth
c7f02012b1 fix: Fix project discovery not checking whether the Cargo.toml actually exists 2024-03-20 14:39:35 +01:00
bors
6fce1d71df Auto merge of #16892 - Veykril:crate-graph-non-eager, r=Veykril
internal: Don't eagerly try to read crate root file contents before VFS

Fixes https://github.com/rust-lang/rust-analyzer/issues/8623
2024-03-19 15:36:26 +00:00
Lukas Wirth
7b91d01360 internal: Don't eagerly try to read crate root file contents before VFS 2024-03-19 16:12:56 +01:00
bors
4e54b4bd6c Auto merge of #16889 - Veykril:utf8-path, r=Veykril
internal: Enforce utf8 paths

Cargo already requires this, and I highly doubt r-a works with non-utf8 paths generally either. This just makes dealing with paths a lot easier.
2024-03-19 14:57:18 +00:00
bors
a2f73d3142 Auto merge of #16879 - Nadrieril:fuel, r=Veykril
Add fuel to match checking

Exhaustiveness checking is NP-hard hence can take extremely long to check some specific matches. This PR makes ehxaustiveness bail after a set number of steps. I chose a bound that takes ~100ms on my machine, which should be more than enough for normal matches.

I'd like someone with less recent hardware to run the test to see if that limit is low enough for them. Also curious if the r-a team thinks this is a good ballpark or if we should go lower/higher. I don't have much data on how complex real-life matches get, but we can definitely go lower than `500 000` steps.

The second commit is a drive-by soundness fix which doesn't matter much today but will matter once `min_exhaustive_patterns` is stabilized.

Fixes https://github.com/rust-lang/rust-analyzer/issues/9528 cc `@matklad`
2024-03-19 14:44:05 +00:00
Lukas Wirth
399dbc074b internal: Enforce utf8 paths 2024-03-19 15:39:00 +01:00
goodmost
d6b0aae019 chore: remove repetitive words
Signed-off-by: goodmost <zhaohaiyang@outlook.com>
2024-03-19 22:14:13 +08:00
Nadrieril
08a5f1e52a Skip the test when testing locally 2024-03-19 15:08:57 +01:00
bors
e03df77d04 Auto merge of #16812 - ShoyuVanilla:issue-3739, r=Veykril
fix: Goto implementation to impls inside blocks

Fixes #3739
2024-03-19 13:15:36 +00:00
Shoyu Vanilla
967a864d03 fix: Goto implementation to impls inside blocks 2024-03-19 22:04:48 +09:00
bors
b91697de8f Auto merge of #16886 - Veykril:dev-deps-delay, r=Veykril
internal: Delay drawing of workspace dev-dependency edges

Follow up to https://github.com/rust-lang/rust-analyzer/pull/16871

With this we should prefer non-dev deps if they do form a cycle, https://github.com/rust-lang/rust-analyzer/issues/14167
2024-03-19 10:39:54 +00:00
Lukas Wirth
ba339596bf internal: Delay drawing of workspace dev-dependency edges 2024-03-19 11:37:27 +01:00
bors
1c2d7d02ea Auto merge of #16884 - Veykril:grammar-codegen, r=Veykril
internal: Move grammar codegen into xtask

https://github.com/rust-lang/rust-analyzer/issues/14778, also threw in the one line fix for https://github.com/rust-lang/rust-analyzer/issues/13912
2024-03-19 10:11:42 +00:00
bors
054ebf9482 Auto merge of #16885 - Veykril:match-recovery, r=Veykril
fix: Improve error recovery for match arms

This should make use of the recovery token sets, but I think it'd be better to fix that as a whole while fixing the other places for these adhoc recovery checks.
2024-03-19 09:58:31 +00:00
Lukas Wirth
b38d5394bb internal: Move grammar codegen into xtask 2024-03-19 10:57:53 +01:00
Lukas Wirth
dc4e5987a4 fix: Improve error recovery for match arms 2024-03-19 10:55:47 +01:00
bors
c626db048c Auto merge of #16883 - Veykril:progress-report, r=Veykril
minor: Do progress reporting for crate-graph construction

Also fixes https://github.com/rust-lang/rust-analyzer/issues/16828
2024-03-19 09:08:56 +00:00
Lukas Wirth
232125be12 minor: Do progress reporting for crate-graph construction 2024-03-19 10:06:51 +01:00