Commit Graph

20098 Commits

Author SHA1 Message Date
Lukas Wirth
366499c3be Do not use reference search in runnables::related_tests 2021-11-16 21:32:02 +01:00
Lukas Wirth
0ff380fe17 Simplify 2021-11-16 21:26:34 +01:00
Lukas Wirth
b57289c4cb Skip test/bench attr expansion in resolution instead of collection 2021-11-16 20:23:56 +01:00
bors[bot]
b88b01ecec
Merge #10775
10775: minor: Simplify r=lnicola a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-11-16 18:52:26 +00:00
bors[bot]
bf408ef5fd
Merge #10777
10777: internal: Allow disabling perf access via `RA_DISABLE_PERF` r=lnicola a=jonas-schievink

https://github.com/rr-debugger/rr does not support the perf-specific ioctls, so add a way to avoid them.

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-11-16 18:44:04 +00:00
Jonas Schievink
445280a1b1 Allow disabling perf access via RA_DISABLE_PERF 2021-11-16 19:42:19 +01:00
Lukas Wirth
f2f89618b7 minor: Simplify 2021-11-16 19:28:32 +01:00
bors[bot]
9f1e26c3f9
Merge #10776
10776: fix: Remove validation of `super` in use paths r=Veykril a=lnicola

Fixes #10770

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2021-11-16 18:18:47 +00:00
Laurențiu Nicola
b23bebebc0 Remove validation of super in use paths 2021-11-16 20:02:42 +02:00
bors[bot]
35ed853d84
Merge #10769
10769: Add proc macro ABI for rustc 1.58 r=lnicola a=alexjg

This fixes #10766.

I do have some concerns here. The proc macro server API has added three methods to `TokenStream` which I don't really know how to implement in `RustcServer`. Namely `expand_expr`, `before`, and `after`. You'll see that these are currently `unimplemented!` in `crates/proc_macro_server/src/abis/abi_1_58/rustc_server.rs`. I don't have the expertise to fill in the blanks here, it may be necessary to pull in someone who knows a bit more about the proc macro crate.

I think this will only be a problem when actually attempting to expand a macro, so this is probably strictly better than not including the updated ABI at all.

Co-authored-by: Alex Good <alex@memoryandthought.me>
2021-11-16 16:40:51 +00:00
Alex Good
abdb2acbe5
Add proc macro ABI for rustc 1.58 2021-11-16 14:14:08 +00:00
bors[bot]
6c7be6cd84
Merge #10734
10734: fix: add generic parameters in convert to manual impl assist r=Veykril a=TheDoctor314

Fixes #10041.

Co-authored-by: TheDoctor314 <64731940+TheDoctor314@users.noreply.github.com>
2021-11-16 11:27:11 +00:00
bors[bot]
7e756acb36
Merge #10774
10774: minor: Lift out FxIndex{Map/Set} types into ide_db r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-11-16 11:16:50 +00:00
Lukas Wirth
92f7db447c minor: Lift out FxIndex{Map/Set} types into ide_db 2021-11-16 12:15:47 +01:00
bors[bot]
bb98791f51
Merge #10773
10773: fix: Remove faulty logic for ascending test attributes for runnables r=Veykril a=Veykril

Fixes https://github.com/rust-analyzer/rust-analyzer/issues/10768
bors r+


Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-11-16 10:52:31 +00:00
Lukas Wirth
d2513deb62 fix: Reimplement mapping out of test/bench attributes for runnables 2021-11-16 11:51:24 +01:00
TheDoctor314
58a24de7d8 Fix impl_def_from_trait
Revert "Fix `impl_trait` function to emit correct ast"

This reverts commit 55a4813151.

Fix `impl_def_from_trait`

It now generates the correct `ast::Impl` using
`generate_trait_impl_text` and parses it to form the right node (copied
from the private fn 'make::ast_from_text').
2021-11-15 22:28:22 +05:30
bors[bot]
73668334f0
Merge #10767
10767: minor: Rename intern_macro -> intern_macro_call r=Veykril a=Veykril

We potentially want to intern macro definitions so the names would probably collide
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-11-14 15:26:58 +00:00
Lukas Wirth
5c0b895f69 Rename intern_macro -> intern_macro_call 2021-11-14 16:25:47 +01:00
bors[bot]
4b9b714b5c
Merge #10759
10759: make `add_missing_match_arms` applicable at the end of the match r=Veykril a=rainy-me

