Commit Graph

20806 Commits

Author SHA1 Message Date
Lukas Wirth
cc04cfc982 Reduce allocations in attribute collection 2022-01-30 22:18:32 +01:00
bors[bot]
c08df0f1f5
Merge #11377
11377: Update README.md r=flodiebold a=flodiebold

I'm not currently sponsored anymore.

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2022-01-30 13:23:47 +00:00
Florian Diebold
b36c83032b Update README.md
I'm not currently sponsored anymore.
2022-01-30 14:21:52 +01:00
bors[bot]
6010431a0b
Merge #11356
11356: Rollback env vars changed by a proc macro r=vlad20012 a=vlad20012

Fixes #11355

Co-authored-by: vlad20012 <beskvlad@gmail.com>
2022-01-30 08:05:55 +00:00
bors[bot]
6634eaf13a
Merge #11367
11367: minor: Use `compare_exchange_weak` in `limit::Limit::check` r=lnicola a=WaffleLapkin

Not a big deal, but generally loops should use `_weak` version of `compare_exchange`.

Co-authored-by: Maybe Waffle <waffle.lapkin@gmail.com>
2022-01-28 15:31:52 +00:00
Maybe Waffle
78a3cefc45 Use compare_exchange_weak in limit::Limit::check 2022-01-28 18:19:35 +03:00
bors[bot]
4aadabc735
Merge #11365
11365: Add a way to disable dll copying for users of proc_macro_srv library r=lnicola a=vlad20012

