Commit Graph

869 Commits

Author SHA1 Message Date
Lukas Wirth
a82e028e30 Cleanup util::Generics method names 2024-04-06 14:29:40 +02:00
Lukas Wirth
f3567bb604 Arc CrateData::cfg_options 2024-04-06 13:55:10 +02:00
Lukas Wirth
13890697eb Simplify 2024-04-06 13:12:07 +02:00
Lukas Wirth
5957835cdf Consider exported_name="main" functions in test modules as tests 2024-04-04 14:51:10 +02:00
Lukas Wirth
2b62d4b2ba Fix some cfg censoring bugs 2024-04-03 16:43:08 +02:00
Lukas Wirth
707be6b99c Adjust display impls to respect lifetime bounds 2024-04-02 14:51:08 +02:00
Lukas Wirth
0927f86247 Replace static_lifetime usages with error_lifetime, lower outlives goals 2024-04-02 14:51:06 +02:00
dfireBird
69c4ac6304
implement len and is_empty method in generic_params 2024-03-29 18:26:46 +05:30
bors
0583aaa555 Auto merge of #16805 - dfireBird:lifetime_lowering, r=Veykril
feat: Implement resolving and lowering of Lifetimes (no inference yet)
2024-03-26 07:58:43 +00:00
dfireBird
0e54e2b55a
use references in Generics iter methods 2024-03-26 13:04:54 +05:30
Lukas Wirth
8e324e98a1 Rename ProcMacroKind::FuncLike to Bang 2024-03-22 11:20:56 +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
Wyatt Herkamp
c376addfcc Cleanup 2024-03-21 08:12:26 -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
15d183be79 Initial Attempt limiting number of token tree in macro expansion. 2024-03-21 08:06:43 -04: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
255a8aef92 Move Edition into span crate 2024-03-21 10:21:44 +01:00
dfireBird
13301e7a1a
replace static_lifetime with new_lifetime_var where necessary
implemented suggested fixes and changes and fix merge conflicts
2024-03-18 17:53:09 +05:30
dfireBird
a6c8cbfd91
update Generics iter methods to return GenericParamId 2024-03-18 17:18:08 +05:30
dfireBird
f95b3d4cd2
implement resolving and lowering of Lifetimes 2024-03-18 17:18:06 +05:30
Lukas Wirth
b59c8c76db Repalce Span with SyntaxContextId in MacroCallLoc 2024-03-15 12:47:05 +01:00
Lukas Wirth
3b1ad2379d internal: Make def site span for proc-macro more invalidation resistant 2024-03-15 10:14:00 +01:00
Lukas Wirth
d085ade631 Remove dead test code 2024-03-14 16:24:51 +01:00
Lukas Wirth
d2f8eae2ec feat: Support macro calls in eager macros for IDE features 2024-03-14 15:40:35 +01:00
Lukas Wirth
9767156a29 Simplify 2024-03-13 20:02:21 +01:00
Lukas Wirth
abe3177445 Shrink MacroCallLoc 2024-03-13 18:05:27 +01:00
bors
a2e274142f Auto merge of #16819 - Veykril:span-upmapping, r=Veykril
internal: Improve rooted upmapping

cc https://github.com/rust-lang/rust-analyzer/issues/16235
2024-03-12 12:58:52 +00:00
Lukas Wirth
9ba4493918 internal: Improve rooted upmapping 2024-03-12 13:46:58 +01:00
bors
d3e6fea315 Auto merge of #16789 - wyatt-herkamp:cfg_attr, r=Veykril
cfg Attribute Stripping for Proc Macro Expansion

