]> git.lizzy.rs Git - rust.git/log
rust.git
3 years agoMerge #6350
bors[bot] [Mon, 26 Oct 2020 13:20:57 +0000 (13:20 +0000)]
Merge #6350

6350: Make IncorrectDiagnostic match rustc by copying rustc's code. r=popzxc a=ArifRoktim

This closes #6343 and closes #6345.

The old algorithm which used a `DetectedCase` enum, didn't match how rustc thinks of cases. Some inputs can be interpreted as more than 1 case depending on the situation. For example, to rustc:
- `ABCD`: Can be both camel case and upper snake case
- `X86_64`: Can be both camel case and upper snake case

I could've made `detect_case` return a collection of `DetectedCase` and then modified the other code as such, but I think using the same code rustc uses is simpler and a surefire way to achieve the same diagnostics as rustc.

Co-authored-by: Arif Roktim <arifrroktim@gmail.com>
3 years agoMerge #6360
bors[bot] [Mon, 26 Oct 2020 13:07:25 +0000 (13:07 +0000)]
Merge #6360

6360: Fix unary minus highlighting r=matklad a=Veykril

Fixes #6358

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
3 years agoMerge #6361
bors[bot] [Mon, 26 Oct 2020 10:28:48 +0000 (10:28 +0000)]
Merge #6361

6361: Textmate grammar: angle bracket fix (closes #6323) r=dustypomerleau a=dustypomerleau

Fixes #6323

After tinkering, it became clear that `<` and `>` should really default to the punctuation interpretation in the vast majority of cases. In addition, the breakage is greater when an angle bracket is missed. So, rather than optimizing for a type parameter `meta` scope and considering every possible parent scope and child scope, the easier fix was to narrow the case where `<` and `>` are treated as comparison operators.

Co-authored-by: Dusty Pomerleau <dustypomerleau@users.noreply.github.com>
3 years agofix: narrow the case where angle brackets are seen as comparison operators
Dusty Pomerleau [Mon, 26 Oct 2020 09:16:26 +0000 (20:16 +1100)]
fix: narrow the case where angle brackets are seen as comparison operators

3 years agoFix unary minus highlighting
Lukas Wirth [Sun, 25 Oct 2020 22:05:30 +0000 (23:05 +0100)]
Fix unary minus highlighting

3 years agoMerge #6357
bors[bot] [Sun, 25 Oct 2020 14:50:48 +0000 (14:50 +0000)]
Merge #6357

6357: Don't keep parens around with remove-dbg r=SomeoneToIgnore a=Veykril

Fixes #6355

~~This causes remove-dbg to not keep parentheses when it comes to ranges though due to ranges not having `DOT2` and `DOT2EQ` tokens but having two `DOT` tokens inside of macro invocations.~~

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
3 years agoKeep parens around in remove-dbg for range expressions
Lukas Wirth [Sun, 25 Oct 2020 14:36:02 +0000 (15:36 +0100)]
Keep parens around in remove-dbg for range expressions

3 years agoDon't keep parens around in remove-dbg
Lukas Wirth [Sun, 25 Oct 2020 14:12:21 +0000 (15:12 +0100)]
Don't keep parens around in remove-dbg

3 years agoDon't keep parens around with remove-dbg when encountering method chaining
Lukas Wirth [Sun, 25 Oct 2020 13:27:32 +0000 (14:27 +0100)]
Don't keep parens around with remove-dbg when encountering method chaining

3 years agoMerge #6354
bors[bot] [Sun, 25 Oct 2020 12:54:18 +0000 (12:54 +0000)]
Merge #6354

6354: Add tracing to main rust-analyzer binary r=flodiebold a=flodiebold

This makes `CHALK_DEBUG` logging work again e.g. when running `analysis-stats`, which is very helpful for debugging.

This change shouldn't regress compile times at all. The reason for that is that chalk-solve already pulls in these crates, and while that's behind a feature (mostly for our benefit, I think) we never actually disabled that feature :sweat_smile: So alternatively, we could disable the feature and maybe get an improvement in compile times. In my test I just did to see the impact of that, this PR actually compiled faster than the one just removing tracing though, so it's probably not a big deal.

Co-authored-by: Florian Diebold <florian.diebold@freiheit.com>
3 years agoAdd tracing to main rust-analyzer binary
Florian Diebold [Fri, 23 Oct 2020 15:07:06 +0000 (17:07 +0200)]
Add tracing to main rust-analyzer binary

3 years agoMerge #6353
bors[bot] [Sun, 25 Oct 2020 11:45:00 +0000 (11:45 +0000)]
Merge #6353

6353: Get rid of FAKE_PLACEHOLDER r=flodiebold a=flodiebold

The lifetime placeholder can be replaced by the static lifetime, and for array
sizes we should just be using a concrete const.

Co-authored-by: Florian Diebold <florian.diebold@freiheit.com>
3 years agoGet rid of FAKE_PLACEHOLDER
Florian Diebold [Fri, 23 Oct 2020 13:45:15 +0000 (15:45 +0200)]
Get rid of FAKE_PLACEHOLDER

The lifetime placeholder can be replaced by the static lifetime, and for array
sizes we should just be using a concrete const.

3 years agoMake IncorrectDiagnostic match rustc by copying rustc's code.
Arif Roktim [Sat, 24 Oct 2020 22:40:33 +0000 (18:40 -0400)]
Make IncorrectDiagnostic match rustc by copying rustc's code.

3 years agoMerge #6331 #6342
bors[bot] [Sat, 24 Oct 2020 19:08:12 +0000 (19:08 +0000)]
Merge #6331 #6342

6331: correct hover text for items with doc attribute with raw strings r=matklad a=JoshMcguigan

Fixes #6300 by improving the handling of raw string literals in attribute style doc comments.

This still has a bug where it could consume too many `"` at the start or end of the comment text, just as the original code had. Not sure if we want to fix that as part of this PR or not? If so, I think I'd prefer to add a unit test for either the `as_simple_key_value` function (I'm not exactly sure where this would belong / how to set this up) or create a `fn(&SmolStr) -> &SmolStr` to unit test by factoring out the `trim` operations from `as_simple_key_value`. Thoughts on this?

