Commit graph

17766 commits

Author SHA1 Message Date
bors
db17f792bf Auto merge of #15223 - lowr:patch/no-unresolved-field-for-missing, r=HKalbasi
Don't show `unresolved-field` diagnostic for missing names

I don't think reporting ``"no field `[missing name]` on type `SomeType`"`` makes much sense because it's a syntax error rather than a semantic error. We already report a syntax error for it and I find it sufficient.
2023-07-06 11:54:08 +00:00
Ryo Yoshida
827a0530bc
Don't show unresolved-field diagnostic for missing names 2023-07-06 20:39:48 +09:00
bors
aa91eda902 Auto merge of #15152 - alibektas:14987, r=Veykril,lowr
assist : generate trait from impl

fixes #14987 . As the name suggests this assist is used to generate traits from inherent impls while adapting the original impl to fit to the newly generated trait. I made some decisions regarding when the assist should be applicable. These are surely open to discussion. I looking forward to any feedback.

![generate_trait_from_impl_v1](https://github.com/rust-lang/rust-analyzer/assets/20956650/05d4dda5-604a-4108-8b82-9b60bd45894a)
2023-07-05 16:56:37 +00:00
bors
3ea31e0ccf Auto merge of #15216 - AmrDeveloper:stop_diagnostics_for_self, r=lowr
Disable remove unnecessary braces diagnotics for self imports

Disable `remove unnecessary braces` diagnostic if the there is a `self` inside the bracketed `use`

Fix #15191
2023-07-05 16:41:45 +00:00
AmrDeveloper
54e897368d Cover disable diagnostic from case with invalid syntax 2023-07-05 19:31:37 +02:00
AmrDeveloper
fe65eabc81 Remove un used import 2023-07-05 17:41:51 +02:00
AmrDeveloper
3fb6a3be82 Remove un needed extra handling for remove self with braces 2023-07-05 17:38:58 +02:00
Ali Bektas
8edb3e192a Minor changes 2023-07-05 16:45:54 +02:00
AmrDeveloper
ce0239bd6a Disable remove unnecessary braces diagnotics for self imports 2023-07-05 16:34:04 +02:00
Ali Bektas
30cbba20de Add snippet insert if client supports it 2023-07-05 13:41:54 +02:00
bors
e95644e279 Auto merge of #15212 - lowr:patch/recover-from-incomplete-assoc-ty, r=HKalbasi
Recover from missing associated items and generic const defaults

Fixes #15129
2023-07-04 18:10:20 +00:00
bors
e219999a17 Auto merge of #15211 - lowr:patch/gats-in-bounds-for-assoc, r=flodiebold
Support GATs in bounds for associated types

Chalk has a dedicated IR for bounds on trait associated type: `rust_ir::InlineBound`. We have been failing to convert GATs inside those bounds from our IR to chalk IR. This PR provides an easy fix for it: properly take GATs into account during the conversion.
2023-07-04 15:36:16 +00:00
Ali Bektas
03423116ad Generate trait from impl v2 2023-07-04 17:33:45 +02:00
Ryo Yoshida
49b039f1d1
Recover from missing associated items and generic const defaults 2023-07-05 00:24:11 +09:00
Ryo Yoshida
9fd5f8c670
Support GATs in bounds for associated types 2023-07-04 18:58:19 +09:00
Lukas Wirth
7b36a73351 internal: Remove CfgExpander 2023-07-04 10:38:23 +02:00
Lukas Wirth
8886d707b8 Stronger typing for AstId and AstIdMap 2023-07-04 09:16:15 +02:00
bors
45272efec5 Auto merge of #14990 - HKalbasi:diagnostic-map, r=HKalbasi
Map our diagnostics to rustc and clippy's ones

And control their severity by lint attributes `#[allow]`, `#[deny]` and ... .

It doesn't work with proc macros and I would like to fix that before merge but I don't know how to do it.
2023-07-03 18:58:47 +00:00
bors
daba334611 Auto merge of #15206 - Veykril:let-else-fmt, r=Veykril
internal: Format let-else

As nightly finally got support for it I went ahead and formatted r-a with the latest nightly, then with the latest stable (in case other stuff changed)
2023-07-03 18:41:59 +00:00
Lukas Wirth
69cd3c30ac Format let-else 2023-07-03 20:34:09 +02:00
bors
b9101895d2 Auto merge of #15205 - Veykril:load-cargo, r=Veykril
Split out project loading capabilities from rust-analyzer crate

External tools currently depend on the entire lsp infra for no good reason so let's lift that out so those tools have something better to depend on
2023-07-03 15:46:09 +00:00
Lukas Wirth
28fcd1bdd7 Split out project loading capabilities from rust-analyzer crate 2023-07-03 17:40:31 +02:00
bors
5703346523 Auto merge of #15118 - alexkirsz:alexkirsz/resolve-deref-raw, r=Veykril
Follow raw pointers in autoderef chain when resolving methods with custom receiver

Fixes #15083

I believe this stopped working after e797479651
2023-07-03 14:55:08 +00:00
bors
691600a885 Auto merge of #15181 - lowr:patch/import-map-purge-unused, r=Veykril
Clean up `ImportMap`

There are several things in `hir_def::import_map` that are never used. This PR removes them and restructures the code. Namely:

- Removes `Query::name_only`, because it's *always* true.
  - Because of this, we never took advantage of storing items' full path. This PR removes `ImportPath` and changes `ImportInfo` to only store items' name, which should reduce the memory consumption to some extent.
- Removes `SearchMode::Contains` for `Query` because it's never used.
- Merges `Query::assoc_items_only` and `Query::exclude_import_kinds` into `Query::assoc_mode`, because the latter is never used besides filtering associated items out.

Best reviewed one commit at a time. I made sure each commit passes full test suite. I can squash the first three commits if needed.
2023-07-03 14:37:55 +00:00
Lukas Wirth
e52027861e Add analysis-stats flag to trigger some IDE features 2023-07-03 16:04:08 +02:00
Lukas Wirth
bdc3d0f551 Shuffle some proc_macro_expand query things around 2023-07-03 15:05:25 +02:00
Lukas Wirth
321e570d92 Don't diagnose builtin derives 2023-07-03 14:23:36 +02:00
Ryo Yoshida
6086ced61d Revert "Support #[rustc_coinductive]"
This reverts commit d026479ba6.
2023-07-03 05:06:55 +09:00
hkalbasi
6f7452882a Fix layout of simd types and respect align in mir interpreter 2023-07-02 00:42:33 +03:30
hkalbasi
15a0da6f30 Fix overflow checking in shift operator 2023-07-01 17:16:56 +03:30
hkalbasi
bb85a980e0 Bump chalk 2023-06-30 23:36:47 +03:30
hkalbasi
45828cdb54 Disable mir interpreter for targets with different pointer size from host 2023-06-30 21:21:52 +03:30
bors
76bcd9946a Auto merge of #15169 - lowr:patch/impl-header-anon-lifetime, r=HKalbasi
Use anonymous lifetime where possible

Because anonymous lifetimes are *super* cool.

More seriously, I believe anonymous lifetimes, especially those in impl headers, reduce cognitive load to a certain extent because they usually signify that they are not relevant in the signature of the methods within (or that we can apply the usual lifetime elision rules even if they are relevant).
2023-06-30 16:57:20 +00:00
Ryo Yoshida
5db0e1a346
Restructure ImportMap collection 2023-07-01 00:18:23 +09:00
Ryo Yoshida
2b106648a7
Only store item name instead of full path 2023-07-01 00:17:57 +09:00
Ryo Yoshida
860628af7c
Remove SearchMode:Contains
Also micro-optimizes fuzzy search.
2023-06-30 23:37:23 +09:00
Ryo Yoshida
8cd4e9f7ec
Merge assoc_items_only and exclude_import_kinds into assoc_mode 2023-06-30 23:37:10 +09:00
Ryo Yoshida
97b725e269
Remove name_only from import map query 2023-06-30 23:35:55 +09:00
Ali Bektas
cfbeb66a63 Purge of unwrap version 2 2023-06-30 16:31:20 +02:00
Ali Bektas
72aeaef5f3 Purge of unwraps 2023-06-30 15:47:17 +02:00
Lukas Wirth
7e7f401a81
Fix panic in handle_code_action 2023-06-30 08:42:46 +02:00
Lukas Wirth
60d046f567
Fix panic in handle_code_action 2023-06-30 08:38:44 +02:00
hkalbasi
302bb3c871 Fix data layout of reference to nested unsized structs 2023-06-29 23:38:13 +03:30
hkalbasi
f53f9230f0 Support #[derive_const(Trait)] 2023-06-29 20:58:35 +03:30
Ryo Yoshida
4e793e7859
Use anonymous lifetime where possible 2023-06-29 23:27:28 +09:00
hkalbasi
2272803330 Fix realloc problem in allocating smaller amounts 2023-06-29 17:28:48 +03:30
bors
ad434fc4ac Auto merge of #15157 - HKalbasi:tokio-test, r=HKalbasi
Fix runnable detection for `#[tokio::test]`

fix #15141

It is hacky, and it wouldn't work for e.g. this case:
```Rust
use ::core::prelude;

#[prelude::v1::test]
fn foo() {
}
```
But it works for the tokio case. We should use the name resolution here somehow, and after that we should probably also get rid of the ast based `test_related_attribute` function.
2023-06-28 20:02:00 +00:00
hkalbasi
7901538dc8 Fix runnable detection for #[tokio::test] 2023-06-28 23:31:08 +03:30
bors
ae89ca3fbb Auto merge of #15161 - lowr:patch/fixture-metadata-library, r=Veykril
internal: add `library` fixture meta

Currently, there is no way to specify `CrateOrigin` of a file fixture ([this] might be a bug?). This PR adds `library` meta to explicitly specify the fixture to be `CrateOrigin::Library` and also makes sure crates that belong to a library source root are set `CrateOrigin::Library`.

(`library` isn't really the best name. It essentially means that the crate is outside workspace but `non_workspace_member` feels a bit too long. Suggestions for the better name would be appreciated)

Additionally:
- documents the fixture meta syntax as thoroughly as possible
- refactors relevant code

[this]: 4b06d3c595/crates/base-db/src/fixture.rs (L450)
2023-06-28 15:23:32 +00:00
Ryo Yoshida
d51536c242
Add library fixture meta
Additionally documents the syntax for fixture meta.
2023-06-28 22:34:14 +09:00