Commit graph

16118 commits

Author SHA1 Message Date
OleStrohm
177ec82a41 Rebased 2022-09-12 21:02:30 +01:00
OleStrohm
5313bd1984 Cleaned up code based on feedback 2022-09-12 20:20:45 +01:00
OleStrohm
301b8894ea Added more consteval tests and fixed consteval result 2022-09-12 20:20:45 +01:00
OleStrohm
ad0a6bf1a3 Added consteval tests 2022-09-12 20:20:43 +01:00
OleStrohm
2f84b6e2e5 Almost there 2022-09-12 20:20:22 +01:00
OleStrohm
b63234e20b Cleaned up code 2022-09-12 20:19:49 +01:00
OleStrohm
e28046c673 Removed unnecessary TODO 2022-09-12 20:19:19 +01:00
OleStrohm
997fc46efa Implemented basic enum const eval 2022-09-12 20:19:13 +01:00
Ryo Yoshida
4b5a66e0bc
Add tests for type inference for generators 2022-09-13 02:43:07 +09:00
Ryo Yoshida
447596cccc
Implement RustIrDatabase::generator_datum() 2022-09-13 02:43:05 +09:00
Ryo Yoshida
77c40f878d
Implement type inference for generator and yield expressions 2022-09-13 02:42:52 +09:00
Ryo Yoshida
d223c28c7d
Remove unnecessary Option 2022-09-13 02:20:35 +09:00
bors
f64c95600c Auto merge of #13216 - DesmondWillowbrook:move_format_string_arg, r=DesmondWillowbrook
New assist: move_format_string_arg

The name might need some improving.

```rust
fn main() {
    print!("{x + 1}");
}
```
to
```rust
fn main() {
    print!("{}"$0, x + 1);
}
```

fixes #13180

ref to #5988 for similar work

* extracted `format_like`'s parser to it's own module in `ide-db`
* reworked the parser's API to be more direct
* added assist to extract expressions in format args
2022-09-12 15:50:42 +00:00
bors
b1a4ba3e84 Auto merge of #13223 - lowr:fix/hir-proj-normalization, r=flodiebold
fix: handle lifetime variables in projection normalization

Fixes #12674

The problem is that we've been skipping the binders of normalized projections assuming they should be empty, but the assumption is unfortunately wrong. We may get back lifetime variables and should handle them before returning them as normalized projections. For those who are curious why we get those even though we treat all lifetimes as 'static, [this comment in chalk](d875af0ff1/chalk-solve/src/infer/unify.rs (L888-L908)) may be interesting.

I thought using `InferenceTable` would be cleaner than the other ways as it already has the methods for canonicalization, normalizing projection, and resolving variables, so moved goal building and trait solving logic to a new `HirDatabase` query. I made it transparent query as the query itself doesn't do much work but the eventual call to `HirDatabase::trait_solve_query()` does.
2022-09-12 14:24:57 +00:00
Ryo Yoshida
efb56160c9
fix: handle lifetime variables in projection normalization 2022-09-12 22:52:58 +09:00
Kartavya Vashishtha
54e9324e93
Update crates/ide-assists/src/handlers/move_format_string_arg.rs
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-09-12 05:45:11 -07:00
bors
7a704f2cc7 Auto merge of #13147 - lowr:fix/dyn-ty-inherent-methods, r=Veykril
fix: handle trait methods as inherent methods for trait-related types

Fixes #10677

When resolving methods for trait object types and placeholder types that are bounded by traits, we need to count the methods of the trait and its super traits as inherent methods. This matters because these trait methods have higher priority than the other traits' methods.

Relevant code in rustc: [`assemble_inherent_candidates_from_object()`](0631ea5d73/compiler/rustc_typeck/src/check/method/probe.rs (L783-L792)) for trait object types, [`assemble_inherent_candidates_from_param()`](0631ea5d73/compiler/rustc_typeck/src/check/method/probe.rs (L838-L847)) for placeholder types. Notice the second arg of `push_candidate()` is `is_inherent`.
2022-09-12 12:19:14 +00:00
bors
e38dfe5536 Auto merge of #13186 - enomado:master, r=Veykril
Filter imports on find-all-references

Attempt to #13184
2022-09-12 12:09:57 +00:00
bors
352a5b8625 Auto merge of #13212 - Veykril:no-std-config, r=Veykril
Add config to unconditionally prefer core imports over std

Fixes https://github.com/rust-lang/rust-analyzer/issues/12979
2022-09-12 11:51:31 +00:00
Borys Minaiev
32603baac3 Remove redundant 'resolve_obligations_as_possible' call 2022-09-12 11:03:44 +01:00
Mathew Horner
8a2803d9ae Allow configuration of annotation location.
Previously, annotations would only appear above the name of an item (function signature, struct declaration, etc).

Now, rust-analyzer can be configured to show annotations either above the name or above the whole item (including doc comments and attributes).
2022-09-11 22:40:33 -05:00
Kartavya Vashishtha
fb5ae9906b
suggest ExtractRefactor if no expressions found
Added `Ident` variant to arg enum.
2022-09-11 10:39:25 +05:30
Kartavya Vashishtha
a5cbee4d11
remove false positive 2022-09-10 21:04:25 +05:30
Kartavya Vashishtha
cc7200891b
new lint: move_format_string_arg
The name might need some improving.

extract format_like's parser to it's own module in ide-db

reworked the parser's API to be more direct

added assist to extract expressions in format args
2022-09-10 20:13:46 +05:30
Kartavya Vashishtha
2584d48508
wip 2022-09-10 20:13:46 +05:30
Lukas Wirth
7d19971666 Add config to unconditionally prefer core imports over std
Fixes https://github.com/rust-lang/rust-analyzer/issues/12979
2022-09-09 20:04:56 +02:00
Stanislav
f7f4792f4f fixes 2022-09-09 20:58:06 +03:00
Ryo Yoshida
aeeb9e08b2
Add TyBuilder method to build Substitution for generator 2022-09-09 16:49:09 +09:00
Ryo Yoshida
ba64c93a44
Lower generator expression to HIR 2022-09-09 16:47:32 +09:00
Peh
bd3feea8bc fix: removed swap file 2022-09-08 22:44:10 +01:00
Peh
c7fefd5223 fix: add semicolon completion to mod 2022-09-08 22:37:31 +01:00
Stanislav
0240294759 fix comment round 2 2022-09-08 22:47:39 +03:00
Stanislav
1764c42518 fix comment 2022-09-08 22:36:36 +03:00
bors
4e1a3da8f2 Auto merge of #13158 - jonas-schievink:inlayhint-links, r=jonas-schievink
feat: make clicking a closing brace inlay hint go to the opening brace
2022-09-08 16:38:40 +00:00
Jonas Schievink
c4eadab016
Update crates/rust-analyzer/src/to_proto.rs
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-09-08 18:33:53 +02:00
Jonas Schievink
064c9ef9e2 Make clicking closing brace hint go to the opening brace 2022-09-08 17:25:28 +02:00
Stanislav
9f6553e1d6 add config for import filtering 2022-09-08 01:53:20 +03:00
Joseph Ryan
5d126a18b4 Use proc-macro-srv from sysroot in rust-project.json 2022-09-06 18:27:17 -07:00
Stanislav
eba54c2fc9 pretty solition works 2022-09-07 04:09:25 +03:00
Stanislav
92d54f9b30 typo and draft 2022-09-07 03:24:55 +03:00
Stanislav
bd0eeb3f04
Update crates/ide/src/references.rs
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-09-07 03:01:06 +03:00
bors
6dfd8aebdf Auto merge of #13192 - lowr:fix/dyn-sort-all-bounds, r=Veykril
fix: sort all bounds on trait object types

