Commit Graph

28028 Commits

Author SHA1 Message Date
Nadrieril
040f37a99d Avoid hanging on complex matches 2024-03-18 21:21:52 +01:00
Nadrieril
e67adf40c9 Don't assume place validity when we don't know 2024-03-18 21:21:52 +01:00
Nadrieril
3cfcd4ed96 Abstract over the uses of compute_match_usefulness 2024-03-18 21:21:52 +01:00
bors
d3eeadc242 Auto merge of #16852 - ShoyuVanilla:atpit, r=Veykril
feat: Implement ATPIT

Resolves #16584

Note: This implementation only works for ATPIT, not for TAIT.
The main hinderence that blocks the later is the defining sites of TAIT can be inner blocks like in;
```rust
type X = impl Default;

mod foo {
    fn bar() -> super::X {
        ()
    }
}
```
So, to figure out we are defining it or not, we should recursively probe for nested modules and bodies.

For ATPIT, we can just look into current body because `error[E0401]: can't use 'Self' from outer item` prevent such nested structures;

```rust
trait Foo {
    type Item;
    fn foo() -> Self::Item;
}

struct Bar;

impl Foo for Bar {
    type Item = impl Default;
    fn foo() -> Self::Item {
        fn bar() -> Self::Item {
                    ^^^^^^^^^^
                    |
                    use of `Self` from outer item
                    refer to the type directly here instead
            5
        }
        bar()
    }
}
```

