Commit graph

255360 commits

Author SHA1 Message Date
bors
5ca4b3dcf5 Auto merge of #17418 - Wilfred:rustdoc_warnings, r=Veykril
internal: Fix rustdoc warnings

`cargo doc` generates a bunch of warnings on rust-analyzer. Fix all the bare URL and empty code block warnings.
2024-06-14 06:07:18 +00:00
Wilfred Hughes
501cef922d internal: Fix rustdoc warnings
`cargo doc` generates a bunch of warnings on rust-analyzer. Fix all the
bare URL and empty code block warnings.
2024-06-13 17:29:10 -07:00
bors
85e87fbf29 Auto merge of #17407 - davidbarsky:david/fix-17402, r=Veykril
fix: avoid doubling cargo args in runnables

Fixes #17402.

Sorry about this—I think I missed up the rebase!
2024-06-13 15:34:29 +00:00
David Barsky
c2843be1bb fix: avoid doubling cargo args in runnables 2024-06-13 11:08:58 -04:00
bors
66ec9772b5 Auto merge of #17412 - davidhewitt:source-loop-cycle-bail, r=Veykril
fix: add a breaker to avoid infinite loops from source root cycles

See #17409

This patch prevents infinite looping from cycles by giving up if the number of source roots checked for a config value reaches the total number of source roots.

Alternative more precise options include creating a set of all source roots visited and giving up as soon as a cycle is encountered, but I wasn't sure how costly an allocation would be here for performance.

Can confirm that locally this fixes the problem for me.
2024-06-13 10:16:48 +00:00
David Hewitt
a29d99de3b fix: add a breaker to avoid infinite loops from source root cycles 2024-06-13 06:32:05 +01:00
bors
51ea7e8318 Auto merge of #17406 - Veykril:modpath-clone, r=Veykril
internal: Don't unnecessarily clone ModPaths out of interning wrappers
2024-06-12 09:49:41 +00:00
Lukas Wirth
4e21a5a391 internal: Don't unnecessarily clone ModPaths out of interning wrappers 2024-06-12 11:43:36 +02:00
bors
68fa2a9bc4 Auto merge of #17405 - Veykril:modpath-clone, r=Veykril
internal: Don't unnecessarily clone ModPaths in early name res
2024-06-12 09:27:49 +00:00
Lukas Wirth
1a26a1f232 internal: Don't unnecessarily clone ModPaths in early name res 2024-06-12 11:25:19 +02:00
bors
031d37ff95 Auto merge of #17398 - Veykril:bogus-file, r=Veykril
internal: Remove FileId::BOGUS
2024-06-12 07:19:31 +00:00
Lukas Wirth
c86f3d3234 internal: Remove FileId::BOGUS 2024-06-12 08:16:07 +02:00
bors
a97aef8466 Auto merge of #16840 - Wilfred:shell_runnable, r=Veykril
Allow rust-project.json to include arbitrary shell commands for runnables

This is a follow-up on #16135, resolving the feedback raised :)

Allow rust-project.json to include shell runnables, of the form:

```
{
  "build_info": {
    "label": "//project/foo:my-crate",
    "target_kind": "bin",
    "shell_runnables": [
      {
        "kind": "run",
        "program": "buck2",
        "args": ["run", "//project/foo:my-crate"]
      },
      {
        "kind": "test_one",
        "program": "test_runner",
        "args": ["--name=$$TEST_NAME$$"]
      }
    ]
  }
}

```

If these runnable configs are present for the current crate in rust-project.json, offer them as runnables in VS Code.

This PR required some boring changes to APIs that previously only handled cargo situations. I've split out these changes as commits labelled 'refactor', so it's easy to see the interesting changes.
2024-06-11 16:13:10 +00:00
Wilfred Hughes
1e9e86c655 feature: add build system info; runnables to rust-project.json 2024-06-11 11:55:17 -04:00
bors
5e1ab70dff Auto merge of #17394 - Veykril:recurse-fix, r=Veykril
fix: Fix `HirDisplay` stackoverflow for parameter Self defaults

Fixes https://github.com/rust-lang/rust-analyzer/issues/10932
2024-06-11 15:05:26 +00:00
Lukas Wirth
36caa43ec1 fix: Fix HirDisplay stackoverflow for parameter Self defaults 2024-06-11 17:04:07 +02:00
bors
21e9022cda Auto merge of #17364 - roife:fix-issue-12917, r=Veykril
feat: show type bounds from containers when hovering on functions

fix #12917.

### Changes

