Commit Graph

25650 Commits

Author SHA1 Message Date
Adenine
add9056c32
Merge branch 'rust-lang:master' into master 2023-07-09 16:10:40 -04:00
bors
dcda13ac69 Auto merge of #15244 - HKalbasi:mir, r=HKalbasi
Support read_via_copy intrinsic
2023-07-09 19:48:54 +00:00
hkalbasi
aa52cbf784 Support read_via_copy intrinsic 2023-07-09 23:17:51 +03:30
bors
c26259bdd1 Auto merge of #15241 - lnicola:manual, r=lnicola
minor: Remove old section about downloading the server from the manual

Closes #15237
2023-07-09 06:26:45 +00:00
Laurențiu Nicola
8befd920d6 Remove old section about downloading the server from the manual 2023-07-09 09:26:05 +03:00
Adenine
1dd54eb44a change viewMemoryLayoutParams to be textPositionParams 2023-07-08 12:25:54 -04:00
Adenine
514bab504e
Merge branch 'rust-lang:master' into master 2023-07-08 12:21:38 -04:00
bors
fdb8aa2ea6 Auto merge of #15235 - omertuc:matchsemi, r=lowr
Stop inserting semicolon when extracting match arm

# Overview

Extracting a match arm value that has type unit into a function, when a
comma already follows the match arm value, results in an invalid (syntax
error) semicolon added between the newly generated function's generated
call and the comma.

# Example

Running this extraction

```rust
fn main() {
    match () {
        _ => $0()$0,
    };
}
```

would lead to

```rust
fn main() {
    match () {
        _ => fun_name();,
    };
}

fn fun_name() {
}
```

# Issue / Fix details

This happens because when there is no comma, rust-analyzer would simply
add the comma and wouldn't even try to evaluate whether it needs to add
a semicolon. But when the comma is there, it proceeds to evaluate
whether it needs to add a semicolon and it looks like the evaluation
logic erroneously ignores the possibility that we're in a match arm.
IIUC it never makes sense to add a semicolon when we're extracting from
a match arm value, so I've adjusted the logic to always decide against
adding a semicolon when we're in a match arm
2023-07-08 15:01:38 +00:00
bors
d9c43b1cc7 Auto merge of #15234 - alibektas:14882, r=alibektas
Remind user to check $PATH after installation.

fixes #14882 . I don't think that this is the correct wording to express this but I at least wanted to take the initiative :)
2023-07-08 14:18:30 +00:00
Ali Bektas
2e5d431dfc
Update docs/user/manual.adoc
Co-authored-by: Laurențiu Nicola <lnicola@users.noreply.github.com>
2023-07-08 16:15:08 +02:00
Omer Tuchfeld
9200d27a26 Stop inserting semicolon when extracting match arm
# Overview

Extracting a match arm value that has type unit into a function, when a
comma already follows the match arm value, results in an invalid (syntax
error) semicolon added between the newly generated function's generated
call and the comma.

# Example

Running this extraction

```rust
fn main() {
    match () {
        _ => $0()$0,
    };
}
```

would lead to

```rust
fn main() {
    match () {
        _ => fun_name();,
    };
}

fn fun_name() {
}
```

# Issue / Fix details

This happens because when there is no comma, rust-analyzer would simply
add the comma and wouldn't even try to evaluate whether it needs to add
a semicolon. But when the comma is there, it proceeds to evaluate
whether it needs to add a semicolon and it looks like the evaluation
logic erroneously ignores the possibility that we're in a match arm.
IIUC it never makes sense to add a semicolon when we're extracting from
a match arm value, so I've adjusted the logic to always decide against
adding a semicolon when we're in a match arm
2023-07-08 15:41:24 +02:00
Ali Bektas
655dd188d6 Remind user to check $PATH after installation. 2023-07-08 11:59:46 +02:00
Adenine
2e515d0ac9 fix weird rebase error 2023-07-07 23:23:19 -04:00
Adenine
4d5c66986e cleanup + docs + tests 2023-07-07 23:12:09 -04:00
Adenine
c43cfefdd8 fix typescript return path warning 2023-07-07 23:09:41 -04:00
Adenine
de5e3cf745 fix incorrect committed rust and run prettier 2023-07-07 23:09:41 -04:00
Adenine
cfa15d49aa implement first pass of memory layout viewer 2023-07-07 23:09:41 -04:00
bors
db0add1ce9 Auto merge of #15230 - HKalbasi:mir, r=HKalbasi
Use debug impl in rendering const eval result

fix #15188
2023-07-07 21:38:14 +00:00
hkalbasi
f0ba0dbe8a Use debug impl in rendering const eval result 2023-07-08 01:07:38 +03:30
bors
c5ca8165e1 Auto merge of #15228 - HKalbasi:mir, r=HKalbasi
Implement recursion in mir interpreter without recursion