We use `ra_ap_proc_macro_srv` library in IntelliJ Rust in order to expand proc macros. We need a way to disable [DLL copying to a temp dir on Windows](https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/proc_macro_srv/src/dylib.rs#L166) behavior because it causes issues like https://github.com/intellij-rust/intellij-rust/issues/7709. Unlike RA, file locking is not an issue for IntelliJ Rust because we copy DLLs to a temp dir before calling the expander.

Co-authored-by: vlad20012 <beskvlad@gmail.com>
2022-01-28 13:21:24 +00:00
vlad20012
e277d5d64e
Add a way to disable dll copying for users of proc_macro_srv library 2022-01-28 16:18:25 +03:00
bors[bot]
cd6521e5de
Merge #11360
11360: feat: Support `#![recursion_limit]` attribute r=Veykril a=WaffleLapkin

![Peek 2022-01-28 02-33](https://user-images.githubusercontent.com/38225716/151508617-ac802b53-f088-4cac-b260-2cd077f3d32c.gif)

Resolves #8640

`@matklad` thanks, for the instructions, they were very helpful :)

Co-authored-by: Maybe Waffle <waffle.lapkin@gmail.com>
2022-01-28 10:58:21 +00:00
vlad20012
e93386f6ce
Rollback env vars changed by a proc macro 2022-01-28 13:43:29 +03:00
Maybe Waffle
6d18c5b69d feat: Honor recursion limit configuration
This patch makes RA understand `#![recursion_limit = "N"]` annotations.

- `crate_limits` query is moved to `DefDatabase`
- `DefMap` now has `recursion_limit: Option<u32>` field
2022-01-28 11:31:59 +03:00
Maybe Waffle
81211f538c Use crate_limits query in macro expansion 2022-01-28 11:31:59 +03:00
Maybe Waffle
c932ca5f1c Add crate_limits query to SourceDatabase
This allows fetching crate limits like `recursion_limit`. The
implementation is currently dummy and just returns the defaults.

Future work: Use this query instead of the hardcoded constant.

Future work: Actually implement this query by parsing
`#![recursion_limit = N]` attribute.
2022-01-28 11:31:59 +03:00
bors[bot]
93036aa0e2
Merge #11288
11288: Support <code> blocks from Rust docs in vscode hover r=oandrew a=oandrew

Set `"supportHtml": true` to support rendering `<code>` blocks in hovers.

e.g.  1bd4fdc943/library/std/src/fs.rs (L109)

Co-authored-by: Andrew Onyshchuk <andryk.rv@gmail.com>
2022-01-27 22:26:34 +00:00
Andrew Onyshchuk
a05e09acbe Support <code> blocks from Rust docs 2022-01-27 11:46:04 -08:00
bors[bot]
b55a1c561a
Merge #11353
11353: Set current working directory for procedural macros r=vlad20012 a=vlad20012

Fixes #11079

Co-authored-by: vlad20012 <beskvlad@gmail.com>
2022-01-27 18:09:08 +00:00
bors[bot]
15d8f0c466
Merge #11354
11354: fix: More correct `$crate` handling in eager macros r=jonas-schievink a=jonas-schievink

Fixes a few of the additional bugs in https://github.com/rust-analyzer/rust-analyzer/issues/10300, but not yet that issue itself.

bors r+

Co-authored-by: Jonas Schievink <jonas.schievink@ferrous-systems.com>
2022-01-27 15:59:18 +00:00
Jonas Schievink
6c0fcb5b5d More correct $crate handling in eager macros 2022-01-27 16:57:53 +01:00
vlad20012
6051318744
Set current working directory for procedural macros 2022-01-27 16:18:12 +03:00
bors[bot]
e149a15edd
Merge #11348
11348: fix: Fix merge commit check for git 2.35 r=jonas-schievink a=jonas-schievink

git 2.35 introduces a [change in behavior](89bece5c8c/Documentation/RelNotes/2.35.0.txt (L330-L333)) that breaks this check.

bors r+

Co-authored-by: Jonas Schievink <jonas.schievink@ferrous-systems.com>
2022-01-26 18:11:47 +00:00
Jonas Schievink
3c51aaf065 Fix merge commit check for git 2.35 2022-01-26 19:10:39 +01:00
bors[bot]
28b65d3e0c
Merge #11347
11347: fix: Fix resolution of eager macro contents r=jonas-schievink a=jonas-schievink

Eager macros resolve and expand any contained macro invocations before they are expanded. The logic for this was previously pretty broken: any nameres failure would be reported as a generic macro expansion error, so this didn't work correctly with the fixed-point resolution loop. This manifested as spurious errors whenever a non-legacy macro was used in an eager macro (that means *any* path with more than one segment).

After an intense staring contest with the abyss, this PR fixes the basic logic, but some bugs still remain (particularly around `$crate`). As a side-effect, this PR moves `ModPath` into `hir_expand`.

bors r+

Co-authored-by: Jonas Schievink <jonas.schievink@ferrous-systems.com>
2022-01-26 17:35:51 +00:00
Jonas Schievink
35e5c3b3f9 Fix resolution of eager macro contents 2022-01-26 18:31:07 +01:00
bors[bot]
1f0c20e8ba
Merge #11345
11345: minor: fix a typo in the style guide r=Veykril a=WaffleLapkin

An example of preferring `<`/`<=` over `>`/`>=` was using `>`.

Co-authored-by: Waffle Maybe <waffle.lapkin@gmail.com>
2022-01-26 14:14:36 +00:00
Waffle Maybe
6ab66d4c9a
minor: fix a typo in the style guide 2022-01-26 17:07:17 +03:00
bors[bot]
2cb85c14b6
Merge #11281
11281: ide: parallel prime caches r=jonas-schievink a=jhgg

cache priming goes brrrr... the successor to #10149

---

this PR implements a parallel cache priming strategy that uses a topological work queue to feed a pool of worker threads the crates to index in parallel.

## todo
- [x] should we keep the old prime caches?
- [x] we should use num_cpus to detect how many cpus to use to prime caches. should we also expose a config for # of worker CPU threads to use?
- [x] something is wonky with cancellation, need to figure it out before this can merge. 

Co-authored-by: Jake Heinz <jh@discordapp.com>
2022-01-25 16:03:35 +00:00
bors[bot]
5f13d6af9f
Merge #11340
11340: internal: Make syntax bridge fully infallible r=jonas-schievink a=jonas-schievink

bors r+

Co-authored-by: Jonas Schievink <jonas.schievink@ferrous-systems.com>
2022-01-24 16:28:53 +00:00
Jonas Schievink
5088926ec3 Make syntax bridge fully infallible 2022-01-24 17:27:39 +01:00
bors[bot]
17afa2e778
Merge #11334
11334: fix: don't panic in semantics due to `cfg_attr` disrupting offsets r=Veykril a=Veykril

Reduces the panic in https://github.com/rust-analyzer/rust-analyzer/issues/11298 to an early return, that means we won't resolve these cases again for now, but this is better than constantly panicking in highlighting and hovering.
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-01-23 16:43:22 +00:00
Lukas Wirth
ebd723995a fix: don't panic in semantics due to cfg_attr disrupting offsets 2022-01-23 17:42:38 +01:00
bors[bot]
baa5cd9527
Merge #11330
11330: minor: Bump npm deps r=lnicola a=lnicola



Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2022-01-22 10:02:26 +00:00
Laurențiu Nicola
cd50c71631 Bump npm deps 2022-01-22 11:59:45 +02:00
bors[bot]
1d563133b5
Merge #11329
11329: minor: Bump deps r=lnicola a=lnicola

bors r+

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2022-01-21 17:52:08 +00:00
Laurențiu Nicola
bdfdb525bb Bump chalk 2022-01-21 19:51:21 +02:00
Laurențiu Nicola
e3e6133ff4 Bump pulldown-cmark and pulldown-cmark-to-cmark 2022-01-21 19:49:57 +02:00
Laurențiu Nicola
09fb755432 Bump hashbrown 2022-01-21 19:44:03 +02:00
Laurențiu Nicola
485f318b70 Bump dashmap 2022-01-21 19:42:04 +02:00
bors[bot]
8b779e8870
Merge #11327
11327: internal: Remove redundant `Option` from eager macro fns r=jonas-schievink a=jonas-schievink

This isn't needed since `tt::Subtree` already implements `Default`, and an empty expansion is the appropriate default here.

bors r+

Co-authored-by: Jonas Schievink <jonas.schievink@ferrous-systems.com>
2022-01-21 11:59:10 +00:00
Jonas Schievink
e5ed43b1dc Remove redundant Option from eager macro fns 2022-01-21 12:58:06 +01:00
bors[bot]
df53403863
Merge #11321
11321: Remove spurious format r=lnicola a=schuyler-cohen-zipline



Co-authored-by: Schuyler Cohen <schuyler.cohen@flyzipline.com>
2022-01-19 20:01:41 +00:00
Schuyler Cohen
11cb203daf Remove spurious format 2022-01-19 13:37:25 -06:00
bors[bot]
6a64d3c4df
Merge #11314
11314: fix: Don't load auxiliary crates outside the workspace r=jonas-schievink a=jonas-schievink

I'm a bit unsure about this change since this might have unanticipated consequences, but this does fix https://github.com/rust-analyzer/rust-analyzer/issues/11300.

Co-authored-by: Jonas Schievink <jonas.schievink@ferrous-systems.com>
2022-01-19 10:31:27 +00:00
Jonas Schievink
c714c139a4 Update tests
We're now omitting the libc crate's build script and const_fn test
2022-01-18 18:27:29 +01:00
Jonas Schievink
22ea5595a8 Don't load auxiliary crates outside the workspace 2022-01-18 18:17:43 +01:00
bors[bot]
ac8806df08
Merge #11310
11310: fix: remove pipe from surroundingPairs r=lnicola a=chrisprice

Closes https://github.com/rust-analyzer/rust-analyzer/issues/11192

Co-authored-by: Chris Price <price.c@gmail.com>
2022-01-18 07:55:56 +00:00
bors[bot]
477b654f4f
Merge #11311
11311: fix: insert auto-imports after header comments r=repnop a=repnop

Fixes #8607.

This commit changes the auto-import functionality and causes it to add imports after any leading comments, which are commonly license headers. This does not affect comments on items as they're considered part of the item itself and not separate.

Co-authored-by: Wesley Norris <repnop@outlook.com>
2022-01-17 23:57:30 +00:00
Wesley Norris
ba82cc7722 Add test for comments not directly next to items 2022-01-17 18:44:43 -05:00
Wesley Norris
7d10752299 Add a test for multi-single-line comments as well 2022-01-17 17:12:32 -05:00
Wesley Norris
1c866573cb fix: insert auto-imports after header comments
Fixes #8607.

This commit changes the auto-import functionality and causes it to add
imports after any leading comments, which are commonly license headers.
This does not affect comments on items as they're considered part of the
item itself and not separate.
2022-01-17 17:06:10 -05:00
Chris Price
c18ee35ce8
fix: remove pipe from surroundingPairs
Closes https://github.com/rust-analyzer/rust-analyzer/issues/11192
2022-01-17 20:08:39 +00:00