close #10740

Co-authored-by: rainy-me <github@yue.coffee>
2021-11-14 12:05:17 +00:00
rainy-me
1f3da38d94 adjust test case and stop deleting newline 2021-11-14 20:56:28 +09:00
bors[bot]
212095a07d
Merge #10762
10762: Fix: trigger flyimport on enum variants r=lnicola a=XFFXFF

fixes #10749 

Co-authored-by: zhoufan <1247714429@qq.com>
2021-11-14 09:20:59 +00:00
zhoufan
5666046ec9 fix: flyimport triggers on enum variant declarations 2021-11-14 12:16:21 +08:00
bors[bot]
766b52b598
Merge #10761
10761: inlay hints: add the option to always show constructor inlay hints r=Veykril a=jhgg

This PR adds a config to *disable* the functionality in #10441 - _and makes that functionality disabled by default._

I actually *really* like inlay hints always showing up, and it helps a lot as a teaching tool too, and also it's quite reassuring to know that r-a indeed understands the code I've written. This PR adds the option `rust-analyzer.inlayHints.hideNamedConstructorHints` (i can also invert this to be `rust-analyzer.inlayHints.showNamedConstructorHints`, just let me know.)




Co-authored-by: Jake Heinz <jh@discordapp.com>
2021-11-13 23:42:16 +00:00
Jake Heinz
520ff62f4e flip the default 2021-11-13 23:39:34 +00:00
Jake Heinz
d3d768de0d inlay hints: add the option to always show constructor inlay hints 2021-11-13 23:12:29 +00:00
rainy-me
c9949c040c add missing match arms end of last arm 2021-11-14 02:32:10 +09:00
bors[bot]
c634615b11
Merge #10758
10758: Update docs: include Gentoo source build r=lnicola a=mjkalyan

Mention the dev-util/rust-analyzer package for building from source.

Co-authored-by: mjkalyan <34904034+mjkalyan@users.noreply.github.com>
2021-11-13 15:56:25 +00:00
mjkalyan
364f1ed5be
Update docs: include Gentoo source build
Mention the dev-util/rust-analyzer package for building from source.
2021-11-12 18:26:21 -07:00
bors[bot]
d1e756e05a
Merge #10756
10756: Allow the check command to terminate without output r=Veykril a=Wilfred

Cargo will always output something on success:

```
$ cargo check --message-format=json
{"reason":"compiler-artifact", ... snipped ... }
{"reason":"build-finished","success":true}
```

However, rustc does not output anything on success:

```
$ rustc --error-format=json main.rs
$ echo $?
0
```

Restore the behaviour prior to #10517, where an exit code of 0 is
considered good even if nothing is written to stdout.

This enables custom overrideCommand values that use rustc rather than
cargo.

Co-authored-by: Wilfred Hughes <me@wilfred.me.uk>
2021-11-12 21:05:54 +00:00
Wilfred Hughes
f6f6b3a7ad Allow the check command to terminate without output
Cargo will always output something on success:

```
$ cargo check --message-format=json
{"reason":"compiler-artifact", ... snipped ... }
{"reason":"build-finished","success":true}
```

However, rustc does not output anything on success:

```
$ rustc --error-format=json main.rs
$ echo $?
0
```

Restore the behaviour prior to #10517, where an exit code of 0 is
considered good even if nothing is written to stdout.

This enables custom overrideCommand values that use rustc rather than
cargo.
2021-11-12 11:43:20 -08:00
bors[bot]
e46f1fd5e0
Merge #10755
10755: Fix type names in typescript sample code r=lnicola a=Wilfred

`bool` is Rust, whereas `boolean` is the type name in TypeScript.

Co-authored-by: Wilfred Hughes <me@wilfred.me.uk>
2021-11-12 19:32:04 +00:00
Wilfred Hughes
54b636f1e2 Fix type names in typescript sample code 2021-11-12 11:15:08 -08:00
bors[bot]
d83b76d834
Merge #10747
10747: fix: Remove faulty logic for ascending test attributes for runnables r=Veykril a=Veykril

Fixes https://github.com/rust-analyzer/rust-analyzer/issues/10744

