Commit Graph

16002 Commits

Author SHA1 Message Date
Lukas Wirth
5424c51158 Add config for supplying sysroot path 2022-10-01 21:17:06 +02:00
bors
bf5cad8e77 Auto merge of #13326 - Veykril:proc-macro-srv-config, r=Veykril
Do not use the sysroot proc-macro server when a server path is given explicitly
2022-10-01 17:51:47 +00:00
Lukas Wirth
26cf250ccc Do not use the sysroot proc-macro server when a server path is given explicitly 2022-10-01 19:50:34 +02:00
bors
f88293f777 Auto merge of #13324 - Veykril:trait-impl-completion, r=Veykril
Fix trait impl item completions using macro file text ranges

Fixes https://github.com/rust-lang/rust-analyzer/issues/13323
2022-10-01 13:35:08 +00:00
Lukas Wirth
bfd5f00bfc Fix trait impl item completions using macro file text ranges 2022-10-01 15:34:45 +02:00
bors
5b7e40014e Auto merge of #13321 - Veykril:format-str-args, r=Veykril
Fix move_format_string_arg being tokentree unaware

Fixes https://github.com/rust-lang/rust-analyzer/issues/13261
2022-09-30 22:42:40 +00:00
Lukas Wirth
3ad0334718 Fix move_format_string_arg being tokentree unaware 2022-10-01 00:42:16 +02:00
bors
2293949bbf Auto merge of #13318 - Veykril:annotations, r=Veykril
Fix annotations not resolving when lens location is set to whole item

Fixes https://github.com/rust-lang/rust-analyzer/issues/13310
2022-09-30 22:31:05 +00:00
bors
17363b341e Auto merge of #13320 - Veykril:ty-alias-hover, r=Veykril
Fix type alias hovers not rendering generic parameters
2022-09-30 22:22:24 +00:00
Lukas Wirth
77cfc9b392 Fix type alias hovers not rendering generic parameters 2022-10-01 00:21:29 +02:00
Lukas Wirth
3cd57c425a Fix annotations not resolving when lens location is set to whole item 2022-10-01 00:18:23 +02:00
Lukas Wirth
8c433c7296 Fix requests not being retried anymore 2022-10-01 00:07:33 +02:00
Ryo Yoshida
6d8903ae5f
fix: infer for-loop item type with IntoIterator and Iterator 2022-09-29 19:48:08 +09:00
bors
ad752bd521 Auto merge of #13301 - Veykril:empty-assist-source-changes, r=Veykril
Make assist tests panic again on empty source changes
2022-09-27 15:54:54 +00:00
Lukas Wirth
f5fe6b157f Make assist tests panic again on empty source changes 2022-09-27 17:48:00 +02:00
Lukas Wirth
1a6c1595fe Don't retry requests that have already been cancelled 2022-09-27 17:39:15 +02:00
bors
093de32f80 Auto merge of #13237 - Veykril:process-changes, r=Veykril
Amalgamate file changes for the same file ids in process_changes

When receiving multiple change events for a single file id where the last change is a delete the server panics, as it tries to access the file contents of a deleted file. This occurs due to the VFS changes and the in memory file contents being updated immediately, while `process_changes` processes the events afterwards in sequence which no longer works as it will only observe the final file contents. By folding these events together, we will no longer try to process these intermediate changes, as they aren't relevant anyways.

Potentially fixes https://github.com/rust-lang/rust-analyzer/issues/13236
2022-09-27 14:41:40 +00:00
Lukas Wirth
c3a6c963e5 Amalgamate file changes for the same file ids in process_changes
When receiving multiple change events for a single file id where the
last change is a delete the server panics, as it tries to access the
file contents of a deleted file. This occurs due to the VFS changes and
the in memory file contents being updated immediately, while
`process_changes` processes the events afterwards in sequence which no
longer works as it will only observe the final file contents. By
folding these events together, we will no longer try to process these
intermediate changes, as they aren't relevant anyways.

Potentially fixes https://github.com/rust-lang/rust-analyzer/issues/13236
2022-09-27 16:41:04 +02:00
bors
bd8c5b6b42 Auto merge of #13300 - Veykril:cfg-false, r=Veykril
Use cfg(any()) instead of cfg(FALSE) for disabling proc-macro test