6342: Shorter dependency chain r=matklad a=popzxc

Continuing implementing suggestions from the `Completion refactoring` zulip thread.

This PR does the following:

- Removes dependency of `completions` on `assists` by moving required functionality into `ide_db`.
- Moves completely `call_info` crate into `ide_db` as it looks like it fits perfect there.
- Adds a bunch of new tests and docs.
- Adds the re-export of `base_db` to the `ide_db` and removes direct dependency on `base_db` from other crates.

The last point is controversial, I guess, but I noticed that in places where `ide_db` is used, `base_db` is also *always* used. Thus I think the dependency on the `base_db` is implied by the fact of `ide_db` interfaces, and thus it makes sense to just provide `base_db` out of the box.

Co-authored-by: Josh Mcguigan <joshmcg88@gmail.com>
Co-authored-by: Igor Aleksanov <popzxc@yandex.ru>
3 years agoMerge #6344
bors[bot] [Sat, 24 Oct 2020 18:58:02 +0000 (18:58 +0000)]
Merge #6344

6344: Bump deps r=matklad a=lnicola

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
3 years agoMerge #6337
bors[bot] [Sat, 24 Oct 2020 16:26:08 +0000 (16:26 +0000)]
Merge #6337

6337: Fix indentation of inserted use statements r=flodiebold a=flodiebold

Co-authored-by: Florian Diebold <florian.diebold@freiheit.com>
3 years agoFix indentation of inserted use statements
Florian Diebold [Fri, 23 Oct 2020 15:18:41 +0000 (17:18 +0200)]
Fix indentation of inserted use statements

3 years agoBump chalk
Laurențiu Nicola [Sat, 24 Oct 2020 14:14:05 +0000 (17:14 +0300)]
Bump chalk