1. Added Support for displaying the container and type bounds from it when hovering on functions with generic types.
2. Added a user config to determine whether to display container bounds (enabled by default).
3. Added regression tests.
4. Simplified and refactored `hir/display.rs` to improve readability.
2024-06-11 13:28:11 +00:00
bors
a3ec3b9621 Auto merge of #17392 - randomicon00:17242, r=Veykril
Change 'Length' to 'Len'

This is a fix for #17242
2024-06-11 13:14:56 +00:00
randomicon00
ca7e04ffe1 edit: Length to Len in benchmark 2024-06-11 09:09:56 -04:00
roife
668327a672 refactor: move the logic that displays container type bounds to function fmt 2024-06-11 21:02:13 +08:00
roife
6c122f6990 fix: skip container header if no generics params 2024-06-11 21:02:13 +08:00
roife
687889c5c3 internal: simplify and rename display_xxx to write_xxx for consistency 2024-06-11 21:02:13 +08:00
roife
445e8866a3 feat: add hover config for showing container bounds 2024-06-11 21:02:13 +08:00
roife
e5f859868e feat: show type bounds from containers for functions 2024-06-11 21:02:13 +08:00
roife
80a2ac5681 internal: simplify and refactor write_where_clause 2024-06-11 21:02:13 +08:00
randomicon00
25004a1018 edit: change 'Length' to 'Len' 2024-06-11 08:49:30 -04:00
bors
4cf0490c21 Auto merge of #17389 - rust-lang:dependabot/npm_and_yarn/editors/code/braces-3.0.3, r=lnicola
Chore(deps-dev): Bump braces from 3.0.2 to 3.0.3 in /editors/code

