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').
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>
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>
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>
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.
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>
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>
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>
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>
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>
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.
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>
10722: fix: Fix proc-macro attributes being shadowed by their functions in IDE layer r=Veykril a=Veykril
We sometimes still didn't resolve proc-macro attrs in attribute paths in the ide crates due to their function definitions resolving first.
bors r+
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>