Skip to content

Subtree update of rust-analyzer #127617

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

Merged
merged 142 commits into from
Jul 16, 2024
Merged

Subtree update of rust-analyzer #127617

merged 142 commits into from
Jul 16, 2024

Conversation

lnicola
Copy link
Member

@lnicola lnicola commented Jul 11, 2024

r? @ghost

chenyukang and others added 30 commits June 21, 2024 00:13
Use full sentences, and mention how to disable the diagnostic
if users are intentionally working on unowned files.
Simplify some term search tactics

Working on the paper `@phijor` found that "Data constructor" tactic could be simplified quite a bit by running it only in the backwards direction. With n+1 rounds it has same coverage as previous implementation in n rounds, however the tactic it self is more simple and also potentially faster as there is less to do.

In a nutshell the idea is to only work with types in the wish-list rather than with any types.

Turns out it is quite a bit faster:

Before:
```
ripgrep:
Tail Expr syntactic hits: 238/1692 (14%)
Tail Exprs found: 1223/1692 (72%)
Term search avg time: 15ms

nalgebra:
Tail Expr syntactic hits: 125/3001 (4%)
Tail Exprs found: 2143/3001 (71%)
Term search avg time: 849ms
```

After
````
ripgrep:
Tail Expr syntactic hits: 246/1692 (14%)
Tail Exprs found: 1209/1692 (71%)
Term search avg time: 8ms

nalgebra:
Tail Expr syntactic hits: 125/3001 (4%)
Tail Exprs found: 2028/3001 (67%)
Term search avg time: 305ms
````

_Also removed niche optimization of removing scope defs from the search space as this wasn't helping much anyway and made code a bit more complex._
fix: pattern completions in let-stmt

fix rust-lang#17480.

We can write `let S { a, b } = s;` or `let Some(x) = a else {}`, so it is reasonable to allow pattern completions in `LetStmt`.
chore: Fix diagnostic name in macro_error.rs
fix: Improve hover text in unlinked file diagnostics

Use full sentences, and mention how to disable the diagnostic if users are intentionally working on unowned files.

![Screenshot 2024-06-12 at 5 55 48 PM](https://github.com/rust-lang/rust-analyzer/assets/70800/c91ee1ed-1c72-495a-9ee3-9e360a5c6977)

(Full disclosure: I've tested a rust-analyzer build in VS Code, but the pop-up logic is currently disabled due to rust-lang#17062, so I haven't tested that.)
… r=Veykril

fix: don't remove parentheses for calls of function-like pointers that are members of a struct or union

Fixes rust-lang#17111
internal: Some more small memory optimizations

Not a big impact on metrics, though there are some more savings in queries mainly used by the IDE layer from this
With each `config::apply_change` duplicate configs were being added.
Now we first drain the vec that holds these and then start adding.
…=alibektas

minor : Fix duplicate snippets showing up on hover.

With each `config::apply_change` duplicate configs were being added.
Now we first drain the vec that holds these and then start adding. This fixes rust-lang#17485
beetrees and others added 11 commits July 10, 2024 10:43
…ame, r=Veykril

feat: add inlay hints for generic parameters

fixes rust-lang#11091

By default, only hints for const generic parameters are shown, and this can be configured through `rust-analyzer.inlayHints.genericParameterHints.enable`.

Probably needs more testing.
Add `f16` and `f128` support

Adds `f16` and `f128` support, using the `rustc_apfloat` library (also used by `rustc`) for parsing/arithmetic/displaying since the types aren't stable yet so can't be used by rust-analyzer itself.

Issue: rust-lang#17451
internal: Remove faq landing page, improve main one

Having more than one is potentialyl annoying as both will get opened upon install, using walkthroughs for this is not ideal. So this merges the two and also adds a couple tips, fixes rust-lang/rust-analyzer#17569
…ykril

feat: do not add new enum if it already exists

## Summary

This PR introduces a check for the existence of another enum within the current scope, and if it exist, we skip `add_enum_def`.

## Why?

Currently, when using the `bool_to_enum` assist more than once, it is possible to add multiple enum definitions. For example, the following snippet,

```rs
#[derive(PartialEq, Eq)]
enum Bool {
    True,
    False,
}

fn main() {
    let a = Bool::True;
    let b = true;
    println!("Hello, world!");
}
```

will be transformed into,

```rs
#[derive(PartialEq, Eq)]
enum Bool {
    True,
    False,
}

#[derive(PartialEq, Eq)]
enum Bool {
    True,
    False,
}

fn main() {
    let a = Bool::True;
    let b = Bool::True;
    println!("Hello, world!");
}
```

This can be annoying for users to clean up.
@rustbot
Copy link
Collaborator

rustbot commented Jul 11, 2024

rust-analyzer is developed in its own repository. If possible, consider making this change to rust-lang/rust-analyzer instead.

cc @rust-lang/rust-analyzer

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jul 11, 2024
@lnicola
Copy link
Member Author

lnicola commented Jul 11, 2024

CC @Veykril ^

@lnicola
Copy link
Member Author

lnicola commented Jul 16, 2024

@rustbot author

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jul 16, 2024
@lnicola
Copy link
Member Author

lnicola commented Jul 16, 2024

@bors r+ p=1 subtree update

@bors
Copy link
Collaborator

bors commented Jul 16, 2024

📌 Commit 3e73272 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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jul 16, 2024
@bors
Copy link
Collaborator

bors commented Jul 16, 2024

⌛ Testing commit 3e73272 with merge a91f7d7...

@bors
Copy link
Collaborator

bors commented Jul 16, 2024

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

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Jul 16, 2024
@bors bors merged commit a91f7d7 into rust-lang:master Jul 16, 2024
7 checks passed
@rustbot rustbot added this to the 1.81.0 milestone Jul 16, 2024
@lnicola lnicola deleted the sync-from-ra branch July 16, 2024 13:22
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (a91f7d7): comparison URL.

Overall result: no relevant changes - no action needed

@rustbot label: -perf-regression

Instruction count

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

Max RSS (memory usage)

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

Cycles

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

Binary size

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

Bootstrap: 700.256s -> 700.14s (-0.02%)
Artifact size: 328.62 MiB -> 328.63 MiB (0.01%)

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.