This enables interpreting functions with deep stack + profiling. I also applied some changes to make it faster based on the profiling result.
2023-07-07 11:40:47 +00:00
hkalbasi
4a444e768c Implement recursion in mir interpreter without recursion 2023-07-07 15:07:29 +03:30
bors
954a341008 Auto merge of #15226 - alibektas:15109, r=Veykril
assist : add enum to glob_import_expand

fixes #15109
2023-07-07 10:17:55 +00:00
bors
09f666b51b Auto merge of #15227 - DropDemBits:indent-on-blank-line, r=lnicola
fix: Indent after pressing enter on a blank line

Regressed after https://github.com/rust-lang/rust-analyzer/pull/13975 (whoops).
2023-07-07 09:06:56 +00:00
DropDemBits
ebaf8c8135
fix: Indent after pressing enter on a blank line 2023-07-06 23:25:02 -04:00
Ali Bektas
d2693aabd6 assist : add enum to glob_import_expand 2023-07-07 02:40:35 +02:00
bors
927f94161e Auto merge of #15224 - HKalbasi:mir, r=HKalbasi
Replace `x` with `it`

I kept some usages of `x`:
* `x`s that are used together with `y`, `z`, ...
* `x` that shadow `it`. I use `it` for iterators out of r-a, so there were some cases that I used `it` and `x` together.
* `x` in test fixtures. Many of those `x` usages was not me so I thought it's better to keep them as is.

I tried to remove the rest, but since there was too many `x` I might missed some of them or changed some of them that I didn't want to change.
2023-07-06 14:21:10 +00:00
hkalbasi
3a1054fc1c Replace x with it 2023-07-06 17:33:17 +03:30
bors
4125fea0a7 Auto merge of #15222 - HKalbasi:mir, r=HKalbasi
Fix size_of_val and support min_align_of_val
2023-07-06 12:40:21 +00:00
bors
54c2ee9fab Auto merge of #15219 - alibektas:15080, r=Veykril
Unify getter and setter assists

This PR combines what previously have been two different files into a single file. I want to talk about the reasons why I did this. The issue that prompted this PR ( and before I forget : this pr fixes #15080 ) mentions an interesting behavior. We combine these two assists into an assist group and the order in which the assists are listed in this group changes depending on the text range of the selected area. The reason for that is that VSCode prioritizes actions that have a bigger impact in a smaller area and until now generate setter assist was only possible to be invoked for a single field whereas you could generate multiple getters for the getter assist. So I used the latter's infra to make former applicable to multiple fields, hence the unification. So this PR solves in essence

1. Make `generate setter` applicable to multiple fields
2. Provide a consistent order of the said assists in listing.
2023-07-06 12:22:39 +00:00
hkalbasi
171ae2ee5d Fix size_of_val and support min_align_of_val 2023-07-06 15:41:52 +03:30
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
Ali Bektas
1829d550ac Unify getter and setter assists 2023-07-06 12:27:45 +02:00
bors
537f9b311d Auto merge of #15160 - tetsuharuohzeki:enable-noUncheckedIndexedAccess, r=Veykril
editor/code: Enable `--noUncheckedIndexedAccess` & `--noPropertyAccessFromIndexSignature` ts option

This enables typescript's these option:

- [`--noUncheckedIndexedAccess`](https://www.typescriptlang.org/tsconfig#noUncheckedIndexedAccess)
    - This checks whether indexed access is not `null` (or `undefined`) strictly just as like checking by `std::option::Option::unwrap()`.
- [`--noPropertyAccessFromIndexSignature`](https://www.typescriptlang.org/tsconfig#noPropertyAccessFromIndexSignature)
    - This disallows `bar.foo` access if the `bar` type is `{ [key: string]: someType; }`.

----

Additionally, to enable `--noUncheckedIndexedAccess` easily, this pull request introduces [option-t](https://www.npmjs.com/package/option-t) as a dependency instead of defining a function in this repository like `unwrapUndefinable()` .

I'll remove it and define them byself if our dependency management policy is that to avoid to add a new package as possible.
2023-07-06 07:20:25 +00:00
Tetsuharu Ohzeki
f70845305f editor/code: Enable noPropertyAccessFromIndexSignature ts option 2023-07-06 16:17:02 +09:00
Tetsuharu Ohzeki
72a3883a71 editor/code: Enable noUncheckedIndexedAccess ts option
https://www.typescriptlang.org/tsconfig#noUncheckedIndexedAccess
2023-07-06 16:17:02 +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
Tetsuharu Ohzeki
bb35d8fa8e editor/code: Set ts' --moduleResolution=node16 option
https://www.typescriptlang.org/tsconfig#moduleResolution

By this change, typescript compiler can read `exports` field in
package.json for dependencies.
https://nodejs.org/api/packages.html#exports-sugar
2023-07-05 00:48:18 +09: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