10789: internal: Check for derive attributes by item path, not `derive` identifier r=Veykril a=Veykril
Prior we only checked if an attribute is the exact `derive` identifier and nothing else to collect derive attributes. That means when we encounter the following:
```rs
#[::core::macros::builtin::derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct ModPath {
pub kind: PathKind,
segments: Vec<Name>,
}
```
We won't actually expand the derive attributes, but instead we just expand the `derive` attribute with our dummy identity expander.
The changes here make it so we actually lookup the attribute path, check if it is the derive attribute and then collect the derives.
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
10786: minor: remove duplicate calls r=Veykril a=XFFXFF
`scopes.set_scope(*expr, scope)` is duplicate, because we always call it in `compute_expr_scopes` add6cccd4c/crates/hir_def/src/body/scope.rs (L175-L180)
Co-authored-by: zhoufan <1247714429@qq.com>
10781: internal: Do not use reference search in `runnables::related_tests` r=Veykril a=Veykril
bors r+
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
10778: internal: Skip test/bench attr expansion in resolution instead of collection r=Veykril a=Veykril
This way we skip any path resolving to the test and bench attributes instead of just the lone identifiers(which could very well point to non-builtin attributes).
bors r+
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
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>
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>
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>