3 years agoBump rustc_lexer
Laurențiu Nicola [Sat, 24 Oct 2020 14:11:58 +0000 (17:11 +0300)]
Bump rustc_lexer

3 years agoBump deps
Laurențiu Nicola [Sat, 24 Oct 2020 14:10:27 +0000 (17:10 +0300)]
Bump deps

3 years agoRe-export base_db from ide_db
Igor Aleksanov [Sat, 24 Oct 2020 08:39:57 +0000 (11:39 +0300)]
Re-export base_db from ide_db

3 years agoAdd tests for traits functions in ide_db
Igor Aleksanov [Sat, 24 Oct 2020 08:29:16 +0000 (11:29 +0300)]
Add tests for traits functions in ide_db

3 years agoMake call_info a part of ide_db
Igor Aleksanov [Sat, 24 Oct 2020 08:07:10 +0000 (11:07 +0300)]
Make call_info a part of ide_db

3 years agoRemove dependency on 'assists' from 'completion' crate
Igor Aleksanov [Sat, 24 Oct 2020 07:47:23 +0000 (10:47 +0300)]
Remove dependency on 'assists' from 'completion' crate

3 years agoMerge #6330
bors[bot] [Sat, 24 Oct 2020 03:31:17 +0000 (03:31 +0000)]
Merge #6330

