Commit graph

30362 commits

Author SHA1 Message Date
Wilfred Hughes
d68e549205 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
e059feadef 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
b50fc06e0d fix: avoid doubling cargo args in runnables 2024-06-13 11:08:58 -04:00
bors
57e990bbc1 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
0cbf9009e6 fix: add a breaker to avoid infinite loops from source root cycles 2024-06-13 06:32:05 +01:00
bors
fa486e694e 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
ba543f7d76 internal: Don't unnecessarily clone ModPaths out of interning wrappers 2024-06-12 11:43:36 +02:00
bors
22648b2655 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
855282fa53 internal: Don't unnecessarily clone ModPaths in early name res 2024-06-12 11:25:19 +02:00
bors
b5e0d7c349 Auto merge of #17398 - Veykril:bogus-file, r=Veykril
internal: Remove FileId::BOGUS
2024-06-12 07:19:31 +00:00
Lukas Wirth
8ebabce475 internal: Remove FileId::BOGUS 2024-06-12 08:16:07 +02:00
bors
4af21ffb02 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
71a78a9cdc feature: add build system info; runnables to rust-project.json 2024-06-11 11:55:17 -04:00
bors
c07076b35c 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
1ecf230792 fix: Fix HirDisplay stackoverflow for parameter Self defaults 2024-06-11 17:04:07 +02:00
bors
43d59851f6 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
0a16ae340b 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
bcf4221ab3 edit: Length to Len in benchmark 2024-06-11 09:09:56 -04:00
roife
224d0dd36e refactor: move the logic that displays container type bounds to function fmt 2024-06-11 21:02:13 +08:00
roife
ab7c7d4501 fix: skip container header if no generics params 2024-06-11 21:02:13 +08:00
roife
9f70f87d35 internal: simplify and rename display_xxx to write_xxx for consistency 2024-06-11 21:02:13 +08:00
roife
78118f98f6 feat: add hover config for showing container bounds 2024-06-11 21:02:13 +08:00
roife
184ddc6f5b feat: show type bounds from containers for functions 2024-06-11 21:02:13 +08:00
roife
af1291bbf3 internal: simplify and refactor write_where_clause 2024-06-11 21:02:13 +08:00
randomicon00
df63300092 edit: change 'Length' to 'Len' 2024-06-11 08:49:30 -04:00
bors
ff83ec6835 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]
2a4886a8b6
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
ba1c56c83a 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
1dcb11be5d Simplify some config serialization stuff 2024-06-11 10:45:17 +02:00
bors
575becbf27 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
c86d6230fe 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
733995c0d7 fix: ensure that the parent of a SourceRoot cannot be itself 2024-06-10 23:15:26 +08:00
bors
14a1f4530c 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 30c04d5aa9

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
30c04d5aa9 Remove extra parse cache from Semantics again 2024-06-10 12:04:35 +02:00
Lukas Wirth
8520a0c585 Thread more HasSource::source calls through Semantics for caching 2024-06-10 10:33:07 +02:00
bors
72dfbe95de Auto merge of #17372 - Veykril:parallel-diagnostics, r=Veykril
feat: Compute native diagnostics in parallel
2024-06-10 07:34:36 +00:00
bors
b427d460eb 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
2328085a79 Don't intern attribute inputs as their spans make them unique 2024-06-09 21:21:33 +02:00
Young-Flash
6403bdb930 minor: use push_str instead 2024-06-09 22:31:55 +08:00
Young-Flash
e8941dae46 internal: tweak test case 2024-06-09 20:55:40 +08:00
Lukas Wirth
2ced362e57 Fix divide by zero 2024-06-09 13:03:01 +02:00
Lukas Wirth
d4dc3ca83b Register virtual workspace Cargo.toml files in the VFS 2024-06-09 12:54:50 +02:00
Lukas Wirth
e972dd2385 Allow choosing logical cores for num threads config 2024-06-09 12:04:28 +02:00
Lukas Wirth
7f1f85ac16 feat: Compute native diagnostics in parallel 2024-06-09 11:44:44 +02:00
Young-Flash
dcbc76b967 internal: better print style for hir 2024-06-09 12:00:43 +08:00
bors
913371fb0b 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
6a171952f7 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
0c795a7226 fix: Fix generated markers not being patchable in package.json 2024-06-08 12:54:43 +02:00
DropDemBits
4e6d908382
internal: Expose snippet capability to diagnostic quickfixes 2024-06-07 21:29:48 -04:00
bors
a8ad08b9b2 Auto merge of #17359 - Veykril:status-bar, r=Veykril
Add version info to status bar item
2024-06-07 12:51:28 +00:00