Commit graph

28095 commits

Author SHA1 Message Date
Lukas Wirth
399dbc074b internal: Enforce utf8 paths 2024-03-19 15:39:00 +01:00
goodmost
d6b0aae019 chore: remove repetitive words
Signed-off-by: goodmost <zhaohaiyang@outlook.com>
2024-03-19 22:14:13 +08:00
Nadrieril
08a5f1e52a Skip the test when testing locally 2024-03-19 15:08:57 +01:00
bors
e03df77d04 Auto merge of #16812 - ShoyuVanilla:issue-3739, r=Veykril
fix: Goto implementation to impls inside blocks

Fixes #3739
2024-03-19 13:15:36 +00:00
Shoyu Vanilla
967a864d03 fix: Goto implementation to impls inside blocks 2024-03-19 22:04:48 +09:00
bors
b91697de8f Auto merge of #16886 - Veykril:dev-deps-delay, r=Veykril
internal: Delay drawing of workspace dev-dependency edges

Follow up to https://github.com/rust-lang/rust-analyzer/pull/16871

With this we should prefer non-dev deps if they do form a cycle, https://github.com/rust-lang/rust-analyzer/issues/14167
2024-03-19 10:39:54 +00:00
Lukas Wirth
ba339596bf internal: Delay drawing of workspace dev-dependency edges 2024-03-19 11:37:27 +01:00
bors
1c2d7d02ea Auto merge of #16884 - Veykril:grammar-codegen, r=Veykril
internal: Move grammar codegen into xtask

https://github.com/rust-lang/rust-analyzer/issues/14778, also threw in the one line fix for https://github.com/rust-lang/rust-analyzer/issues/13912
2024-03-19 10:11:42 +00:00
bors
054ebf9482 Auto merge of #16885 - Veykril:match-recovery, r=Veykril
fix: Improve error recovery for match arms

This should make use of the recovery token sets, but I think it'd be better to fix that as a whole while fixing the other places for these adhoc recovery checks.
2024-03-19 09:58:31 +00:00
Lukas Wirth
b38d5394bb internal: Move grammar codegen into xtask 2024-03-19 10:57:53 +01:00
Lukas Wirth
dc4e5987a4 fix: Improve error recovery for match arms 2024-03-19 10:55:47 +01:00
bors
c626db048c Auto merge of #16883 - Veykril:progress-report, r=Veykril
minor: Do progress reporting for crate-graph construction

Also fixes https://github.com/rust-lang/rust-analyzer/issues/16828
2024-03-19 09:08:56 +00:00
Lukas Wirth
232125be12 minor: Do progress reporting for crate-graph construction 2024-03-19 10:06:51 +01:00
bors
4de0204d58 Auto merge of #16880 - HKalbasi:test-explorer, r=HKalbasi
Use `--workspace` and `--no-fail-fast` in test explorer

This PR contains:
* Using `--workspace` in `cargo test` command, to running all tests even when there is a crate in the root of a workspace
* Using `--no-fail-fast` to run all requested tests
* Excluding bench in the test explorer
* Fixing a bug in the `hack_recover_crate_name`

fix #16874
2024-03-18 22:26:41 +00:00
hkalbasi
92300e8f86 Use --workspace and --no-fail-fast in test explorer 2024-03-19 01:46:41 +03:30
bors
59b9cc17f9 Auto merge of #16871 - Veykril:dev-dependency-cycles, r=Veykril
fix: Skip problematic cyclic dev-dependencies

Implements a workaround for https://github.com/rust-lang/rust-analyzer/issues/14167, notably it does not implement the ideas surfaced in the issue, but takes a simpler to implement approach (and one that is more consistent).

Effectively, all this does is discard dev-dependency edges that go from a workspace library target to another workspace library target. This means, using a dev-dependency to another workspace member inside unit tests will always fail to resolve for r-a now, (instead of being order dependent and causing problems elsewhere) while things will work out fine in integration tests, benches, examples etc. This effectively acknowledges package cycles to be okay, but crate graph cycles to be invalid:

Quoting https://github.com/rust-lang/rust-analyzer/issues/14167#issuecomment-1864145772
> Though, if you have “package cycle” in integration tests, you’d have “crate cycle” in unit test.

We disallow the latter here, while continuing to support the former

(What's missing is to supress diagnostics for such unit tests, though not doing so might be a good deterrent, making devs avoid the pattern altogether)
2024-03-18 20:54:38 +00:00
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
Lukas Wirth
76fb73a99e Skip problematic cyclic dev-dependencies 2024-03-18 11:25:59 +01: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