- This logic is currently not required as we do not expand test/bench anymore for the time being
- The implementation of this was flawed to begin with as it just skipped out of macro expansions instead of ascending the trees inside expansions

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-11-11 17:48:45 +00:00
Lukas Wirth
2d7f5891f7 Remove faulty logic for ascending test attributes for runnables 2021-11-11 18:47:24 +01:00
bors[bot]
23a980af62
Merge #10745
10745: internal: Replace some more ide usages of ModuleDef with Definition r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-11-11 17:21:37 +00:00
Lukas Wirth
a510021065 Replace some more ide usages of ModuleDef with Definition 2021-11-11 18:20:54 +01:00
bors[bot]
e42ff91f00
Merge #10743
10743: feat: index fewer crates on startup/reload r=jonas-schievink a=jonas-schievink

Before this PR, we used to index every crate in the `CrateGraph`, which includes every test, benchmark and example of all packages everywhere. The point of indexing is to speed up future queries, so indexing lots of tiny crates users are unlikely to open isn't really helpful.

This PR instead makes us index only the transitive dependencies of all workspace crates.

This reduces the number of crates we index in the rust-analyzer repo from 617 to 177 (!). Time is not impacted by that much, because most of the skipped crates are tiny.

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-11-11 13:45:20 +00:00
Jonas Schievink
acbe8bc7ac Prime a more reasonable set of crates 2021-11-11 14:44:12 +01:00
TheDoctor314
55a4813151 Fix impl_trait function to emit correct ast
`impl_trait` code copied from `generate_impl_text_inner` to properly
handle the bounds for the generic parameters.
2021-11-11 14:16:59 +05:30
TheDoctor314
e0e8d877c0 Add generic bounds in test 2021-11-11 14:16:29 +05:30
bors[bot]
3b3063fb2d
Merge #10741
10741: internal: Flatten Definition::ModuleDef variant r=Veykril a=Veykril



Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-11-10 23:19:44 +00:00
Lukas Wirth
7776aad166 internal: Flatten Definition::ModuleDef variant 2021-11-11 00:05:53 +01:00
bors[bot]
1e8d1e84b2
Merge #10689
10689: Handle pub tuple fields in tuple structs r=Veykril a=adamrk

The current implementation will throw a parser error for tuple structs
that contain a pub tuple field. For example,
```rust
struct Foo(pub (u32, u32));
```
is valid Rust, but rust-analyzer will throw a parser error.  This is
because the parens after `pub` is treated as a visibility context.
Allowing a tuple type to follow `pub` in the special case when we are
defining fields in a tuple struct can fix the issue.

I guess this is a really minor case because there's not much reason
for having a tuple type within a struct tuple, but it is valid rust syntax...

Co-authored-by: Adam Bratschi-Kaye <ark.email@gmail.com>
2021-11-10 21:08:51 +00:00
Adam Bratschi-Kaye
0d54754ca7 Handle pub tuple fields in tuple structs
The current implementation will throw a parser error for tuple structs
that contain a pub tuple field. For example,
```rust
struct Foo(pub (u32, u32));
```
is valid Rust, but rust-analyzer will throw a parser error.  This is
because the parens after `pub` is treated as a visibility context.
Allowing a tuple type to follow `pub` in the special case when we are
defining fields in a tuple struct can fix the issue.
2021-11-10 21:29:50 +01:00
bors[bot]
e7244e899f
Merge #10739
10739: internal: Simplify r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-11-10 17:27:24 +00:00
Lukas Wirth
dea973089c Simplify 2021-11-10 18:26:18 +01:00
bors[bot]
b2bce38bb4
Merge #10729
10729: Fix: Lookup impls in local def maps r=jonas-schievink a=XFFXFF

fixes #10676 

Co-authored-by: zhoufan <1247714429@qq.com>
2021-11-10 16:47:35 +00:00
bors[bot]
f724c84e7d
Merge #10738
10738: internal: Do not search through all three namespaces in `ItemScope::name_of` r=Veykril a=Veykril

Brings down `5ms - find_path_prefixed (46 calls)` to `1ms - find_path_prefixed (46 calls)` for me on the `integrated_completion_benchmark`.
Still `O(n)` but this should considerably cut down lookups nevertheless(as shown by the timings already).
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-11-10 15:12:05 +00:00
Lukas Wirth
3c8898b1b1 Do not search through all three namespaces in ItemScope::name_of 2021-11-10 16:08:40 +01:00