Commit Graph

225 Commits

Author SHA1 Message Date
bors
c8887241f9 Auto merge of #16606 - Veykril:hover-extern, r=Veykril
internal: Render assoc item owner in hover for items other than functions

Closes https://github.com/rust-lang/rust-analyzer/issues/16603
2024-02-20 13:51:47 +00:00
Lukas Wirth
85203d9721 Render assoc item owner in hover for items other than functions 2024-02-20 13:16:12 +01:00
Lukas Wirth
d93096ecc0 internal: Fetch toolchain and datalayout for DetachedFiles 2024-02-20 10:40:39 +01:00
Lukas Wirth
a822291a02 Infallible definition hovers 2024-02-19 18:16:02 +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
Lukas Wirth
ead369117a CrateOrigin::Local means local to the project workspace, not cargo workspace 2024-02-16 16:28:17 +01:00
DropDemBits
4af075dcda
Remove SourceChangeBuilder::{insert,remove}_snippet
All assists have been migrated to use the structured snippet versions of these methods.
2024-02-15 21:34:29 -05:00
DropDemBits
581d457e13
Add add_placeholder_snippet_group
Used for allowing newly generated syntax constructs to be renamed without having to go through a separate rename step.
2024-02-15 20:24:31 -05:00
Maybe Waffle
e146139957 Add support for become expr/tail calls 2024-02-14 14:57:18 +00:00
Ryo Yoshida
4940017716 Rename StructDatum -> AdtDatum 2024-02-14 13:50:44 +01:00
Tavo Annus
125791386d Cleanup term search related changes 2024-02-11 14:35:54 +02:00
Tavo Annus
627255dd5a Add static method tactic 2024-02-11 13:33:29 +02:00
bors
1ef7a2329b Auto merge of #16525 - Veykril:item-loc, r=Veykril
Abstract more over ItemTreeLoc-like structs

Allows reducing some code duplication by using functions generic over said structs. The diff isn't negative due to me adding some additional impls for completeness.
2024-02-10 10:47:37 +00:00
Lukas Wirth
2ebf0c87c2 Deduplicate some code 2024-02-10 01:51:22 +01:00
Tetsuharu Ohzeki
fb8c0f514e ide-db: Fix warnings about clippy str_to_string rule 2024-02-10 01:00:40 +09:00
Lukas Wirth
15bffe25bd feat: Add break and return postfix keyword completions 2024-02-08 14:56:10 +01:00
clubby789
79e4111442 Remove ffi_returns_twice references 2024-02-07 19:42:07 +00:00
Matthias Krüger
ac9d1a03a7 remove clones 2024-02-05 23:15:47 +01:00
bors
66cec4d11a Auto merge of #16470 - Veykril:clippy-disallow, r=lnicola
internal: Lint debug prints and disallowed types with clippy
2024-02-05 17:20:43 +00:00
bors
3e47532dd4 Auto merge of #16474 - davidbarsky:david/import-on-the-fly-improvements, r=lnicola
internal: even more `tracing`

As part of profiling completions, I added some additional spans and moved `TyBuilder::subst_for_def` closer to its usage site (the latter had a small impact on completion performance. Thanks for the tip, Lukas!)
2024-02-05 09:01:58 +00:00
bors
8f6a72871e Auto merge of #16469 - Young-Flash:ci_typos, r=lnicola
internal: add typos check CI (part 2)

follow up https://github.com/rust-lang/rust-analyzer/pull/16448
2024-02-02 12:02:48 +00:00
Young-Flash
ba2910a3a7 minor: correct some typos 2024-02-02 18:22:54 +08:00
David Barsky
f9bef39d48 internal: add some more tracing spans inside of hir-ty 2024-02-01 16:10:32 -05:00
Lukas Wirth
9e8a0fae0c Lint debug prints and disallowed types with clippy 2024-02-01 17:57:27 +01:00
bors
850ba2fb63 Auto merge of #16451 - Urhengulas:satisfy-clippy, r=Veykril
internal: Work through temporarily allowed clippy lints, part 2

Another follow-up to https://github.com/rust-lang/rust-analyzer/pull/16401.
2024-02-01 14:23:18 +00:00
clubby789
a1fdb876c3 Remove abi_amdgpu_kernel references 2024-01-31 19:06:10 +00:00
Johann Hemmann
df2c7a6e4e cargo clippy --fix 2024-01-31 19:06:36 +01:00
bors
355c9444e1 Auto merge of #16448 - Young-Flash:typos, r=lnicola
minor: correct typos