Bumps [braces](https://github.com/micromatch/braces) from 3.0.2 to 3.0.3.
<details>
<summary>Commits</summary>
<ul>
<li><a href="74b2db2938"><code>74b2db2</code></a> 3.0.3</li>
<li><a href="88f1429a0f"><code>88f1429</code></a> update eslint. lint, fix unit tests.</li>
<li><a href="415d660c30"><code>415d660</code></a> Snyk js braces 6838727 (<a href="https://redirect.github.com/micromatch/braces/issues/40">#40</a>)</li>
<li><a href="190510f79d"><code>190510f</code></a> fix tests, skip 1 test in test/braces.expand</li>
<li><a href="716eb9f12d"><code>716eb9f</code></a> readme bump</li>
<li><a href="a5851e57f4"><code>a5851e5</code></a> Merge pull request <a href="https://redirect.github.com/micromatch/braces/issues/37">#37</a> from coderaiser/fix/vulnerability</li>
<li><a href="2092bd1fb1"><code>2092bd1</code></a> feature: braces: add maxSymbols (<a href="https://github.com/micromatch/braces/issues/">https://github.com/micromatch/braces/issues/</a>...</li>
<li><a href="9f5b4cf473"><code>9f5b4cf</code></a> fix: vulnerability (<a href="https://security.snyk.io/vuln/SNYK-JS-BRACES-6838727">https://security.snyk.io/vuln/SNYK-JS-BRACES-6838727</a>)</li>
<li><a href="98414f9f1f"><code>98414f9</code></a> remove funding file</li>
<li><a href="665ab5d561"><code>665ab5d</code></a> update keepEscaping doc (<a href="https://redirect.github.com/micromatch/braces/issues/27">#27</a>)</li>
<li>Additional commits viewable in <a href="https://github.com/micromatch/braces/compare/3.0.2...3.0.3">compare view</a></li>
</ul>
</details>
<br />

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=braces&package-manager=npm_and_yarn&previous-version=3.0.2&new-version=3.0.3)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting ``@dependabot` rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- ``@dependabot` rebase` will rebase this PR
- ``@dependabot` recreate` will recreate this PR, overwriting any edits that have been made to it
- ``@dependabot` merge` will merge this PR after your CI passes on it
- ``@dependabot` squash and merge` will squash and merge this PR after your CI passes on it
- ``@dependabot` cancel merge` will cancel a previously requested merge and block automerging
- ``@dependabot` reopen` will reopen this PR if it is closed
- ``@dependabot` close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- ``@dependabot` show <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency
- ``@dependabot` ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- ``@dependabot` ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- ``@dependabot` ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
You can disable automated security fix PRs for this repo from the [Security Alerts page](https://github.com/rust-lang/rust-analyzer/network/alerts).

</details>
2024-06-11 09:05:34 +00:00
dependabot[bot]
5e3bf0a8a9
Chore(deps-dev): Bump braces from 3.0.2 to 3.0.3 in /editors/code
Bumps [braces](https://github.com/micromatch/braces) from 3.0.2 to 3.0.3.
- [Changelog](https://github.com/micromatch/braces/blob/master/CHANGELOG.md)
- [Commits](https://github.com/micromatch/braces/compare/3.0.2...3.0.3)

---
updated-dependencies:
- dependency-name: braces
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-06-11 09:01:41 +00:00
bors
d181bfdb0b Auto merge of #17374 - Veykril:configs, r=Veykril
Allow choosing logical cores for num threads config
2024-06-11 08:49:19 +00:00
Lukas Wirth
34d273b5be Simplify some config serialization stuff 2024-06-11 10:45:17 +02:00
bors
704b56b5bb Auto merge of #17377 - Young-Flash:hir_print, r=Veykril
internal: better print style for hir

before:
![before](https://github.com/rust-lang/rust-analyzer/assets/71162630/cd5e27b3-b4b1-450f-ba50-3c4f4e345d70)

after:
![after](https://github.com/rust-lang/rust-analyzer/assets/71162630/04e11345-cadd-49cb-b10c-6888ef51758e)
2024-06-11 08:05:40 +00:00
bors
c995190044 Auto merge of #17381 - roife:fix-issue-17378, r=Veykril
fix: ensure that the parent of a SourceRoot cannot be itself

fix #17378.

In `FileSetConfig.map`, different roots might be mapped to the same `root_id` due to deduplication in `ProjectFolders::new`:

```rust
// Example from rustup
/Users/roife/code/rustup/target/debug/build/rustup-863a063426b56c51/out
/Users/roife/code/rustup
```

In `source_root_parent_map`, r-a might encounter paths where their SourceRootId (i.e. `root_id`) is identical, yet one the them is the parent of the another. This situation can cause the `root_id` to be its own parent, potentially leading to an infinite loop.

This PR resolves such cases by adding a check.
2024-06-10 17:43:06 +00:00
roife
5aa6137470 fix: ensure that the parent of a SourceRoot cannot be itself 2024-06-10 23:15:26 +08:00
bors
8fd1b507ea Auto merge of #17380 - Veykril:sema-source, r=Veykril
fix: Remove extra parse cache from Semantics again

Should fix https://github.com/rust-lang/rust-analyzer/issues/17376, specifically 30c04d5aa9523140f0f2daa07bc461534fb09b95

The recent changes here were heavily triggering what I realized in https://github.com/rust-lang/rust-analyzer/issues/17367#issuecomment-2156374726
2024-06-10 10:06:44 +00:00
Lukas Wirth
ac9cdbbfa6 Remove extra parse cache from Semantics again 2024-06-10 12:04:35 +02:00
Lukas Wirth
0a57742600 Thread more HasSource::source calls through Semantics for caching 2024-06-10 10:33:07 +02:00
bors
0ef2213ed8 Auto merge of #17372 - Veykril:parallel-diagnostics, r=Veykril
feat: Compute native diagnostics in parallel
2024-06-10 07:34:36 +00:00
bors
5a1df7f548 Auto merge of #17375 - Veykril:attr-input-no-intern, r=Veykril
Don't intern attribute inputs as their spans make them unique
2024-06-09 19:35:14 +00:00
Lukas Wirth
a65c912663 Don't intern attribute inputs as their spans make them unique 2024-06-09 21:21:33 +02:00
Young-Flash
b45cf63f06 minor: use push_str instead 2024-06-09 22:31:55 +08:00
Young-Flash
6e08590436 internal: tweak test case 2024-06-09 20:55:40 +08:00
Lukas Wirth
a800a1d86a Fix divide by zero 2024-06-09 13:03:01 +02:00
Lukas Wirth
7053aed3dc Register virtual workspace Cargo.toml files in the VFS 2024-06-09 12:54:50 +02:00
Lukas Wirth
02dd22721c Allow choosing logical cores for num threads config 2024-06-09 12:04:28 +02:00
Lukas Wirth
3243ea0c2b feat: Compute native diagnostics in parallel 2024-06-09 11:44:44 +02:00
Young-Flash
f4153f46ed internal: better print style for hir 2024-06-09 12:00:43 +08:00
bors
994a9b86ff Auto merge of #17365 - DropDemBits:diagnostic-snippet-cap, r=Veykril
internal: Expose snippet capability to diagnostic quickfixes

Fixes #16767
2024-06-08 12:41:17 +00:00
bors
4f180b6fed Auto merge of #17368 - Veykril:dist-fix, r=Veykril
fix: Fix generated markers not being patchable in package.json

I think the newlines are tripping up CI, so I hope clearing the property to leave an empty object won't make VSCode made here.
2024-06-08 10:56:55 +00:00
Lukas Wirth
b4891c3f56 fix: Fix generated markers not being patchable in package.json 2024-06-08 12:54:43 +02:00
DropDemBits
4f67f71db5
internal: Expose snippet capability to diagnostic quickfixes 2024-06-07 21:29:48 -04:00