Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

⬆️ rust-analyzer #105855

Merged
merged 378 commits into from
Jan 10, 2023
Merged

⬆️ rust-analyzer #105855

merged 378 commits into from
Jan 10, 2023

Conversation

arcnmx
Copy link
Contributor

@arcnmx arcnmx commented Dec 17, 2022

Updates rust-analyzer to rust-lang/rust-analyzer@368e0bb

This is a continuation/replacement of #105834, close that if this is chosen instead.

bors and others added 30 commits December 4, 2022 19:37
Support `rustc_has_incoherent_inherent_impls`

Fixes us not resolving `<dyn Error>::downcast` now that `Error` moved to core, while that assoc function is declared in `alloc`.
The old value was for the old chalk-engine solver, nowadays the newer chalk-recursive solver is used.
The new solver currently uses fuel a bit more quickly, so a higher value is needed.
Running analysis-stats showed that a value of 100 increases the amount of unknown types,
while for a value of 1000 it's staying mostly the same.
Update to Chalk 88

This Chalk release introduces fuel for the recursive solver ([chalk#774](rust-lang/chalk#774)).
I'm not sure how often it calls `should_continue` compared to the other solver, so we might want to increase `CHALK_SOLVER_FUEL`, the current default value of 100 might be too low.

This should fix a lot of hangs and crashes, for example this solves the hang in rust-lang#12897.
Macro2's generally don't have derive helpers, but currently builtin
derive macros are declared with macro2 syntax, which can have derive
helpers.
…r=Veykril

Support builtin derive macro helper attributes

Closes rust-lang#13244

It's a bit wasteful for `Macro2Data` to have `helpers` field currently just for `Default` derive macro, but I tend to think it's okay for the time being given how rare macro2's are used.
Compute data layout of types

cc rust-lang#4091

Things that aren't working:
* Closures
* Generators (so no support for `Future` I think)
* Opaque types
* Type alias and associated types which may need normalization

Things that show wrong result:
* ~Enums with explicit discriminant~
* SIMD types
* ~`NonZero*` and similar standard library items which control layout with special attributes~

At the user level, I didn't put much work, since I wasn't confident about what is the best way to present this information. Currently it shows size and align for ADTs, and size, align, offset for struct fields, in the hover, similar to clangd. I used it some days and I feel I liked it, but we may consider it too noisy and move it to an assist or command.
Add VS Code schema validation for `rust-project.json`

Now that SchemaStore/schemastore#2628 has been merged, adding the `jsonValidation` contribution to the VS Code extension for better editor support when modifying `rust-project.json` files.

Related issue: rust-lang#13714
feat: Add "Remove redundant parentheses" assist

![Peek 2022-12-08 22-22](https://user-images.githubusercontent.com/38225716/206542898-d6c97468-d615-4c5b-8650-f89b9c0321a0.gif)

Can be quite handy when refactoring :)
Show type info on hover of enum variant fields

Small addition to rust-lang/rust-analyzer#13490
bors and others added 12 commits January 9, 2023 15:07
…Veykril

fix: unescape inline module names in module resolution

Fixes rust-lang#13884
…ite, r=lnicola

minor: Make `qualify_method_call` `RefactorRewrite`

See rust-lang/rust-analyzer#13825 (comment)
Rename `checkOnSave` settings to `check`

Now that flychecks can be triggered without saving the setting name doesn't make that much sense anymore. This PR renames it to just `check`, but keeps `checkOnSave` as the enabling setting.
Make it clearer when the server expects an initialized notification
Use ANSI control characters to display text decorations matching the
VScode terminal theme, and strip them out when providing text content
for rustc diagnostics.

This adds the small `anser` library to parse the control codes, and it
also supports HTML output so it should be fairly easy to switch to a
rendered HTML/webview implementation if desired.
…ler-diagnostics, r=ian-h-chamberlain

Colorize `cargo check` diagnostics in VSCode via text decorations

Fixes rust-lang#13648

![colored-rustc-diagnostics](https://user-images.githubusercontent.com/11131775/209479884-10eef8ca-37b4-4aae-88f7-3591ac01b25e.gif)

Use ANSI control characters to display text decorations matching the VScode terminal theme, and strip them out when providing text content for rustc diagnostics.

This adds the small [`anser`](https://www.npmjs.com/package/anser) library (MIT license, no dependencies) to parse the control codes, and it also supports HTML output so it should be fairly easy to switch to a rendered HTML/webview implementation in the future

I also updated the default `cargo check` command to use the rendered ANSI diagnostics, although I'm not sure if it makes sense to put this kind of thing behind a feature flag, or whether it might have any issues on Windows (as I believe ANSI codes are not used for colorization there)?
@arcnmx
Copy link
Contributor Author

arcnmx commented Jan 9, 2023

Is there a particular time/day I should redo this pull? It's probably outdated now...

@lnicola
Copy link
Member

lnicola commented Jan 9, 2023

@arcnmx between now and next Monday (inclusive) might be a good time. There were quite a few changes merged in the past couple of days. Sorry for the delay here.

Merge commit '368e0bb32f1178cf162c2ce5f7e10b7ae211eb26'
@arcnmx arcnmx force-pushed the rust-analyzer-2022-12 branch from afe409b to 06e705f Compare January 9, 2023 18:40
@arcnmx
Copy link
Contributor Author

arcnmx commented Jan 9, 2023

@lnicola updated, poke me if needed again later

@lnicola
Copy link
Member

lnicola commented Jan 9, 2023

Well, what's the worst that could happen?

@bors r+ p=1 (subtree syncs are delicate things)

@Veykril I suppose we need to freeze r-a for now?

@bors
Copy link
Contributor

bors commented Jan 9, 2023

📌 Commit 06e705f has been approved by lnicola

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jan 9, 2023
@bors
Copy link
Contributor

bors commented Jan 9, 2023

⌛ Testing commit 06e705f with merge 3254bef...

@Veykril
Copy link
Member

Veykril commented Jan 9, 2023

Freeze until the r-a side has been synced if I understand the subtree stuff correctly right?

@bors
Copy link
Contributor

bors commented Jan 10, 2023

☀️ Test successful - checks-actions
Approved by: lnicola
Pushing 3254bef to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Jan 10, 2023
@bors bors merged commit 3254bef into rust-lang:master Jan 10, 2023
@rustbot rustbot added this to the 1.68.0 milestone Jan 10, 2023
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (3254bef): comparison URL.

Overall result: ✅ improvements - no action needed

@rustbot label: -perf-regression

Instruction count

This is a highly reliable metric that was used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-0.9% [-0.9%, -0.9%] 1
All ❌✅ (primary) - - 0

Max RSS (memory usage)

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-2.3% [-2.3%, -2.3%] 1
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -2.3% [-2.3%, -2.3%] 1

Cycles

This benchmark run did not return any relevant results for this metric.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.