6330: Textmate grammar: raw IDs, underscore fixes (closes #6293, #6340) r=dustypomerleau a=dustypomerleau

Fixes https://github.com/rust-analyzer/rust-analyzer/issues/6293.

I've included the possibility of the `r#` prefix in:

- function definitions
- function/method calls
- variables/parameters

This way the raw ID will simply get whatever the intended scope was, instead of a unique scope that might be inappropriately themed for its purpose.

Will wait a bit for feedback, in case there are other places you might use raw IDs.

Co-authored-by: Dusty Pomerleau <dustypomerleau@users.noreply.github.com>
3 years agocorrect hover for items with doc attribute with raw strings
Josh Mcguigan [Fri, 23 Oct 2020 03:43:07 +0000 (20:43 -0700)]
correct hover for items with doc attribute with raw strings

3 years agofix: underscores, raw IDs
Dusty Pomerleau [Sat, 24 Oct 2020 02:00:26 +0000 (13:00 +1100)]
fix: underscores, raw IDs

- remove comment scope from ignored params
- underscores will automatically receive variable/param scope
- add raw ID syntax to modules, functions, and variables

3 years agoMerge #6251 #6310
bors[bot] [Fri, 23 Oct 2020 22:12:15 +0000 (22:12 +0000)]
Merge #6251 #6310

6251: Semantic Highlight: Add Callable modifier for variables r=matklad a=GrayJack

This PR added the `HighlightModifier::Callable` variant and assigned it to variables and parameters that are fn pointers, closures and implements FnOnce trait.

This allows to colorize these variables/parameters when used in call expression.

6310: Rewrite algo::diff to support insertion and deletion r=matklad a=Veykril

This in turn also makes `algo::diff` generate finer diffs(maybe even minimal diffs?) as insertions and deletions aren't always represented as as replacements of parent nodes now.

Required for #6287 to go on.

Co-authored-by: GrayJack <gr41.j4ck@gmail.com>
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
3 years agoMerge #6339
bors[bot] [Fri, 23 Oct 2020 22:05:25 +0000 (22:05 +0000)]
Merge #6339

6339: Diagnose #[cfg]s in bodies r=matklad a=jonas-schievink

This PR threads diagnostics through body lowering using the `BodySourceMap`, and emits `InactiveCode` diagnostics for expressions, statements, and match arms that are `#[cfg]`d out.

Co-authored-by: Jonas Schievink <jonas.schievink@ferrous-systems.com>
3 years agoMerge #6336
bors[bot] [Fri, 23 Oct 2020 21:54:45 +0000 (21:54 +0000)]
Merge #6336

6336: Improve Chalk debugging r=matklad a=flodiebold

 - add panic context for the trait goal if CHALK_DEBUG is set
 - print the Chalk program even if we're panicking
 - log goal/solution while TLS is still set

Co-authored-by: Florian Diebold <florian.diebold@freiheit.com>
3 years agoMerge #6341
bors[bot] [Fri, 23 Oct 2020 21:42:53 +0000 (21:42 +0000)]
Merge #6341

6341: Complete variants when only enun name is typed r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
3 years agoComplete variants when only enun name is typed
Aleksey Kladov [Fri, 23 Oct 2020 21:41:47 +0000 (23:41 +0200)]
Complete variants when only enun name is typed

This allows the client to filter `Foo::Bar` when *either* `Foo` or
`Bar` is typed.

3 years agoFix name of InactiveCode diagnostic
Jonas Schievink [Fri, 23 Oct 2020 17:31:11 +0000 (19:31 +0200)]
Fix name of InactiveCode diagnostic

3 years agoDiagnose #[cfg]s in bodies
Jonas Schievink [Fri, 23 Oct 2020 17:27:04 +0000 (19:27 +0200)]
Diagnose #[cfg]s in bodies

3 years agoImprove Chalk debugging
Florian Diebold [Fri, 23 Oct 2020 13:25:22 +0000 (15:25 +0200)]
Improve Chalk debugging

 - add panic context for the trait goal if CHALK_DEBUG is set
 - print the Chalk program even if we're panicking
 - log goal/solution while TLS is still set

3 years agoMerge #6335
bors[bot] [Fri, 23 Oct 2020 13:19:09 +0000 (13:19 +0000)]
Merge #6335

6335: Fix panic context r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
3 years agoFix panic context
Aleksey Kladov [Fri, 23 Oct 2020 13:18:33 +0000 (15:18 +0200)]
Fix panic context

3 years agoMerge #6324
bors[bot] [Fri, 23 Oct 2020 10:38:30 +0000 (10:38 +0000)]
Merge #6324

6324: Improve #[cfg] diagnostics r=jonas-schievink a=jonas-schievink

Unfortunately I ran into https://github.com/rust-analyzer/rust-analyzer/issues/4058 while testing this on https://github.com/nrf-rs/nrf-hal/, so I didn't see much of it in action yet, but it does seem to work.

Co-authored-by: Jonas Schievink <jonas.schievink@ferrous-systems.com>
Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
3 years agocfg: move tests to separate file
Jonas Schievink [Fri, 23 Oct 2020 10:14:58 +0000 (12:14 +0200)]
cfg: move tests to separate file

that way we don't have to re-check the entire project when a test is
changed

3 years agoReorder items
Jonas Schievink [Fri, 23 Oct 2020 10:10:22 +0000 (12:10 +0200)]
Reorder items

3 years agoUse format_to
Jonas Schievink [Fri, 23 Oct 2020 10:08:55 +0000 (12:08 +0200)]
Use format_to

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
3 years agoMerge #6098
bors[bot] [Thu, 22 Oct 2020 20:46:24 +0000 (20:46 +0000)]
Merge #6098

6098: Insert ref for completions r=adamrk a=adamrk

Follow up to https://github.com/rust-analyzer/rust-analyzer/pull/5846. When we have a local in scope which needs a ref or mutable ref to match the name and type of the active in the completion context then a new completion item with `&` or `&mut ` is inserted. E.g.
```rust
fn foo(arg: &i32){};
fn main() {
    let arg = 1_i32;
    foo(a<|>)
}
```
now offers `&arg` as a completion option with the highest score.

Co-authored-by: adamrk <ark.email@gmail.com>
3 years agoInsert ref for completions
adamrk [Tue, 29 Sep 2020 20:24:56 +0000 (22:24 +0200)]
Insert ref for completions

3 years agoMerge #6325 #6327
bors[bot] [Thu, 22 Oct 2020 18:15:48 +0000 (18:15 +0000)]
Merge #6325 #6327

6325: Add generated diagnostic docs to the manual r=matklad a=flodiebold

It seemed that we're not actually including the generated diagnostic docs anywhere yet? So I added something to the manual. This is completely untested though.

6327: Update debugging.md r=matklad a=stanciuadrian

`on_task` is no longer there.
I have used `on_request` instead.

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
Co-authored-by: Adrian Stanciu <stanciu.adrian@gmail.com>
3 years agoMerge #6326
bors[bot] [Thu, 22 Oct 2020 18:09:43 +0000 (18:09 +0000)]
Merge #6326

6326: hide paramater inlay hints for cloned vars if applicable r=SomeoneToIgnore a=Veykril

This causes `foo.clone()` parameters to be handled as if they were just `foo` parameters for inlay hint logic.

Fixes #6315

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
3 years agoUpdate crates/cfg/src/cfg_expr.rs
Jonas Schievink [Thu, 22 Oct 2020 18:08:27 +0000 (20:08 +0200)]
Update crates/cfg/src/cfg_expr.rs

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
3 years agoUpdate debugging.md
Adrian Stanciu [Thu, 22 Oct 2020 18:04:09 +0000 (21:04 +0300)]
Update debugging.md

3 years agoHide paramater inlay hints for cloned vars if applicable
Lukas Wirth [Thu, 22 Oct 2020 17:42:39 +0000 (19:42 +0200)]
Hide paramater inlay hints for cloned vars if applicable

3 years agoAdd generated diagnostic docs to the manual
Florian Diebold [Thu, 22 Oct 2020 17:42:01 +0000 (19:42 +0200)]
Add generated diagnostic docs to the manual

3 years agoEmit better #[cfg] diagnostics
Jonas Schievink [Thu, 22 Oct 2020 17:19:18 +0000 (19:19 +0200)]
Emit better #[cfg] diagnostics

3 years agoFix typo
Jonas Schievink [Thu, 22 Oct 2020 17:19:05 +0000 (19:19 +0200)]
Fix typo

3 years agoImplement DNF-based `#[cfg]` introspection
Jonas Schievink [Wed, 21 Oct 2020 17:54:04 +0000 (19:54 +0200)]
Implement DNF-based `#[cfg]` introspection

3 years agoMerge #6319
bors[bot] [Thu, 22 Oct 2020 14:24:10 +0000 (14:24 +0000)]
Merge #6319

6319: Properly identify camel cased acronyms as UpperCamelCase r=popzxc a=ArifRoktim

This closes #6305.

Co-authored-by: Arif Roktim <arifrroktim@gmail.com>
3 years agoalgo::diff tests
Lukas Wirth [Thu, 22 Oct 2020 11:51:08 +0000 (13:51 +0200)]
algo::diff tests

3 years agoMerge #6320 #6321
bors[bot] [Thu, 22 Oct 2020 12:04:50 +0000 (12:04 +0000)]
Merge #6320 #6321

6320: Textmate grammar: prevent line comments from breaking block comments (closes #6281) r=matklad a=dustypomerleau

Fixes https://github.com/rust-analyzer/rust-analyzer/issues/6281.

Previously, line comments were able to break block comments by essentially commenting out the closing `*/`, resulting in a never-ending comment. This PR splits block comments into a separate repository group to fix this problem.

Since the comment scopes also include ignored parameters and inferred types, I've added the change proposed by @bnjjj in https://github.com/rust-analyzer/rust-analyzer/pull/6317, in order to close https://github.com/rust-analyzer/rust-analyzer/issues/6311 as well.

6321: Fix opening module documentation opening parent documentation instead r=matklad a=zacps

The whole path/URL joining code is kind of ugly which is what led to
this, but at the same time I don't really want to rewrite it right
now...

Fixes https://github.com/rust-analyzer/rust-analyzer/issues/6286

Co-authored-by: Dusty Pomerleau <dustypomerleau@users.noreply.github.com>
Co-authored-by: Zac Pullar-Strecker <zacmps@gmail.com>
3 years agoMerge #6314
bors[bot] [Thu, 22 Oct 2020 11:58:11 +0000 (11:58 +0000)]
Merge #6314

6314: generate assist respect cfg attributes  r=matklad a=bnjjj

close #6312

Co-authored-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
3 years agoRewrite algo::diff to support insertion and deletion
Lukas Wirth [Wed, 21 Oct 2020 12:17:00 +0000 (14:17 +0200)]
Rewrite algo::diff to support insertion and deletion

3 years agogenerate_impl assist respect cfg attributes #6312
Benjamin Coenen [Wed, 21 Oct 2020 19:29:15 +0000 (21:29 +0200)]
generate_impl assist respect cfg attributes #6312

Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
3 years agoFix opening module documentation opening parent documentation instead
Zac Pullar-Strecker [Thu, 22 Oct 2020 04:31:25 +0000 (17:31 +1300)]
Fix opening module documentation opening parent documentation instead

The whole path/URL joining code is kind of ugly which is what led to
this, but at the same time I don't really want to rewrite it right
now...

3 years agofix: prevent line comments inside block comments
Dusty Pomerleau [Thu, 22 Oct 2020 02:03:04 +0000 (13:03 +1100)]
fix: prevent line comments inside block comments

- prevent line comments inside block comments
- prevent underscore-prefixed functions and macros from receiving comment scope

3 years agoProperly identify camel cased acronyms as UpperCamelCase
Arif Roktim [Wed, 21 Oct 2020 20:56:20 +0000 (16:56 -0400)]
Properly identify camel cased acronyms as UpperCamelCase

3 years agoMerge #6307
bors[bot] [Wed, 21 Oct 2020 20:09:11 +0000 (20:09 +0000)]
Merge #6307

6307: Add whitelist of safe intrinsics r=frazar a=frazar

This PR should fix #5996, where intrinsic operations where all marked as unsafe.

I'm rather new to this codebase, so I might be doing something *very* wrong. Please forgive me!

In particular, I'm not sure how to "check that we are in extern `rust-intrinsics`" as mentioned [in this comment](https://github.com/rust-analyzer/rust-analyzer/issues/5996#issuecomment-709234802).

Co-authored-by: Francesco Zardi <frazar@users.noreply.github.com>
3 years agoRefactor is_intrinsic_fn_unsafe() and make it private
Francesco Zardi [Wed, 21 Oct 2020 19:53:37 +0000 (21:53 +0200)]
Refactor is_intrinsic_fn_unsafe() and make it private

3 years agoMove safe intrinsic tests
Francesco Zardi [Wed, 21 Oct 2020 19:53:05 +0000 (21:53 +0200)]
Move safe intrinsic tests

3 years agoFix typo in comment
Francesco Zardi [Wed, 21 Oct 2020 19:51:53 +0000 (21:51 +0200)]
Fix typo in comment

3 years agoSimplify cfg representation
Jonas Schievink [Wed, 21 Oct 2020 11:57:12 +0000 (13:57 +0200)]
Simplify cfg representation

3 years agoMerge #6302
bors[bot] [Wed, 21 Oct 2020 08:39:03 +0000 (08:39 +0000)]
Merge #6302

6302: Textmate grammar: fix raw string highlighting r=matklad a=dustypomerleau

1. Fixes the raw string highlighting issue noted by @matklad in https://github.com/rust-analyzer/rust-analyzer/pull/6275.
2. Improves raw string highlighting by requiring the number of surrounding `#` to match.

Co-authored-by: Dusty Pomerleau <dustypomerleau@users.noreply.github.com>
3 years agoAdd whitelist of safe intrinsics
Francesco Zardi [Wed, 21 Oct 2020 07:06:05 +0000 (09:06 +0200)]
Add whitelist of safe intrinsics

3 years agoAdd tests for callable modifier
GrayJack [Wed, 21 Oct 2020 04:54:51 +0000 (01:54 -0300)]
Add tests for callable modifier

3 years agofix: require matching hash quantities for raw strings
Dusty Pomerleau [Tue, 20 Oct 2020 23:38:31 +0000 (10:38 +1100)]
fix: require matching hash quantities for raw strings

3 years agoMerge #6270
bors[bot] [Tue, 20 Oct 2020 22:26:31 +0000 (22:26 +0000)]
Merge #6270

6270: Update crates r=matklad a=kjeremy

This brings in a number of new dependencies though.

Co-authored-by: Jeremy Kolb <kjeremy@gmail.com>
3 years agoUpdate crates
Jeremy Kolb [Sat, 17 Oct 2020 18:20:52 +0000 (14:20 -0400)]
Update crates

This brings in a number of new dependencies though.

3 years agoMerge #6259
bors[bot] [Tue, 20 Oct 2020 20:49:17 +0000 (20:49 +0000)]
Merge #6259

6259: allow xtask install --client[=CLIENT] to specify client r=Emilgardis a=Emilgardis

Co-authored-by: Emil Gardström <emil.gardstrom@gmail.com>
3 years agorename flag --client-code to --client on xtask install
Emil Gardström [Tue, 20 Oct 2020 20:37:02 +0000 (22:37 +0200)]
rename flag --client-code to --client on xtask install

3 years agoMerge #6109
bors[bot] [Tue, 20 Oct 2020 19:43:44 +0000 (19:43 +0000)]
Merge #6109

6109: add completions for clippy lint in attributes r=bnjjj a=bnjjj

Co-authored-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
3 years agoadd completions for clippy lint in attributes
Benjamin Coenen [Tue, 20 Oct 2020 19:29:31 +0000 (21:29 +0200)]
add completions for clippy lint in attributes

Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
3 years agoMerge #6256
bors[bot] [Tue, 20 Oct 2020 19:03:25 +0000 (19:03 +0000)]
Merge #6256

6256: Assist: replace string with char r=bnjjj a=bnjjj

close #6252

Co-authored-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
Co-authored-by: Coenen Benjamin <benjamin.coenen@hotmail.com>
3 years agoUpdate crates/assists/src/handlers/replace_string_with_char.rs
Coenen Benjamin [Tue, 20 Oct 2020 18:07:39 +0000 (20:07 +0200)]
Update crates/assists/src/handlers/replace_string_with_char.rs

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
3 years agoMerge #6172
bors[bot] [Tue, 20 Oct 2020 17:03:19 +0000 (17:03 +0000)]
Merge #6172

6172: Add qualify path assist r=matklad a=Veykril

This implements a `qualify_path` assist which works quite similar to the `auto_import` assist but instead of adding imports to the file it well, qualifies the path. This PR also moves out the `AutoImportAssets` struct and functions from `auto_import` into a utils submodule as most of this is now shared between `auto_import` and `qualify_path`.

Changes made to `AutoImportAssets` are solely in its `search_for_imports` function which now takes a prefixed parameter to discern between using `find_use_path_prefixed` and `find_use_path` as the former is the required behavior by `auto_import` and the latter by this assist.

For missing imported traits instead of importing this will qualify the path with a trait cast as in:
```rust
test_mod::TestStruct::TEST_CONST<|>
```
becomes
```rust
<test_mod::TestStruct as test_mod::TestTrait>::TEST_CONST
```

and for trait methods ideally it would do the following:
```rust
let test_struct = test_mod::TestStruct {};
test_struct.test_meth<|>od()
```
becomes
```rust
let test_struct = test_mod::TestStruct {};
test_mod::TestTrait::test_method(&test_struct)
```

Fixes #4124.

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
3 years agoMerge #6299
bors[bot] [Tue, 20 Oct 2020 16:35:05 +0000 (16:35 +0000)]
Merge #6299

6299: Diagnose items that are #[cfg]d out r=jonas-schievink a=jonas-schievink

This emits a hint-level diagnostic with `Unnecessary` tag to "gray out" any items whose `#[cfg]` attributes remove the item before name resolution.

Co-authored-by: Jonas Schievink <jonas.schievink@ferrous-systems.com>
3 years agoFixup botched rename
Jonas Schievink [Tue, 20 Oct 2020 16:29:47 +0000 (18:29 +0200)]
Fixup botched rename

3 years agoMore detailed message
Jonas Schievink [Tue, 20 Oct 2020 16:23:55 +0000 (18:23 +0200)]
More detailed message

3 years agoRename UnconfiguredCode -> InactiveCode
Jonas Schievink [Tue, 20 Oct 2020 16:22:31 +0000 (18:22 +0200)]
Rename UnconfiguredCode -> InactiveCode

3 years agoMerge #6301
bors[bot] [Tue, 20 Oct 2020 16:14:40 +0000 (16:14 +0000)]
Merge #6301

6301: Don't rely on display names in inlay_hints r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
3 years agoDon't rely on display names in inlay_hints
Aleksey Kladov [Tue, 20 Oct 2020 15:38:21 +0000 (17:38 +0200)]
Don't rely on display names in inlay_hints

3 years agoAdd a (hint) diagnostic for unconfigured items
Jonas Schievink [Tue, 20 Oct 2020 15:49:21 +0000 (17:49 +0200)]
Add a (hint) diagnostic for unconfigured items

3 years agoSimplify diagnostic construction, add unused field
Jonas Schievink [Tue, 20 Oct 2020 15:48:43 +0000 (17:48 +0200)]
Simplify diagnostic construction, add unused field

3 years agoMerge #6297
bors[bot] [Tue, 20 Oct 2020 15:15:58 +0000 (15:15 +0000)]
Merge #6297

6297: Support Display name in project.json r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
3 years agoSupport Display name in project.json
Aleksey Kladov [Tue, 20 Oct 2020 15:13:15 +0000 (17:13 +0200)]
Support Display name in project.json

3 years agoMerge #6295
bors[bot] [Tue, 20 Oct 2020 15:09:51 +0000 (15:09 +0000)]
Merge #6295

6295: More type safety around names r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
3 years agoMore type safety around names
Aleksey Kladov [Tue, 20 Oct 2020 15:04:38 +0000 (17:04 +0200)]
More type safety around names

3 years agoIntroduce CrateDisplayName
Aleksey Kladov [Tue, 20 Oct 2020 14:00:51 +0000 (16:00 +0200)]
Introduce CrateDisplayName

3 years agoAssist: replace string with char
Benjamin Coenen [Sat, 17 Oct 2020 14:08:25 +0000 (16:08 +0200)]
Assist: replace string with char

Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
3 years agoRename declaration_name -> display_name
Aleksey Kladov [Tue, 20 Oct 2020 13:38:11 +0000 (15:38 +0200)]
Rename declaration_name -> display_name

Declaration names sounds like a name of declaration -- something you
can use for analysis. It empathically isn't, and is just a label
displayed in various UI. It's important not to confuse the two, least
we accidentally mix semantics with UI (I believe, there's already a
case of this in the FamousDefs at least).

3 years agoMerge #6294
bors[bot] [Tue, 20 Oct 2020 10:36:28 +0000 (10:36 +0000)]
Merge #6294

6294: Add a hacky remidy for #6038 r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
3 years agoAdd a hacky remidy for #6038
Aleksey Kladov [Tue, 20 Oct 2020 10:34:39 +0000 (12:34 +0200)]
Add a hacky remidy for #6038

The proper fix I think is:

* move rust-lang/rust library crates to a separate workspace
* when packaging rust-src component, vendor sources of external deps

3 years agoMerge #6266
bors[bot] [Tue, 20 Oct 2020 09:46:43 +0000 (09:46 +0000)]
Merge #6266

6266: Generate diagnostics docs r=matklad a=popzxc

Resolves #6215

Co-authored-by: Igor Aleksanov <popzxc@yandex.ru>
3 years agoAdd generated_diagnostic.adoc to the release.rs and smoke_test_docs_generation
Igor Aleksanov [Mon, 19 Oct 2020 18:07:40 +0000 (21:07 +0300)]
Add generated_diagnostic.adoc to the release.rs and smoke_test_docs_generation

3 years agoUse xshell::read_file instead of fs::read_to_string
Igor Aleksanov [Mon, 19 Oct 2020 17:58:32 +0000 (20:58 +0300)]
Use xshell::read_file instead of fs::read_to_string