Fixes #13181

#12793 allowed different ordering of trait bounds in trait object types but failed to account for the ordering of projection bounds. I opted for sorting all the bounds at once rather than splitting them into `SmallVec`s so it's easier to do the same thing for other bounds when we have them.
2022-09-05 11:24:54 +00:00
bors
5be2e6574d Auto merge of #13185 - ChayimFriedman2:insert-ws-in-static-const-macro, r=Veykril
fix: Insert whitespaces into static & const bodies if they are expanded from macro on hover

Partially fixes #13143.

To resolve the other part we need to expand macros in unevaluated static & const bodies, and I'm not sure we want to. If for example it includes a call to `assert!()`, expanding it will lead to worse hover.
2022-09-05 11:10:40 +00:00
bors
4790916876 Auto merge of #13139 - Austaras:enum, r=Veykril
Suggest struct when completing enum

closes #13107
2022-09-05 10:59:38 +00:00
bors
a1c26530ec Auto merge of #13091 - ice1k:hey, r=Veykril
Remove type alias definition on inline

Fix #13079
2022-09-05 10:49:19 +00:00
Ryo Yoshida
265c75c53f
fix: sort all bounds on trait object types 2022-09-05 19:13:32 +09:00
austaras
748567cba5 complete full struct in enum varaint 2022-09-05 03:36:14 +08:00
Aleksey Kladov
d7ef3f51ec fix: correct broken logic for return complition
It seems that we've accidentally deleted the tests here couple of years
ago, and then fairly recently made a typo during refactor as well.

Reinstall tests, with coverage marks this time :-)
2022-09-04 18:12:55 +01:00
Stanislav
6001e7dfb1 fix 2022-09-04 19:45:50 +03:00
Stanislav
ba40aa72ac
Update crates/ide/src/references.rs
Co-authored-by: Laurențiu Nicola <lnicola@users.noreply.github.com>
2022-09-04 19:41:06 +03:00
Stanislav
29729abc3c Retain imports on find-all-references 2022-09-04 19:14:52 +03:00
Chayim Refael Friedman
26b5f1f92f Do not insert a newline after ; if the next token is a }
This creates double newline.
2022-09-04 14:33:15 +00:00
Chayim Refael Friedman
e295f0c29c Insert whitespaces into static & const bodies if they are expanded from macro on hover
Macro expansion erases whitespace information, and so we end with invalid Rust code.
2022-09-04 14:33:15 +00:00
Lukas Wirth
020f6895e5 Fix nested break expressions, expecting unknown types 2022-09-03 17:32:21 +02:00
ice1000
364d9c4910 Fmt 2022-09-02 21:18:36 +00:00
ice1000
68eabf1bf1 Fix test 2022-09-02 21:18:36 +00:00
ice1000
a695e900f6 Create trait Removable, replace ted APIs with builder APIs 2022-09-02 21:18:36 +00:00
ice1000
37e20decad Address comments 2022-09-02 21:18:36 +00:00
ice1000
277df02ff5 This should work, but I got mysterious errors 2022-09-02 21:18:36 +00:00
ice1000
79e5c366cd Extract shared logic 2022-09-02 21:18:36 +00:00
ice1000
fcc61337a8 Remove alias definition naively 2022-09-02 21:18:36 +00:00
Lukas Wirth
894aa0ed0d Clarify the state of (extern) preludes for block def maps 2022-09-02 17:43:20 +02:00
Lukas Wirth
8828049b23 Lift out the module scope into a field in the Resolver
A Resolver *always* has a module scope at the end of its scope stack,
instead of encoding this as an invariant we can just lift this scope
out into a field, allowing us to skip going through the scope vec
indirection entirely.
2022-09-02 17:02:12 +02:00
bors
2bb6635a85 Auto merge of #13173 - Veykril:synthetic, r=Veykril
Don't store SyntheticSyntax in the reverse maps in BodySourceMap

They are ZSTs which we can just create on missing access instead.
2022-09-02 13:17:16 +00:00
Lukas Wirth
fe0a106256 Don't store SyntheticSyntax in the reverse maps in BodySourceMap
They are ZSTs which we can just create on missing access instead.
2022-09-02 15:08:48 +02:00
bors
4f8153e4a5 Auto merge of #13167 - iDawer:exhaustive_patterns, r=Veykril
feat: Implement `feature(exhaustive_patterns)` from unstable Rust

Closes #12753

Recognize Rust's unstable `#![feature(exhaustive_patterns)]` (RFC 1872). Allow omitting visibly uninhabited variants from `match` expressions when the feature is on.

This adjusts match checking to the current implementation of the postponed RFC 1872 in rustc.
2022-09-02 12:32:36 +00:00
iDawer
ffd79c2887 Add docs 2022-09-02 17:01:51 +05:00
iDawer
8ae58b9fe4 Record enabled unstable features into DefMap 2022-09-02 16:31:15 +05:00
bors
93c52e41ec Auto merge of #13160 - ChayimFriedman2:parse-parenthesized-type-path-with-coloncolon, r=jonas-schievink
fix: Parse TypePathFn with preceding `::`

e.g. `impl Fn::() -> ()`.

Fixes #13157. This was the problem, not that the path was not at the end.

I could unify the parsing of `::` of TypePathFn with that of generic arg list, but some code relies on the `::` of generic arg list to be inside it.
2022-09-01 21:00:14 +00:00
bors
f23114c854 Auto merge of #13161 - ChayimFriedman2:pi-is-zero, r=jonas-schievink
fix: Lower float literals with underscores

