Commit graph

17749 commits

Author SHA1 Message Date
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
bors
4b06d3c595 Auto merge of #15148 - lowr:fix/super-nameres-in-block, r=Veykril
Fix `self` and `super` path resolution in block modules

This PR fixes `self` and `super` path resolution with block modules involved.

Previously, we were just going up the module tree count-of-`super` times without considering block modules in the way, and then if we ended up in a block `DefMap`, we adjust "to the containing crate-rooted module". While this seems to work in most real-world cases, we failed to resolve them within peculiar module structures.

`self` and `super` should actually be resolved to the nearest non-block module, and the paths don't necessarily resolve to a crate-rooted module. This PR makes sure every `self` and `super` segment in paths are resolved to a non-block module.
2023-06-28 10:43:56 +00:00
bors
021604431c Auto merge of #15125 - lowr:patch/rustc_coinductive, r=Veykril
internal: support `#[rustc_coinductive]`

rust-lang/rust#100386 changed the trait solver so that `Sized` is treated as coinductive trait, just like auto traits. This is now controlled by the perma-unstable `#[rustc_coinductive]` attribute (rust-lang/rust#108033), which this PR adds support for.

In practice, I don't think this matters much if at all. Currently we don't give chalk enough information so chalk cannot precisely (dis)prove `Sized` bounds.
2023-06-28 10:13:31 +00:00
bors
891331c74f Auto merge of #15101 - alibektas:14780, r=Veykril
Check Workspace Edit ResourceOps

PR fixes #14780
2023-06-28 09:57:54 +00:00
Lukas Wirth
f8518a6cfa
Update crates/rust-analyzer/src/handlers/request.rs 2023-06-28 11:57:36 +02:00
Ryo Yoshida
56dd5368f5
Refactor
- don't take `&self` as receiver for `Copy` types
- simplify `hir::Module::nearest_non_block_module()`
- style changes for consistency
2023-06-27 16:01:07 +09:00
Ryo Yoshida
a02846343f
Fix self and super path resolution in block modules 2023-06-27 15:29:08 +09:00
bors
8769cd24bc Auto merge of #15140 - tetsuharuohzeki:issue-15088-comment, r=Veykril
Add the comment why `HasSource::source()` returns `Option`

Fix https://github.com/rust-lang/rust-analyzer/issues/15088
2023-06-26 10:12:00 +00:00
Tetsuharu Ohzeki
7b418d3a8c Add the comment why HasSource::source() returns Option 2023-06-26 17:05:13 +09:00
bors
4a2ceeff0f Auto merge of #15135 - HKalbasi:mir, r=HKalbasi
Fix some unsizing problems in mir
2023-06-25 22:28:23 +00:00
hkalbasi
6d2d1387af Fix some unsizing problems in mir 2023-06-26 01:57:12 +03:30
Josh Stone
380773b3e8 Upgrade to indexmap v2 2023-06-24 17:35:20 -07:00
Ryo Yoshida
d026479ba6
Support #[rustc_coinductive] 2023-06-25 00:13:31 +09:00
hkalbasi
5eb4796d3d Support more intrinsics in mir interpreter 2023-06-23 21:08:05 +03:30
Ali Bektas
b96796ce5e Minor changes. Add resolve_resource_op() 2023-06-23 19:22:59 +02:00
Alex Kirszenberg
5991f0d869 Follow raw pointers in autoderef chain when resolving methods with custom receiver 2023-06-23 15:35:41 +02:00