This will attempt to process cfg attributes and cfg_attr attributes for proc macro expansion.
![image](https://github.com/rust-lang/rust-analyzer/assets/11785959/b85ef203-14a5-44c9-9b67-59a65a5f2d96)

Closes #8434 , #11657, and #13904
2024-03-12 10:19:19 +00:00
Wyatt Herkamp
447de3d788 Review Updates and added tests. 2024-03-11 11:05:59 -04:00
bors
8f8bcfc131 Auto merge of #16335 - lnicola:salsa-lz4-file-text, r=Veykril
internal: Compress file text using LZ4

I haven't tested properly, but this roughly looks like:

```
1246 MB
    59mb   4899 FileTextQuery

1008 MB
    20mb   4899 CompressedFileTextQuery
   555kb   1790 FileTextQuery
```

We might want to test on something more interesting, like `bevy`.
2024-03-11 13:43:33 +00:00
bors
2320e12541 Auto merge of #16771 - Veykril:self-param-split, r=Veykril
internal: Don't desugar self param into a pattern

Small experiment to see if this simplifies things
2024-03-11 12:45:46 +00:00
Lukas Wirth
458f4a2960 internal: Treat the self param as different from patterns when lowering 2024-03-11 09:46:28 +01:00
Lukas Wirth
558feeab61 internal: Remove synstructure const hack support 2024-03-11 09:44:40 +01:00
Laurențiu Nicola
0f43b55e83 Stop using an Arc when setting the file text 2024-03-08 20:30:12 +02:00
Laurențiu Nicola
02b6c181dd Compress file text using lz4 in salsa 2024-03-08 20:22:08 +02:00
Lukas Wirth
09b9a921a8 fix: Don't invalid body query results when generating desugared names 2024-03-07 15:03:16 +01:00
Lukas Wirth
c04c0dd5ba fix: Don't force draw a dependency edge to the real_span_map query 2024-03-07 14:14:59 +01:00
Lukas Wirth
a3b6e891ea Add tracing spans to macro generated database 2024-03-06 20:19:36 +01:00
roife
ece18fecfa fix: resolve sub-patterns inside range pattern 2024-03-05 19:31:20 +08:00
Lukas Wirth
c3c9f5ffe1 internal: Compute syntax validation errors on demand 2024-03-04 12:06:15 +01:00
Lukas Wirth
4303e741de Cleanup 2024-03-04 11:10:06 +01:00
Lukas Wirth
efd76ecff1 Move AstIdMap infra to the span crate 2024-03-01 15:39:44 +01:00
Lukas Wirth
91554e0ae7 fix: Fix modules in blocks not resolving in ide layer 2024-02-26 14:54:47 +01:00
Lukas Wirth
d93096ecc0 internal: Fetch toolchain and datalayout for DetachedFiles 2024-02-20 10:40:39 +01:00
bors
2223b4fa71 Auto merge of #13112 - lowr:patch/auto-trait-bounds, r=Veykril
Setup infra for handling auto trait bounds disabled due to perf problems

This patch updates some of the partially-implemented functions of `ChalkContext as RustIrDatabase`, namely `adt_datum()` and `impl_provided_for()`. With those, we can now correctly work with auto trait bounds and distinguish methods based on them.

Resolves #7856 (the second code; the first one is resolved by #13074)

**IMPORTANT**: I don't think we want to merge this until #7637 is resolved. Currently this patch introduces A LOT of unknown types and type mismtaches as shown below. This is because we cannot resolve items like `hashbrown::HashMap` in `std` modules, leading to auto trait bounds on them and their dependents unprovable.

|crate (from `rustc-perf@c52ee6` except for r-a)|e3dc5a588f07d6f1d3a0f33051d4af26190abe9e|HEAD of this branch|
|---|---|---|
|rust-analyzer @ e3dc5a588f |exprs: 417528, ??ty: 907 (0%), ?ty: 114 (0%), !ty: 1|exprs: 417528, ??ty: 1704 (0%), ?ty: 403 (0%), !ty: 20|
|ripgrep|exprs: 62120, ??ty: 2 (0%), ?ty: 0 (0%), !ty: 0|exprs: 62120, ??ty: 132 (0%), ?ty: 58 (0%), !ty: 11|
|webrender/webrender|exprs: 94355, ??ty: 49 (0%), ?ty: 16 (0%), !ty: 2|exprs: 94355, ??ty: 429 (0%), ?ty: 130 (0%), !ty: 7|
|diesel|exprs: 132591, ??ty: 401 (0%), ?ty: 5129 (3%), !ty: 31|exprs: 132591, ??ty: 401 (0%), ?ty: 5129 (3%), !ty: 31|
2024-02-19 16:45:59 +00:00