Fixes #13155 (the problem was the `PI` is defined with `_f64` suffix). `PI` is still truncated, though, because `f64` cannot represent the value with full precision.
2022-09-01 20:51:22 +00:00
Lukas Wirth
8110119fef Properly handle break resolution inside non-breakable expressions 2022-09-01 14:54:47 +02:00
Lukas Wirth
1e66a5a8ce Diagnose incorrect continue expressions 2022-09-01 14:41:38 +02:00
Lukas Wirth
d6fc4a9ea6 Simplify breakables handling 2022-09-01 14:41:37 +02:00
Chayim Refael Friedman
2eec4ed69d Lower float literals with underscores 2022-09-01 00:11:32 +00:00
Chayim Refael Friedman
d786a40e73 Parse TypePathFn with preceding ::
e.g. `impl Fn::() -> ()`.
2022-08-31 23:19:09 +00:00
bors
643c3a54de Auto merge of #13134 - Veykril:proc-highlight, r=Veykril
Highlight namerefs by syntax until proc-macros have been loaded

Usually when loading up a project, once loading is done we start answering highlight requests while proc-macros haven't always been loaded yet, so we start out with showing a lot of unresolved name-refs. After this PR, we'll use syntax based highlighting for those unresolved namerefs until the proc-macros have been loaded.
2022-08-31 19:42:53 +00:00
iDawer
1fa9d5e07b Correct visibility check 2022-08-31 21:41:24 +05:00
Jonas Schievink
241807dbf9 Allow multi-part inlay hint labels with location links 2022-08-31 18:34:10 +02:00
bors
ab068f120b Auto merge of #13156 - Veykril:macro-stmts, r=Veykril
Remove hir::Expr::MacroStmts

This hir expression isn't needed and only existed as it was simpler to
deal with at first as it gave us a direct mapping for the ast version of
the same construct. This PR removes it, properly handling the statements
that are introduced by macro call expressions.
2022-08-31 16:09:17 +00:00
Lukas Wirth
ee02a4721b Remove unnecessary allocations 2022-08-31 18:05:52 +02:00
iDawer
1a580a3396 Implement unstable RFC 1872 exhaustive_patterns 2022-08-31 20:17:54 +05:00
Lukas Wirth
192a79c235 Remove hir::Expr::MacroStmts
This hir expression isn't needed and only existed as it was simpler to
deal with at first as it gave us a direct mapping for the ast version of
the same construct. This PR removes it, properly handling the statements
that are introduced by macro call expressions.
2022-08-31 16:58:11 +02:00
bors
7f38581372 Auto merge of #13120 - Austaras:master, r=jonas-schievink
turn `unwrap_or` into `unwrap_or_else` and vice versa

closes #12983
2022-08-31 13:55:29 +00:00
bors
79a578ae84 Auto merge of #13005 - pocket7878:convert-two-arm-bool-match-to-matches-macro, r=jonas-schievink
feature: Assist to turn match into matches! invocation

Resolves #12510

This PR adds an assist, which convert 2-arm match that evaluates to a boolean into the equivalent matches! invocation.
2022-08-31 13:47:40 +00:00
bors
cf05b7db4d Auto merge of #13051 - DropDemBits:attrs-and-comments-on-enum-variant, r=jonas-schievink
fix: Only move comments when extracting a struct from an enum variant

Motivating example:

```rs
#[derive(Debug, thiserror::Error)]
enum Error {
    /// Some explanation for this error
    #[error("message")]
    $0Woops {
        code: u32
    }
}
```
now becomes
```rs
/// Some explanation for this error
#[derive(Debug, thiserror::Error)]
struct Woops{
    code: u32
}

#[derive(Debug, thiserror::Error)]
enum Error {
    #[error("message")]
    Woops(Woops)
}
```
(the `thiserror::Error` derive being copied and the struct formatting aren't ideal, though those are issues for another day)
2022-08-31 13:34:43 +00:00
Pocket7878
7464b6dbc4 feature: Check if first_arm bool and second_arm bool is inverted or not. 2022-08-31 18:47:45 +09:00
Masato Sogame
5a1b45dcc1 feature: Simplfy branch check logics
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-08-31 18:47:45 +09:00
Pocket7878
a5d2463b1d fix: Simplify logics to allow two-arm enum match. 2022-08-31 18:47:45 +09:00
Pocket7878
4661a60aa9 Add convert_two_arm_bool_match_to_matches_macro ide-assists 2022-08-31 18:47:44 +09:00
austaras
43e8d9644f change title 2022-08-31 17:31:23 +08:00
bors
d9e22079c4 Auto merge of #12963 - DesmondWillowbrook:clippy-matches-sourcegen, r=Veykril
clippy: make generated code nice to read

Feel free to close if this is too minor.

(For context, I _have_ read the clippy policy in `dev/style.md`)
2022-08-31 08:37:14 +00:00
bors
56d888689b Auto merge of #12793 - lowr:fix/12739, r=Veykril
fix: sort and deduplicate auto traits in trait object types

Fixes #12739

Chalk solver doesn't sort and deduplicate auto traits in trait object types, so we need to handle them ourselves in the lowering phase, just like [`rustc`](880416180b/compiler/rustc_typeck/src/astconv/mod.rs (L1487-L1488)) and [`chalk-integration`](https://github.com/rust-lang/chalk/blob/master/chalk-integration/src/lowering.rs#L575) do.

Quoting from [the Chalk book](https://rust-lang.github.io/chalk/book/types/rust_types.html#dyn-types):

> Note that -- for this purpose -- ordering of bounds is significant. That means that if you create a `dyn Foo + Send` and a `dyn Send + Foo`, chalk would consider them distinct types. The assumption is that bounds are ordered in some canonical fashion somewhere else.

Also, trait object types with more than one non-auto traits were previously allowed, but are now disallowed with this patch.
2022-08-31 08:28:12 +00:00
bors
b6138965cd Auto merge of #13149 - lowr:fix/unescape-raw-ident-module-path, r=Veykril
fix: unescape all occurrences of module name in module resolution

Fixes #13141
2022-08-31 08:15:31 +00:00
bors
ef27641f56 Auto merge of #13154 - Veykril:ty-mac-expander, r=Veykril
Drop the expander borrow in all control flow paths

The change in https://github.com/rust-lang/rust-analyzer/pull/13123
actually re-uses the RefMut borrow instead of dropping it so we need to
drop it manually where required.

Fixes https://github.com/rust-lang/rust-analyzer/issues/13153
2022-08-31 08:07:26 +00:00
Lukas Wirth
5c0e25237c Drop the expander borrow in all control flow paths
The change in https://github.com/rust-lang/rust-analyzer/pull/13123
actually re-uses the RefMut borrow instead of dropping it so we need to
drop it manually where required.
2022-08-31 10:04:01 +02:00
bors
e0e18cc2a7 Auto merge of #13151 - ChayimFriedman2:replace-turbofish-other-type, r=Veykril
Use correct type in "Replace turbofish with type"

And support `?` and `.await` expressions.

Fixes #13148.

The assist can still show up even if the turbofish's type is not used at all, e.g.:
```rust
fn foo<T>() {}
let v = foo::<i32>();
```
2022-08-31 07:47:53 +00:00
Chayim Refael Friedman
bcdacfe501 Support ? and .await in "Replace turbofish with explicit type"
Now that we use type information this is easy.
2022-08-31 01:24:36 +00:00
Chayim Refael Friedman
e5e979906b Use type information to deduce the correct type for "Replace turbofish with explicit type", even when it is not exactly the same as the turbofish type
I implemented that by checking the expressions' type.
This could probably be implemented better by taking the function's return type and substituting the generic parameter with the provided turbofish, but this is more complicated.
2022-08-31 01:07:41 +00:00
Ryo Yoshida
662ab0cd8e
fix: unescape all occurrences of module name in module resolution 2022-08-31 03:51:37 +09:00
DropDemBits
45dac9a3ef Move comments to the extracted struct 2022-08-30 14:47:08 -04:00
Ryo Yoshida
484d5b6e70
fix: handle trait methods as inherent methods for placeholders 2022-08-31 01:12:14 +09:00
bors
989b09d20c Auto merge of #13145 - ChayimFriedman2:unmerge-match-arm, r=jonas-schievink
feat: Add a "Unmerge match arm" assist to split or-patterns inside match expressions

Fixes #13072.

The way I implemented it it leaves the `OrPat` in place even if there is only one pattern now but I don't think something will break because of that, and when more code will be typed we'll parse it again anyway. Removing it (but keeping the child pattern) is hard, I don't know how to do that.
2022-08-30 13:31:37 +00:00
Ryo Yoshida
7ecead23c8
fix: sort and deduplicate auto traits in trait object types 2022-08-30 20:52:42 +09:00
Ryo Yoshida
f9e2ac56e5
fix: handle trait methods as inherent methods for trait object types 2022-08-30 20:44:31 +09:00
Chayim Refael Friedman
5f132e666d feat: Add a "Unmerge match arm" assist to split or-patterns inside match expressions 2022-08-30 09:42:12 +00:00
Lukas Wirth
66ec636fec Highlight namerefs by syntax until proc-macros have been loaded 2022-08-29 18:44:55 +02:00
bors
f02cd0a41d Auto merge of #13056 - DropDemBits:make-refactors, r=Veykril
internal: Migrate to using format arg captures in `syntax::make`
2022-08-29 16:34:33 +00:00
austaras
42486b6e94 change as requested 2022-08-29 00:24:56 +08:00
austaras
f9c180ffd1 update tests 2022-08-29 00:24:56 +08:00
austaras
0dd9eef1b9 add type check 2022-08-29 00:24:56 +08:00
austaras
dbaf2ce76e turn unwrap_or into unwrap_or_else and vice versa 2022-08-29 00:24:56 +08:00
bors
e8e598f641 Auto merge of #13133 - Veykril:diag-hack, r=Veykril
Move empty diagnostics workaround back into the server

This only touches on the diagnostics in one place instead of multiple as was previously done, since all published diagnostics will go through this code path anyways.

Closes https://github.com/rust-lang/rust-analyzer/issues/13130
2022-08-28 09:56:06 +00:00
Lukas Wirth
9ad0a8c467 Move empty diagnostics workaround back into the server 2022-08-28 11:54:46 +02:00
Lukas Wirth
78a7a816bf minor: Simplify 2022-08-26 19:40:01 +02:00
bors
5c52e05498 Auto merge of #13110 - DesmondWillowbrook:issue-11197, r=jonas-schievink
fix: make "Extract type as type alias" assist work with const generics in array

fixes #11197
2022-08-26 13:35:13 +00:00
bors
ca8093e282 Auto merge of #13116 - Veykril:nohash, r=Veykril
Make use of NoHash hashing for FileId and CrateId

Both of these are mere integers so there is nothing to hash here.

Ideally we would use this for `la_arena::Idx` too, but that doesn't work due to the orphan rule, and `la_arena` is unfortunately a public library so we can't really do much here... Unless we remove the trait restriction but I'd like not to
2022-08-25 19:08:57 +00:00
Lukas Wirth
5b6aefe565 Update test fixtures 2022-08-25 21:07:24 +02:00
Lukas Wirth
0c9375b829 Remove u/i128 hashing overloads from NoHashHasher::Hasher impl 2022-08-25 20:45:35 +02:00
Lukas Wirth
d025c5d8d6 Make use of NoHash hashing for FileId and CrateId 2022-08-25 20:41:49 +02:00
Kartavya Vashishtha
0d7ba13b72
style: run tidy tests 2022-08-25 13:17:50 +05:30
Kartavya Vashishtha
9480b38189
extract const generic in ArrayType 2022-08-25 13:11:51 +05:30
Kartavya Vashishtha
71c15f2a44
add test 2022-08-25 13:11:14 +05:30
bors
e3dc5a588f Auto merge of #13101 - Veykril:sem-tokens, r=jonas-schievink
internal: Re-export standard semantic token types and mods

Should help in preventing future occurences of #13099 by having all token types and mods come through the same place
2022-08-23 16:24:39 +00:00
Lukas Wirth
715e3fc119 Re-export standard semantic token types and mods 2022-08-23 18:06:32 +02:00
bors
1456b80167 Auto merge of #13100 - jonas-schievink:doc-links-on-impl, r=jonas-schievink
fix: Resolve doc links on impl blocks

Fixes https://github.com/rust-lang/rust-analyzer/issues/13089
2022-08-23 15:57:12 +00:00
Jonas Schievink
322e7060de Resolve doc links on impl blocks 2022-08-23 17:50:45 +02:00
Jonas Schievink
5804412869 Register decorator token type to avoid panic 2022-08-23 17:46:29 +02:00
Jonas Schievink
8969655ed6 Allow leading | in more pattern positions 2022-08-23 16:31:59 +02:00
bors
f045f14626 Auto merge of #13084 - Veykril:highlight-config, r=Veykril
Add some more highlighting configurations

The following can be enabled/disabled now in terms of highlighting:
- doc comment injection (enabled by default)
- punctuation highlighting (disabled by default)
- operator highlighting (enabled by default)
- punctuation specialized highlighting (disabled by default)
- operator specialized highlighting (disabled by default)
- macro call bang highlighting (disabled by default)

This PR also changes our `attribute` semantic token type to the `decorator` type which landed upstream (but not yet in lsp-types).

Specialized highlighting is disabled by default, as all clients will have to ship something to map these back to the standard punctuation/operator token (we do this in VSCode via the inheritance mapping for example). This is a lot of maintenance work, and not something every client wants to do, pushing that need to use the user. As this is a rather niche use in the first place this will just be disabled by default.

Punctuation highlighting is disabled by default, punctuation is usually something that can be done by the native syntactic highlighting of the client, so there is no loss in quality. The main reason for this though is that punctuation adds a lot of extra token data that we sent over, a lot of clients struggle with applying this, so disabling this improves the UX for a lot of people. Note that we still highlight punctuations with special meaning as that special entity, (the never type `!` will still be tagged as a builtin type if it occurs as such)

Separate highlighting of the macro call bang `!` is disabled by default, as I think people actually didn't like that change that much, though at the same time I feel like not many people even noticed that change (I prefer it be separate, but that's not enough reason for it to be enabled by default I believe :^) )