I use [crate-ci/typos](https://github.com/crate-ci/typos) to check typos in codebase, if it's ok with you, I'd like to add a typo check CI using [typos](https://github.com/crate-ci/typos) (with Apache-2.0, MIT licenses).

BTW, we can add a [_typos.toml](https://github.com/crate-ci/typos/blob/master/docs/reference.md) as white list for some intentional typos
2024-01-31 13:29:55 +00:00
bors
2661c272c9 Auto merge of #16461 - Veykril:expansion-info, r=Veykril
internal: Remove unnecessary usages of ExpansionInfo

And some follow up simplifications to https://github.com/rust-lang/rust-analyzer/pull/16439
2024-01-31 08:58:55 +00:00
Lukas Wirth
d252247ab7 internal: Remove unnecessary usages of ExpansionInfo 2024-01-31 09:57:17 +01:00
bors
e4146af294 Auto merge of #16441 - Young-Flash:exclude_tests_refs, r=Veykril
feat: enable excluding refs search results in test

## Change

Here I introduce a new `ReferenceCategory::Test` type to indicate whether the function where this reference is located is marked as `#[test]`, and expose an config item (`rust-analyzer.references.excludeTests`) to client.

I also changed the signature of `ReferenceCategory::new`, adding a `sema: &Semantics<'_, RootDatabase>` param to do some hir analysis. Hope the current implementation is good to go.

## Demo

`"rust-analyzer.references.excludeTests": false`

![include](https://github.com/rust-lang/rust-analyzer/assets/71162630/9f1176d4-7b41-4f49-ac79-55d25a42d5d1)

`"rust-analyzer.references.excludeTests": true`

![exclude](https://github.com/rust-lang/rust-analyzer/assets/71162630/2938b44b-9e5b-48de-a049-453f5bbc09d0)

close https://github.com/rust-lang/rust-analyzer/issues/14530
2024-01-31 07:53:28 +00:00
David Barsky
e1ea7c8844 internal: switch to tracing from log
This commit also adds `tracing` to NotificationDispatcher/RequestDispatcher,
bumps `rust-analyzer-salsa` to 0.17.0-pre.6, `always-assert` to 0.2, and
removes the homegrown `hprof` implementation in favor of a vendored
tracing-span-tree.
2024-01-30 12:27:31 -05:00
Young-Flash
db9fd370ee minor: correct typos 2024-01-30 21:43:43 +08:00
davidsemakula
dba3fc4425 style: remove unnecessary macro 2024-01-30 16:15:15 +03:00
Young-Flash
6181102567 fix: use Semantics to judge whether a func is marked as #[test] 2024-01-29 18:42:41 +08:00
Young-Flash
6f303f49fe feat: enable excluding refs search results in test 2024-01-28 18:28:13 +08:00
davidsemakula
81d713ea9f remove ordered insert logic from recursive merge function 2024-01-28 11:55:01 +03:00
davidsemakula
8fab92feb2 normalize use trees when merging imports 2024-01-28 11:55:01 +03:00
Lukas Wirth
8a5829cf28 Re-order mod declarations 2024-01-27 11:02:34 +01:00
Johann Hemmann
e6f9f4c0e4 nonminimal_bool 2024-01-19 17:31:01 +01:00
Johann Hemmann
add40c8660 match_like_matches_macro 2024-01-19 17:31:01 +01:00
bors
03d4a6dd9a Auto merge of #16400 - alibektas:15656/update_bail_message_ref_config, r=Veykril
Update bail message referencing config

Even though we changed the name of the config I forgot to update the warning message that referenced it.
2024-01-19 14:19:11 +00:00
Ali Bektas
0becb6c819
Update crates/ide-db/src/rename.rs
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2024-01-19 14:33:40 +01:00
bors
85c9a83262 Auto merge of #16398 - Urhengulas:satisfy-clippy, r=Veykril
`cargo clippy --fix`

This PR is the result of running `cargo clippy --fix && cargo fmt` in the root of the repository. I did not manually review all the changes, but just skimmed through a few of them. The tests still pass, so it seems fine.
2024-01-19 09:43:35 +00:00
Ali Bektas
431040fe59 Update bail message referencing config
Even though we changed the name of the config I forgot
to update the warning message that referenced it.
2024-01-18 22:29:36 +01:00
bors
3f4c6dac3d Auto merge of #16372 - davidsemakula:import-granularity-one, r=Veykril
feat: Add "One" import granularity

Adds a new import granularity option "One" that merges all imports into a single use statement as long as they have the same visibility and attributes.

This is similar to [rustfmt's `imports_granularity = "One"`](https://rust-lang.github.io/rustfmt/?version=v1.6.0&search=import#imports_granularity).

Fixes: #11361
2024-01-18 15:40:12 +00:00
bors
a5b89fffb6 Auto merge of #16391 - alibektas:15656/renaming_allowed_by_config, r=Veykril
Add a new config to allow renaming of non-local defs

With #15656 we started disallowing renaming of non-local items. Although this makes sense there are some false positives that impacted users' workflows. So this config aims to mitigate this by giving users the liberty to disable this feature.

The reason why this is a draft is that I saw one of the tests fail and I am not sure if the "got" result even syntactically makes sense

Test case is :

```rust
check(
            "Baz",
            r#"
//- /lib.rs crate:lib new_source_root:library
pub struct S;
//- /main.rs crate:main deps:lib new_source_root:local
use lib::S$0;
"#,
            "use lib::Baz;"
);
```

```
Left:
use lib::Baz;

Right:
use lib::Baz;Baz

Diff:
use lib::Baz;Baz
```
2024-01-18 13:49:14 +00:00
Johann Hemmann
fad4fa163c cargo clippy --fix 2024-01-18 13:59:49 +01:00
Ali Bektas
9bd9a17ce5 Add a new config to allow renaming of non-local items
With #15656 we started disallowing renaming of non-local items.
Although this makes sense there are some false positives that
impacted users' workflows. So this config aims to mitigate this
by giving users the liberty to disable this feature.
2024-01-18 00:26:22 +01:00
davidsemakula
57d4b5bb0f add "one" import granularity 2024-01-18 01:44:57 +03:00