But this implementation does not checks for unification of same ATPIT between different bodies, monomorphization, nor layout for similar reason. (But these can be done with lazyness if we can utilize something like "mutation of interned value" with `db`. I coundn't find such thing but I would appreciate it if such thing exists and you could let me know 😅)
2024-03-18 10:38:24 +00:00
Shoyu Vanilla
d034ab0f92 Apply reviewed suggestions 2024-03-18 18:25:41 +09:00
bors
7c2bb75bc8 Auto merge of #16860 - Veykril:macarons, r=Veykril
feat: Syntax highlighting improvements

Specifically
- Adds a new `constant` modifier, attached to keyword `const` (except for `*const ()` and `&raw const ()`), `const` items and `const` functions
- Adds (or rather reveals) `associated` modifier for associated items
- Fixes usage of the standard `static` modifier, now it acts like `associated` except being omitted for methods.
- Splits `SymbolKind::Function` into `Function` and `Method`. We already split other things like that (notable self param from params), so the split makes sense in general as a lot special cases around it anyways.
2024-03-18 09:14:08 +00:00
bors
f40c7d8a9c Auto merge of #16822 - Veykril:inlays, r=Veykril
fix: Make inlay hint resolving work better for inlays targetting the same position
2024-03-18 09:00:59 +00:00
Lukas Wirth
4a93368590 Use a hash to find the correct inlay hint when resolving 2024-03-18 09:51:51 +01:00
Lukas Wirth
3115fd8b41 Simplify inlay hints needs_resolve 2024-03-18 09:50:27 +01:00
bors
f6e2895ee6 Auto merge of #16839 - Wilfred:extension_refactor_for_shell, r=Veykril
Refactor extension to support arbitrary shell command runnables

Currently, the extension assumes that all runnables invoke cargo. Arguments are sometimes full CLI arguments, and sometimes arguments passed to a cargo subcommand.

Refactor the extension so that tasks are just a `program` and a list of strings `args`, and rename `CargoTask` to `RustTask` to make it generic.

(This was factored out of #16135 and tidied.)
2024-03-18 08:48:57 +00:00
bors
a71a0328d8 Auto merge of #16830 - Jesse-Bakker:fix-ty-panic, r=ShoyuVanilla
Fix panic with impl trait associated types in where clause

Not sure if this is the correct fix, but the tests are green :')

Fixes #16823
2024-03-18 08:35:53 +00:00
Lukas Wirth
4b679f90dd Generate AST in a more stable manner 2024-03-18 09:24:10 +01:00
bors
f07489ada9 Auto merge of #16868 - roife:fix-issue-16848, r=Veykril
fix: handle attributes when typing curly bracket

fix #16848.

When inserting a `{`, if it is identified that the front part of `expr` is `attr`, we consider it as inserting `{}` around the entire `expr` (excluding the attr part).
2024-03-18 08:22:26 +00:00
bors
65c601fa42 Auto merge of #16863 - Nadrieril:update-pat-ana, r=Veykril
Bump dependencies and use in-tree `rustc_pattern_analysis`

One last `pattern_analysis` API change. I don't have any more planned! So we can now use the in-tree version when available.
2024-03-18 08:08:11 +00:00
roife
109344cfb7 fix: handle attributes when typing curly bracket 2024-03-18 13:29:14 +08:00
bors
b6d1887bc4 Auto merge of #16861 - Veykril:macro-diag-exceptions, r=Veykril
fix: Ignore some warnings if they originate from within macro expansions

These tend to be annoying noise as we can't handle `allow`s for them properly for the time being.
2024-03-17 20:41:40 +00:00
Lukas Wirth
bb541c38d3 fix: Ignore some warnings if they originate from within macro expansions 2024-03-17 21:30:56 +01:00
bors
c1122c9eeb Auto merge of #16862 - matthiaskrgr:noclone, r=Veykril
internal: remove redundant clone()s
2024-03-17 20:28:52 +00:00
bors
3d39ddf255 Auto merge of #16864 - lnicola:sync-from-rust, r=lnicola
internal: Sync from downstream
2024-03-17 15:56:41 +00:00
Laurențiu Nicola
405a62615d Merge branch 'master' into sync-from-rust 2024-03-17 17:52:56 +02:00
Nadrieril
8d59aaf735 Use in-tree rustc_pattern_analysis 2024-03-17 14:16:30 +01:00
Nadrieril
b99618c191 Bump dependencies 2024-03-17 14:11:44 +01:00
Matthias Krüger
2a8edaa14d remove redundant clone()s 2024-03-17 14:06:21 +01:00
Lukas Wirth
20d521db74 Adjust benchmark_syntax_highlighting_parser for changes 2024-03-17 11:38:10 +01:00
Lukas Wirth
77607ab99a More precise highlighting rules for constant modifier 2024-03-17 11:26:05 +01:00
Lukas Wirth
640c8b722e Move custom async modifier to standard one 2024-03-17 11:10:29 +01:00
Lukas Wirth
23fff55f0c Split SymbolKind::Function into Function and Method 2024-03-17 11:07:22 +01:00
Lukas Wirth
c8f6655327 Don't emit modifiers depending on the symbol kind in lsp conversion layer 2024-03-17 10:40:32 +01:00
Lukas Wirth
66adc1cc94 Emit Const modifier in syntax highlighting for const-like things 2024-03-17 10:35:33 +01:00
Laurențiu Nicola
5a95a53a39 Merge commit '5ecace48f693afaa6adf8cb23086b651db3aec96' into sync-from-ra 2024-03-17 11:04:52 +02:00
bors
5ecace48f6 Auto merge of #16846 - roife:fix-issue16826, r=Veykril
fix: incorrect handling of `use` and panic issue in `extract_module`.

fix #16826

This PR includes the following changes:

1. Simplify the implementation partially, removing many unnecessary loops and `clone()`.

2. When it is found that the top level of the selection contains a `use` statement, a copy of the `use` will be reinserted before extraction. (#16826)

3. Fixed an issue during `extract_module`, where if the top level of the selected part contains `A` and `use A::B`, it caused a duplication of `use A`.
2024-03-16 17:35:49 +00:00
bors
b94c2852fa Auto merge of #16856 - Veykril:macarons, r=Veykril
fix: Fix wrong where clause rendering on hover

We were not accounting for proper newline indentation in some places making the hover look weird (or just straight up wrong for type aliases)
2024-03-16 17:23:02 +00:00
Lukas Wirth
d69a81fddb fix: Fix wrong where clause rendering on hover 2024-03-16 17:49:59 +01:00
bors
c8badeb82b Auto merge of #16854 - rust-lang:dependabot/npm_and_yarn/editors/code/follow-redirects-1.15.6, r=lnicola
Bump follow-redirects from 1.15.4 to 1.15.6 in /editors/code

Bumps [follow-redirects](https://github.com/follow-redirects/follow-redirects) from 1.15.4 to 1.15.6.
<details>
<summary>Commits</summary>
<ul>
<li><a href="35a517c586"><code>35a517c</code></a> Release version 1.15.6 of the npm package.</li>
<li><a href="c4f847f851"><code>c4f847f</code></a> Drop Proxy-Authorization across hosts.</li>
<li><a href="8526b4a1b2"><code>8526b4a</code></a> Use GitHub for disclosure.</li>
<li><a href="b1677ce001"><code>b1677ce</code></a> Release version 1.15.5 of the npm package.</li>
<li><a href="d8914f7982"><code>d8914f7</code></a> Preserve fragment in responseUrl.</li>
<li>See full diff in <a href="https://github.com/follow-redirects/follow-redirects/compare/v1.15.4...v1.15.6">compare view</a></li>
</ul>
</details>
<br />

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=follow-redirects&package-manager=npm_and_yarn&previous-version=1.15.4&new-version=1.15.6)](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-03-16 07:05:14 +00:00
dependabot[bot]
64c12e665b
Bump follow-redirects from 1.15.4 to 1.15.6 in /editors/code
Bumps [follow-redirects](https://github.com/follow-redirects/follow-redirects) from 1.15.4 to 1.15.6.
- [Release notes](https://github.com/follow-redirects/follow-redirects/releases)
- [Commits](https://github.com/follow-redirects/follow-redirects/compare/v1.15.4...v1.15.6)

---
updated-dependencies:
- dependency-name: follow-redirects
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-03-16 06:57:29 +00:00
bors
ee03bd0581 Auto merge of #16851 - lnicola:ubuntu-20.04, r=lnicola
internal: Build releases on Ubuntu 20.04

Closes #16793
2024-03-16 06:45:16 +00:00
Shoyu Vanilla
fc53c59388 fix: typo 2024-03-16 03:53:55 +09:00
Shoyu Vanilla
d2aba91a0c feat: Implement ATPIT 2024-03-16 03:31:12 +09:00
Laurențiu Nicola
bf89762204 Build releases on Ubuntu 20.04 2024-03-15 18:16:11 +02:00
bors
d7ec7a5441 Auto merge of #16847 - HKalbasi:test-explorer, r=HKalbasi
Distinguish integration tests from crates in test explorer

Fix part of #16827
2024-03-15 14:25:53 +00:00
hkalbasi
dcfc9ccace Distinguish integration tests from crates in test explorer 2024-03-15 17:16:28 +03:30
bors
f9a4d05195 Auto merge of #16845 - HKalbasi:test-explorer, r=HKalbasi
Show compilation progress in test explorer

Fix part of #16827
2024-03-15 13:15:35 +00:00
roife
10aa999c74 fix: typo 2024-03-15 21:14:17 +08:00
roife
d40c0fe48b test: add test for extract_module 2024-03-15 21:05:04 +08:00
roife
513c6d35ed fix: re-insert use stmts that is extracted 2024-03-15 21:04:51 +08:00
hkalbasi
eeff20d172 Show compilation progress in test explorer 2024-03-15 16:28:59 +03:30
bors
d763e05182 Auto merge of #16844 - Veykril:macarons, r=Veykril
internal: Replace `Span` with `SyntaxContextId` in `MacroCallLoc`

This makes these a lot more stable again
2024-03-15 12:32:06 +00:00
Lukas Wirth
0dd89d7ee7 Remove usages of SpanData where Span suffices 2024-03-15 13:02:40 +01:00
roife
de716058c9 fix: remove useless loop 2024-03-15 19:54:58 +08:00
Lukas Wirth
b59c8c76db Repalce Span with SyntaxContextId in MacroCallLoc 2024-03-15 12:47:05 +01:00