cc https://github.com/rust-lang/rust-analyzer/issues/12783 https://github.com/rust-lang/rust-analyzer/issues/13066
2022-08-23 12:39:57 +00:00
bors
631ed2a518 Auto merge of #13092 - Veykril:ref-match-completion, r=Veykril
fix: Fix reference autocompletions using incorrect offsets in macro inputs

Fixes https://github.com/rust-lang/rust-analyzer/issues/13035
2022-08-23 12:30:50 +00:00
Lukas Wirth
6c5d15800e fix: Fix reference autocompletions using incorrect offsets in macro inputs
Fixes https://github.com/rust-lang/rust-analyzer/issues/13035
2022-08-23 14:29:59 +02:00
Lukas Wirth
2a26b054b7 Use lsp-types DECORATOR token type 2022-08-23 14:06:19 +02:00
Lukas Wirth
31fb917d8d Remove unused default semantic modifiers 2022-08-23 14:05:56 +02:00
Lukas Wirth
eadc2673c0 Regen docs 2022-08-23 14:05:56 +02:00
Lukas Wirth
f6f0516603 Add config for macro bang token highlighting, disable by default 2022-08-23 14:05:56 +02:00
Lukas Wirth
b26733f8a0 Change attribute semantic token type to decorator 2022-08-23 14:05:56 +02:00
Lukas Wirth
9700c95ced Make doc comment highlight injection configurable 2022-08-23 14:05:55 +02:00
Lukas Wirth
9a201873b8 Move highlight configuration from protocol into the feature 2022-08-23 14:05:55 +02:00
Lukas Wirth
afc8cfb4d1 Make operator highlighting configurable, disable it by default 2022-08-23 14:05:55 +02:00
Lukas Wirth
16315edaee Make punctuation highlighting configurable, disable it by default 2022-08-23 14:05:55 +02:00
bors
6627b473e2 Auto merge of #13090 - ice1k:master, r=Veykril
Do not substitute `Self` when in same impl block

Fix #13076
2022-08-23 08:08:45 +00:00
ice1000
148bdf85f2 Do not substitute Self when in same impl block 2022-08-23 01:52:47 -04:00
TJ DeVries
50ecb09da4 feat: emit SCIP via rust-analyzer 2022-08-22 15:13:46 -04:00
bors
6711ded5cd Auto merge of #13088 - Veykril:flycheck-failure, r=Veykril
Pop an error notification when flycheck can't be restarted
2022-08-22 15:43:13 +00:00
Lukas Wirth
2abb78d06d Pop an error notification when flycheck can't be restarted 2022-08-22 17:42:33 +02:00
bors
fdc28b4333 Auto merge of #13021 - N3xed:fix-gat-panics, r=flodiebold
fix: Fix panics on GATs involving const generics

This workaround avoids constant crashing of rust analyzer when using GATs with const generics,
even when the const generics are only on the `impl` block.

The workaround treats GATs as non-existing if either itself or the parent has const generics and
removes relevant panicking code-paths.

Fixes #11989, fixes #12193
2022-08-22 14:00:23 +00:00
Lukas Wirth
f9d1b26a96 Replace crossbeam with std's scoped threads 2022-08-22 14:55:13 +02:00
bors
dea163970a Auto merge of #12965 - DesmondWillowbrook:assoc-method-dimming, r=Veykril
feat: make trait assoc items become inactive due to cfg

fixes #12394
2022-08-22 07:20:56 +00:00
Dominik Gschwind
ac8cb8ce3b
Expect the test to panic by catching the unwind 2022-08-21 22:48:53 +02:00
Ryo Yoshida
dd22aa48ba
Consider bounds on inherent impl in method resolution 2022-08-21 18:41:46 +09:00
Kartavya Vashishtha
23c00ed50d
fix: formatting 2022-08-20 13:44:01 +05:30
Kartavya Vashishtha
8f87fcb179
remove push_diagnostic methods
weren't used in the end
2022-08-20 13:30:25 +05:30
Kartavya Vashishtha
87b779756c
make impl and trait inactive diagnostics work 2022-08-20 13:28:43 +05:30
Laurențiu Nicola
e5d3ac58b3 Bump notify 2022-08-19 21:37:05 +03:00
Laurențiu Nicola
c3bb7bfc28 Bump chalk 2022-08-19 21:33:28 +03:00
DropDemBits
7d777759bf Insert newline after extracted struct's attributes 2022-08-19 09:27:29 -04:00
DropDemBits
6669ea81c3 Leave attrs on the variant, not the extracted struct 2022-08-19 09:27:28 -04:00
Ralf Jung
c5455d1af3 explain how to re-generate the package.json 2022-08-19 08:58:08 -04:00
Ralf Jung
4af9829dcf document interaction of checkOnSave.overrideCommand and multiple linked projects 2022-08-19 08:57:22 -04:00
bors
2f02ea03b0 Auto merge of #13041 - DorianListens:dscheidt/gen-fn-self-assoc-2, r=Veykril
feat: Generate static method using Self::assoc() syntax

This change improves the `generate_function` assist to support generating static methods/associated functions using the `Self::assoc()` syntax. Previously, one could generate a static method, but only when specifying the type name directly (like `Foo::assoc()`). After this change, `Self` is supported as well as the type name.

Fixes #13012
2022-08-19 10:57:02 +00:00
bors
62c3107065 Auto merge of #13061 - ice1k:master, r=Veykril
feat: Improved inline_call to replace `Self`

Fixes #13060
2022-08-19 10:47:15 +00:00
bors
a2ad3d0669 Auto merge of #13064 - Veykril:rustfmt-err, r=Veykril
Log rustfmt parsing errors as warnings

We unconditionally pass an edition parameter to rustfmt, for some crates
this might fail rustfmt so instead of swallowing the error, at least Log
it on a level that is logged by default so users won't be completely
confused about it.
See for context https://github.com/rust-lang/rust-analyzer/issues/10209

Closes https://github.com/rust-lang/rust-analyzer/issues/10209
2022-08-19 07:23:01 +00:00
Lukas Wirth
638755a771 Log rustfmt parsing errors as warnings
We unconditionally pass an edition parameter to rustfmt, for some crates
this might fail rustfmt so instead of swallowing the error, at least Log
it on a level that is logged by default so users won't be completely
confused about it.
See for context https://github.com/rust-lang/rust-analyzer/issues/10209