cc https://github.com/rust-lang/rust-analyzer/pull/13286
2022-09-27 14:11:04 +00:00
bors
8805d05d01 Auto merge of #13296 - Strum355:package-information-package-name, r=Veykril
Fix PackageInformation having the crate name instead of package name

The `PackageInformation` type from the LSIF PR used the _crate_ name instead of the _package_ name. This caused issues when looking up crates by this name on the Sourcegraph backend, where we sync crate contents, for crates such as actix-web and many of its components (actix-files, actix-http etc etc), see screenshot 1 for the observed symptom.

This PR hasnt been tested on other entry points besides cargo (such as project json).

See screenshot 2 for the change in behaviour via SCIP snapshot comparison.

<details>
<summary>Screenshot 1</summary>

![crates.io giving 404](https://user-images.githubusercontent.com/18282288/192286637-8bf7c333-4441-4e60-8cce-de7eaa11ee9f.png)

</details>

<details>
<summary>Screenshot 2</summary>

![before and after from SCIP snapshot output](https://user-images.githubusercontent.com/18282288/192287733-d7e73ff0-abbc-4ae5-82d0-bf9dc45d755c.png)

</details>

Follow-up PR to my question over at the [rust-lang Zulip](https://rust-lang.zulipchat.com/#narrow/stream/185405-t-compiler.2Frust-analyzer/topic/canonical.20crate.20name.20confusion.20for.20monikers), excuse any incorrect usages of the term package vs crate.
2022-09-27 13:07:05 +00:00
bors
b01cdd89d5 Auto merge of #13189 - unexge:unconfigured-diagnostics-for-fields, r=Veykril
Emit unconfigured code diagnostics for enum variants and struct/union fields

Fixes https://github.com/rust-lang/rust-analyzer/issues/12664
2022-09-27 12:59:45 +00:00
Lukas Wirth
fb736449fd Use cfg(any()) instead of cfg(FALSE) for disabling proc-macro test 2022-09-27 13:52:04 +02:00
bors
f972cdd5fc Auto merge of #13295 - rust-lang:sourcegen, r=Veykril
Remove obsolete in-rust-tree feature from sourcegen
2022-09-27 01:21:07 +00:00
bors
8c7e37697f Auto merge of #13275 - Veykril:find-path, r=Veykril
Fix find_path using the wrong module for visibility calculations
2022-09-27 01:14:02 +00:00
unexge
7e5e5177b6 Generate From impls manually 2022-09-26 19:29:28 +01:00
unexge
3a8d84b4a3 Use Arc<[DefDiagnostic]> instead of Arc<Vec<DefDiagnostic>> 2022-09-26 19:16:02 +01:00
unexge
b21bf25a07 Collect diagnostics in queries instead of nameres 2022-09-26 19:06:29 +01:00
unexge
89107d5469 Emit unconfigured code diagnostics for fields 2022-09-26 19:04:57 +01:00
Noah Santschi-Cooney
651c586035
formatting 2022-09-26 18:35:06 +01:00
Noah Santschi-Cooney
60b432b7e9
fix model tests 2022-09-26 18:18:12 +01:00
Noah Santschi-Cooney
aa093f5a58
Fix PackageInformation having the crate name instead of package name 2022-09-26 17:31:38 +01:00
bors
1a24003eb6 Auto merge of #13248 - harudagondi:unwrap-tuple, r=Veykril
Feature: Add assist to unwrap tuple declarations

> Implement #12923 for only tuples.
>
> Does not implement unwrapping for structs, as mentioned in the issue.

Add assist to unwrap tuples declarations to separate declarations.

```rust
fn main() {
	$0let (foo, bar, baz) = (1.0, "example", String::new())
}
```

becomes:

```rust
fn main() {
	let foo = 1.0;
	let bar = "example";
	let baz = String::new();
}
```

## Changelog

### Feature

- Added assist to unwrap tuple declarations.
2022-09-26 09:35:59 +00:00
Lukas Wirth
7929e9c56b Remove obsolete in-rust-tree feature from sourcegen 2022-09-26 11:34:30 +02:00
bors
1f929659ac Auto merge of #13209 - lowr:feat/inference-for-generator, r=Veykril
feat: type inference for generators

This PR implements basic type inference for generator and yield expressions.

Things not included in this PR:
- Generator upvars and generator witnesses are not implemented. They are only used to determine auto trait impls, so basic type inference should be fine without them, but method resolutions with auto trait bounds may not be resolved correctly.

Open questions:
- I haven't (yet) implemented `HirDisplay` for `TyKind::Generator`, so generator types are just shown as "{{generator}}" (in tests, inlay hints, hovers, etc.), which is not really nice. How should we show them?
- I added moderate amount of stuffs to minicore. I especially didn't want to add `impl<T> Deref for &T` and `impl<T> Deref for &mut T` exclusively for tests for generators; should I move them into the test fixtures or can they be placed in minicore?

cc #4309
2022-09-26 09:28:41 +00:00
Lukas Wirth
73f6af54c1 Use the sysroot proc-macro server for analysis-stats 2022-09-24 22:04:17 +02:00
Lukas Wirth
0231d19f3f Fix diagnostics not working in enum variant bodies 2022-09-24 03:07:05 +02:00
Lukas Wirth
7ec9ffa325 Properly support IDE functionality in enum variants 2022-09-24 02:33:59 +02:00
Lukas Wirth
f57cd838d8 Don't run proc-macro-srv tests on the rust-analyzer repo
proc-macro ABI breakage still affects the tests when a new stable version
releases. Ideally we'd still be able to run the tests on the rust-analyzer
repo without having to update the proc-macro ABI, but for now just to
unblock CI we will ignore them here, as they are still run in upstream.
2022-09-24 00:08:28 +02:00
Lukas Wirth
729a9eb5d0 Fix find_path using the wrong module for visibility calculations 2022-09-22 17:56:58 +02:00
Ryo Yoshida
9ede5f0735
Implement HirDisplay for TyKind::Generator 2022-09-21 22:04:55 +09:00
harudagondi
c2dc32c48e return None instead of assert 2022-09-21 09:11:02 +08:00
Lukas Wirth
9bf386f4c0 Fix default enum representation not being isize 2022-09-20 17:50:13 +02:00
Lukas Wirth
2119c1f351 Fix using incorrect type for variants in DefWithBody::body_type 2022-09-20 17:29:35 +02:00
Lukas Wirth
b25f0ba15b Properly set the enum variant body expected type 2022-09-20 17:15:48 +02:00
Lukas Wirth
9f233cd5d2 Parse more repr options 2022-09-20 17:12:27 +02:00
Lukas Wirth
6d0d051628 Simplify 2022-09-20 17:12:10 +02:00
bors
817a6a8609 Auto merge of #12966 - OleStrohm:master, r=Veykril
feat: Display the value of enum variant on hover

fixes #12955

This PR adds const eval support for enums, as well as showing their value on hover, just as consts currently have.

I developed these two things at the same time, but I've realized now that they are separate. However since the hover is just a 10 line change (not including tests), I figured I may as well put them in the same PR. Though if you want them split up into "enum const eval support"  and "show enum variant value on hover", I think that's reasonable too.

Since this adds const eval support for enums this also allows consts that reference enums to have their values computed now too.

The const evaluation itself is quite rudimentary, it doesn't keep track of the actual type of the enum, but it turns out that Rust doesn't actually either, and `E::A as u8` is valid regardless of the `repr` on `E`.

It also doesn't really care about what expression the enum variant contains, it could for example be a string, despite that not being allowed, but I guess it's up to the `cargo check` diagnostics to inform of such issues anyway?
2022-09-20 14:01:16 +00:00
bors
09600a3a5b Auto merge of #13268 - Veykril:simplify, r=Veykril
Simplify
2022-09-20 12:35:18 +00:00
Lukas Wirth
027bfd68ba Fix operator highlighting tags applying too broadly 2022-09-20 14:33:44 +02:00
Lukas Wirth
7e8eac3fd7 Simplify 2022-09-20 14:33:18 +02:00