Closes https://github.com/rust-lang/rust-analyzer/issues/10209
2022-08-19 09:22:34 +02:00
Lukas Wirth
45b7b6a60a Implement lsp extension for cancelling running flychecks 2022-08-19 08:54:53 +02:00
ice1000
5a6c51ebb8 fix: use functional programming 2022-08-19 01:22:43 +00:00
ice1000
b6fe46055b feat: Improved inline_call to replace Self 2022-08-19 01:06:00 +00:00
Dorian Scheidt
48ea3825b8 Introduce and use get_fn_target_info 2022-08-18 18:39:42 -05:00
Dorian Scheidt
d8e7419c64 Generate and use TargetInfo::new 2022-08-18 18:32:35 -05:00
Dorian Scheidt
2e4a4f1a9c Cleanup inline 2022-08-18 18:28:43 -05:00
Dorian Scheidt
96c04c5e1c inline assoc_fn_target 2022-08-18 18:28:14 -05:00
Dorian Scheidt
2086c48cff Remove mut out params via assoc_fn_target_info 2022-08-18 18:26:54 -05:00
Dorian Scheidt
e27af5fae3 Reorder args with flip_comma 2022-08-18 18:21:58 -05:00
Dorian Scheidt
e513d7b504 Replace tuple with TargetInfo struct 2022-08-18 18:20:06 -05:00
Dorian Scheidt
30eabeb95d extract fn_target_info 2022-08-18 18:14:51 -05:00
Dorian Scheidt
6130860789 use fn_name instead of name_ref.text() 2022-08-18 18:12:53 -05:00
Dorian Scheidt
d39677c1eb Rename static_method_target -> assoc_fn_target 2022-08-18 18:10:37 -05:00
DropDemBits
581a01d0cc Migrate syntax::make to use format arg captures 2022-08-18 13:42:10 -04:00
bors
0a33d04a3d Auto merge of #13053 - lowr:fix/pat-sole-Self, r=Veykril
fix: resolve path `Self` alone in value namespace

Fixes #12968
2022-08-18 11:17:40 +00:00
Ryo Yoshida
dac27679f7
fix: resolve path Self alone in value namespace 2022-08-18 20:12:59 +09:00
bors
5543dd88c9 Auto merge of #13036 - sancho20021:10881-inline_type_alias_uses, r=Veykril
feat: Add an assist for inlining all type alias uses

## Description
`inline_type_alias_uses` assist tries to inline all selected type alias occurrences.

### Currently
Type alias used in `PathType` position are inlined.

### Not supported
- Removing type alias declaration if all uses are inlined.
- Removing redundant imports after inlining all uses in the file.
- Type alias not in `PathType` position, such as:
  - `A::new()`
  - `let x = A {}`
  - `let bits = A::BITS`
  - etc.

## Demonstration

![example](https://user-images.githubusercontent.com/45790125/184905226-9cb8ac81-1439-4387-a13b-e18ad4ecf208.gif)

## Related Issues
Partially fixes #10881
2022-08-18 08:02:37 +00:00
bors
1d36aba57a Auto merge of #13045 - DorianListens:dscheidt/run-test-mod-outside, r=Veykril
feat: Run test mod from anywhere in parent file

The "Run" feature of rust-analyzer is super useful, especially for running
individual tests or test-modules during development.

One common pattern in rust development is to develop tests in the same file as
production code, inside a module (usually called `test` or `tests`) marked with
`#[cfg(test)]`.  Unforunately, this pattern is not well supported by r-a today,
as a test module won't show up as a runnable unless the cursor is inside it.

In my experience, it is quite common to want to run the tests associated with
some production code immediately after editing it, not only after editing the
tests themselves. As such it would be better if test modules were available
from the "Run" menu even when the cursor is outside the test module.

This change updates the filtration logic for runnables in
`handlers::handle_runnables` to special case `RunnableKind::TestMod`, making
test modules available regardless of the cursor location. Other `RunnableKind`s
are unnaffected.

Fixes #9589
2022-08-18 07:54:10 +00:00
bors
1da9156b0d Auto merge of #12982 - jridgewell:into_future, r=Veykril
Implement IntoFuture type inference

One of my projects is using [IntoFuture](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) to make our async code a little less verbose. However, rust-analyzer can't infer the output type of an await expression if the value uses `IntoFuture` to convert into another type. So we're getting `{unknown}` types everywhere since switching.

`foo.await` itself [desugars](e4417cf020/compiler/rustc_ast_lowering/src/expr.rs (L644-L658)) into a `match into_future(foo) {}`, with every `Future` impl getting a [default](e4417cf020/library/core/src/future/into_future.rs (L131-L139)) `IntoFuture` implementation. I'm not sure if we want to disable the old `future_trait` paths, since this only recently [stabilize](https://github.com/rust-lang/rust/pull/98718).
2022-08-18 07:37:47 +00:00
bors
ae57b697e2 Auto merge of #13049 - lowr:fix/bare-dyn-assoc-type, r=Veykril
fix: resolve associated types of bare dyn types

Fixes #13031

We've been dropping the associated type bindings of trait object types that were written without the `dyn` keyword. This patch reuses the lowering logic for `TypeRef::DynTrait` so the associated type bindings are properly lowered.
2022-08-18 07:29:16 +00:00
Ryo Yoshida
12abaf8ddd
fix: resolve associated types of bare dyn types 2022-08-18 07:05:41 +09:00
Dorian Scheidt
85b9568e2d feat: Run test mod from anywhere in parent file
The "Run" feature of rust-analyzer is super useful, especially for running
individual tests or test-modules during development.

One common pattern in rust development is to develop tests in the same file as
production code, inside a module (usually called `test` or `tests`) marked with
`#[cfg(test)]`.  Unforunately, this pattern is not well supported by r-a today,
as a test module won't show up as a runnable unless the cursor is inside it.

In my experience, it is quite common to want to run the tests associated with
some production code immediately after editing it, not only after editing the
tests themselves. As such it would be better if test modules were available
from the "Run" menu even when the cursor is outside the test module.

This change updates the filtration logic for runnables in
`handlers::handle_runnables` to special case `RunnableKind::TestMod`, making
test modules available regardless of the cursor location. Other `RunnableKind`s
are unnaffected.

Fixes #9589
2022-08-17 12:26:07 -05:00
bors
82ff740501 Auto merge of #13044 - dzvon:fix-typo, r=Veykril
fix: a bunch of typos

This PR will fix some typos detected by [typos].

There are also some other typos in the function names, variable names, and file
names, which I leave as they are. I'm more certain that typos in comments
should be fixed.

[typos]: https://github.com/crate-ci/typos
2022-08-17 14:59:02 +00:00
Dezhi Wu
23747419ca fix: a bunch of typos
This PR will fix some typos detected by [typos].

There are also some other typos in the function names, variable names, and file
names, which I leave as they are. I'm more certain that typos in comments
should be fixed.

[typos]: https://github.com/crate-ci/typos
2022-08-17 21:44:58 +08:00
bors
d6412b5866 Auto merge of #13034 - lowr:fix/regression-from-12993, r=lowr
fix: escape keywords used as names in earlier editions

Fixes #13030

There are keywords in Rust 2018+ that you can use as names without escaping when your crate is in Rust 2015 e.g. "try". We need to be consistent on how to keep track of the names regardless of how they are actually written in each crate. This patch attempts at it by taking such names into account and storing them uniformly in their escaped form.
2022-08-17 09:55:14 +00:00
Aleksandr Pak
313b004ef7
fixup! feat: add inline_type_alias_uses assist 2022-08-17 12:50:33 +03:00
Ryo Yoshida
a3409c3a83
fix: escape keywords used as names in earlier editions 2022-08-17 18:46:17 +09:00
bors
dd9ead591e Auto merge of #13043 - Veykril:ide-db-trace, r=Veykril
minor: Change tracing event level in apply_change

This is a rather spammy one, it shouldn't be `info`
2022-08-17 07:34:07 +00:00
Lukas Wirth
557c5b4dc5 minor: Change tracing event level in apply_change 2022-08-17 09:32:25 +02:00
Justin Ridgewell
cebf95718c Find IntoFuture::IntoFuture's poll method 2022-08-16 17:53:10 -04:00
Dorian Scheidt
39d17efde7 feat: Generate static method using Self::assoc() syntax
This change improves the `generate_function` assist to support generating static methods/associated functions using the `Self::assoc()` syntax. Previously, one could generate a static method, but only when specifying the type name directly (like `Foo::assoc()`). After this change, `Self` is supported as well as the type name.

Fixes #13012
2022-08-16 15:37:24 -05:00
Lukas Wirth
1f73cbe839 Revert #12947, trigger workspace switches on all structure changes again 2022-08-16 19:13:10 +02:00
Jonas Schievink
7fb7c248c7 Add .enable suffix 2022-08-16 18:12:15 +02:00
Dominik Gschwind
ad7a1ed8cc
fix: Fix panics on GATs involving const generics
This workaround avoids constant crashing of rust analyzer when using GATs with const generics,
even when the const generics are only on the `impl` block.

The workaround treats GATs as non-existing if either itself or the parent has const generics and
removes relevant panicking code-paths.
2022-08-16 17:30:17 +02:00
Aleksandr Pak
6d6356b103
fixup! feat: add inline_type_alias_uses assist 2022-08-16 18:29:22 +03:00
Jonas Schievink
0616cee92b Add a setting for keyword hover popups 2022-08-16 16:51:40 +02:00
Aleksandr Pak
14db080933
feat: add inline_type_alias_uses assist 2022-08-16 17:24:56 +03:00
bors
b6fae56e38 Auto merge of #13028 - yue4u:fix/literal-lookup, r=jonas-schievink
fix: record completion filtering

close #12975
2022-08-16 13:28:00 +00:00
yue4u
91358bd937 fix: format literal lookup 2022-08-16 01:24:21 +09:00
bors
3903243192 Auto merge of #13027 - jonas-schievink:fix-mismatch-with-trailing-empty-macro, r=jonas-schievink
fix: Fix incorrect type mismatch with `cfg_if!` and other macros in expression position

Fixes https://github.com/rust-lang/rust-analyzer/issues/12940

This is a bit of a hack, ideally `MacroStmts` would not exist at all after HIR lowering, but that requires changing how the lowering code works.
2022-08-15 16:06:59 +00:00
Jonas Schievink
8c60813096 Fix lowering of empty macro expressions in trailing position 2022-08-15 18:01:58 +02:00
bors
3561433ef2 Auto merge of #13026 - Veykril:nameres, r=Veykril
internal: Make `resolve_name_in_module` a bit more lazy
2022-08-15 14:49:12 +00:00
Lukas Wirth
88b19cc39b Make resolve_name_in_module a bit more lazy 2022-08-15 16:41:51 +02:00
bors
6d6201299c Auto merge of #13025 - Veykril:simplify2, r=Veykril
Simplify
2022-08-15 14:40:26 +00:00
Lukas Wirth
3f149a63d2 Simplify 2022-08-15 16:40:10 +02:00
Jonas Schievink
dcbe892d7c Add an HIR pretty-printer 2022-08-15 13:51:45 +02:00
bors
bbe5637bbf Auto merge of #13016 - Veykril:vscode-diag-workaround, r=Veykril
Move VSCode diagnostics workaroudn into client code
2022-08-13 18:35:09 +00:00
Lukas Wirth
ec8256dd80 Move VSCode diagnostics workaroudn into client code 2022-08-13 20:30:30 +02:00
bors
306687b640 Auto merge of #13014 - Veykril:simplify, r=Veykril
minor: Simplify `GlobalState::handle_event`
2022-08-13 18:03:56 +00:00
Lukas Wirth
038c36a1f5 Simplify GlobalState::handle_event 2022-08-13 20:03:06 +02:00
Lukas Wirth
72ae308c73 Do not unconditionally succeed RUSTC_WRAPPER checks when run by build scripts
rust-analyzer's RUSTC_WRAPPER unconditionally succeeds `cargo check`
invocations tripping up build scripts using `cargo check` to probe for
successful compilations. To prevent this from happening the RUSTC_WRAPPER
now checks if it's run from a build script by looking for the
`CARGO_CFG_TARGET_ARCH` env var that cargo sets only when running build
scripts.
2022-08-13 12:13:48 +02:00
bors
cee1e157d7 Auto merge of #12993 - lowr:patch/swap-name-and-escaped-name, r=Veykril
Make `Name` hold escaped name

Resolves #12787
Resolves rust-lang/rust#99361

This PR effectively swaps `Name` and `EscapedName` in hir. In other words, it makes `Name` hold and print escaped raw identifiers and introduces another struct `UnescapedName` for cases where you need to print names without "r#" prefix.

My rationale is that it makes it easier for us to format an escaped name into string, which is what we want when we serialize names in general. This is because we format a name into string usually when we are presenting it to the users and arguably they expect its escaped form as that's what they see and write in the source code.

I split the change for `Name` into 3 commits to make it easier to follow but it also made some tests fail in the intermediate commits. I can squash them into a commit after the review if desired. I've also made similar changes for `ModPath` and `EscapedModPath` as it makes them consistent with `Name`.

For reference, there was a brief discussion on this in [a zulip thread](https://rust-lang.zulipchat.com/#narrow/stream/185405-t-compiler.2Frust-analyzer/topic/escaping.20.60Name.60s).
2022-08-12 14:53:45 +00:00
bors
696bee3246 Auto merge of #12997 - Veykril:no-such-field, r=Veykril
fix: Fix panic in `no_such_field` when using tuple fields on record structs
2022-08-11 08:42:04 +00:00
Lukas Wirth
1bb58205f0 Fix panic in no_such_field when using tuple fields on record structs 2022-08-11 10:41:30 +02:00
Ryo Yoshida
ba6db3e9b0
Add test for runnables with raw identifiers 2022-08-11 03:41:23 +09:00
Ryo Yoshida
018266a7ff
Make ModPath display escaped path 2022-08-11 03:41:10 +09:00
Ryo Yoshida
8fe73a2240
Make tests pass 2022-08-11 01:16:35 +09:00
Ryo Yoshida
4322cf7f5b
Remove EscapedName 2022-08-11 01:11:18 +09:00
Ryo Yoshida
53ec791dc6
Add UnescapedName and make Name hold escaped name 2022-08-11 01:03:08 +09:00
bors
3eb340fa4d Auto merge of #12989 - lnicola:rm-1-64-abi, r=Veykril
internal: Remove incomplete 1.64 ABI

This no longer works for current nightlies and should not be needed any more, since we can use the toolchain's proc macro server instead.
2022-08-10 14:53:21 +00:00
bors
b1e9bcddc2 Auto merge of #12984 - Veykril:keep-going, r=Veykril
Use `--keep-going` cargo flag when building build scripts

See https://github.com/rust-lang/rust-analyzer/issues/12973#issuecomment-1209159426
2022-08-10 14:43:23 +00:00
bors
e70681f208 Auto merge of #12992 - lowr:fix/type-inference-for-byte-string-pat, r=Veykril
fix: infer byte string pattern as `&[u8]` when matched against slices

Fixes #12630

c.f. [rustc_typeck](1603a70f82/compiler/rustc_typeck/src/check/pat.rs (L388-L404))
2022-08-10 11:05:02 +00:00
Ryo Yoshida
ffc6b42901
fix: infer byte string pattern as &[u8] when matched against slices 2022-08-10 19:17:13 +09:00
Edwin Cheng
c47914c6cf Fixes tests 2022-08-10 16:29:23 +08:00
Edwin Cheng
23e17cd581 Improve insert whitespace in mbe 2022-08-10 16:28:56 +08:00
Lukas Wirth
25d4fbe9da Re-try build script building with --keep-going 2022-08-10 10:23:46 +02:00
Laurențiu Nicola
f4f70c0e0d Remove incomplete 1.64 ABI 2022-08-10 10:49:49 +03:00
Justin Ridgewell
dc3219bb11 Suggest .await when type impls IntoFuture 2022-08-09 16:39:14 -04:00
Lukas Wirth
49d24f639f Recover from missing ellipsis in record literals for path expressions 2022-08-09 18:23:25 +02:00
Lukas Wirth
b3ac58dfb8 Add some more cov_marks 2022-08-09 18:08:05 +02:00
Lukas Wirth
8c9359b072 Fix pattern field completions not working for unions 2022-08-09 17:53:16 +02:00
Lukas Wirth
950de7c3c3 Use --keep-going cargo flag when building build scripts 2022-08-09 14:31:17 +02:00
Justin Ridgewell
5810c8188a Implement IntoFuture type inference 2022-08-08 21:05:56 -04:00
KaDiWa
232176b46a
remove imports that are also in edition 2021's prelude 2022-08-09 01:16:32 +02:00
bors
554f7f889e Auto merge of #12974 - fprasx:master, r=lnicola
Corrected order of printing op and `=`

Fixes https://github.com/rust-lang/rust-analyzer/issues/12971 where `Display` impl for assignment operators does `=+` instead of `+=`
2022-08-08 15:13:20 +00:00
fprasx
e39918f553 Corrected order of printing op and = 2022-08-08 11:05:18 -04:00
bors
79c22d5fb1 Auto merge of #12962 - lowr:patch/parse-last-range-pattern, r=Veykril
Parse range patterns in struct and slice without trailing comma

Resolves #12935

This patch includes the support for range patterns in slices, which is unstable (tracked in https://github.com/rust-lang/rust/issues/67264). If it's not desired I can remove it.
2022-08-08 15:03:39 +00:00
Ryo Yoshida
b14062aaec
Parse range patterns in let statement with type annotation 2022-08-09 00:00:22 +09:00
bors
20d64412c0 Auto merge of #12951 - jonas-schievink:doc-cli-stability, r=Veykril
internal: Document CLI flag stability
2022-08-08 11:56:44 +00:00
bors
3805067bf5 Auto merge of #12905 - HKalbasi:master, r=Veykril
Generate rust type from json

fix #10118

Should this be a diagnostic? I made it a diagnostic because of issue label.
2022-08-08 11:46:22 +00:00
bors
b481b59be5 Auto merge of #12937 - fprasx:master, r=Veykril
Add fixups for incomplete in proc-macros

Partially implements https://github.com/rust-lang/rust-analyzer/issues/12777.

Added support for for loops and match statements.

I couldn't do paths like `crate::foo::` as I wasn't able to add `SyntheticTokens` to the end of `foo::`, they always ended up after `crate::`

This is my first contribution so please don't be shy about letting me know if I've done anything wrong!
2022-08-08 11:37:51 +00:00
bors
b569bbbacc Auto merge of #12942 - lowr:fix/concat-with-char, r=Veykril
fix: make `concat!` work with char

Fixes #12921

- I avoided making `unquote_str()` take char literals as well because it's depended on by another function `parse_string()` that's only supposed to take strings.
- Even with this patch, we don't output `\0` as `\u{0}` which #12921 pointed out ~~, but we're not actually responsible for serializing it but rowan is~~. They are functionally equivalent and I don't think it'd cause any confusion, but we *could* try escaping them before serialization (for reference, `rustc -Zunpretty=expanded`, which `cargo expand` uses under the hood, [makes use of `str::escape_default()`](3830ecaa8d/compiler/rustc_ast/src/util/literal.rs (L161)).
2022-08-08 11:28:42 +00:00
Kartavya Vashishtha
c1eae3d028
make diagnostic function public 2022-08-08 16:45:27 +05:30
Kartavya Vashishtha
196f389a70
try adding diagnostrics for AssocItems 2022-08-08 16:40:29 +05:30
Kartavya Vashishtha
1883d1f141
activate assoc item test 2022-08-07 20:39:11 +05:30
Kartavya Vashishtha
bcab4be938
regenerate files with new syntax 2022-08-07 17:38:20 +05:30
Kartavya Vashishtha
a3fc4dbb04
more matches! sites 2022-08-07 17:37:50 +05:30