Commit Graph

12169 Commits

Author SHA1 Message Date
bors[bot]
5567b8a632
Merge #9314
9314: Fix extract_function with await r=sasurau4 a=sasurau4

Fix #9287 

Co-authored-by: Daiki Ihara <sasurau4@gmail.com>
2021-06-21 13:59:29 +00:00
Daiki Ihara
873aa904f2 Fix var name 2021-06-21 22:47:39 +09:00
bors[bot]
b48aba0090
Merge #9227
9227: Add a config setting to disable the 'test' cfg in specified crates r=matklad a=lf-

If you are opening libcore from rust-lang/rust as opposed to e.g.
goto definition from some other crate which would use the sysroot
instance of libcore, a `#![cfg(not(test))]` would previously have made
all the code excluded from the module tree, breaking the editor
experience.

Core does not need to ever be edited with `#[cfg(test)]` enabled,
as the tests are in another crate.

This PR puts in a slight hack that checks for the crate name "core" and
turns off `#[cfg(test)]` for that crate.

Fixes #9203 
Fixes #9226 

Co-authored-by: Jade <software@lfcode.ca>
2021-06-21 13:41:27 +00:00
Jonas Schievink
9e306909db Update sysroot crates 2021-06-21 15:26:26 +02:00
bors[bot]
c69f762f26
Merge #9356
9356: internal: Move out and regroup more completion tests r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-06-21 13:15:12 +00:00
Lukas Wirth
0729913525 Various keyword completion fixes 2021-06-21 15:14:28 +02:00
Lukas Wirth
b9d85f55b7 Move out completion type position tests 2021-06-21 15:00:53 +02:00
Jonas Schievink
8d2a33da05 Don't insert } when typing { in string 2021-06-21 14:54:49 +02:00
Lukas Wirth
f835279b3a Move out completion pattern tests 2021-06-21 13:48:25 +02:00
Daiki Ihara
7a04f72220 Fix pointed out 2021-06-21 18:42:25 +09:00
Daiki Ihara
cd1ef8de18 Fix extract_function with await 2021-06-21 18:31:53 +09:00
rezural
baa060a994 output to log file if RA_LOG_FILE is defined in environment 2021-06-21 09:33:57 +10:00
Florian Diebold
a1120b6879 Fix benchmark_include_macro 2021-06-20 19:37:45 +02:00
Florian Diebold
78419779f1 More cleanups, use check for display_source_code tests 2021-06-20 19:12:06 +02:00
Florian Diebold
0219b145ea Clean up coercion tests 2021-06-20 19:12:06 +02:00
Florian Diebold
d340f28a81 test_utils: Make overlapping annotations possible 2021-06-20 19:12:06 +02:00
Florian Diebold
04fbdce426 Unify check_mismatches and check_types 2021-06-20 19:12:06 +02:00
Florian Diebold
679bb21633 Add coverage mark for block local impls 2021-06-20 19:12:06 +02:00
Aleksey Kladov
9a3eae8755 fix: don't add duplicate & during completion 2021-06-20 19:37:58 +03:00
bors[bot]
f1097c2d26
Merge #9344
9344: fix: rename works when invoked on a reference r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-06-20 14:08:19 +00:00
Aleksey Kladov
cbb1979c19 fix: rename works when invoked on a reference 2021-06-20 17:07:55 +03:00
bors[bot]
3843bd02a0
Merge #9328
9328: internal: Update deps r=lnicola a=kjeremy



Co-authored-by: kjeremy <kjeremy@gmail.com>
2021-06-20 03:22:13 +00:00
Lukas Wirth
2113c46797 Cleanup insert_use tests 2021-06-19 22:33:29 +02:00
bors[bot]
c2aa7782d6
Merge #9338
9338: minor: use minicore r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-06-19 09:18:34 +00:00
Milo
044e21ae08 remove num_format 2021-06-19 10:14:15 +01:00
Aleksey Kladov
7df6852b6e minor: use minicore 2021-06-19 12:03:59 +03:00
Milo
673933e2f7 update crate and deps section 2021-06-19 09:44:11 +01:00
Jade
8b77e2692c Implement a config override for the default #[cfg(test)] in cargo crates
Fixes crates which vanish when the 'test' cfg atom is set.

Fix #7243.
Fix #9203.
Fix #7225.
2021-06-19 01:09:19 -07:00
Jade
1f6abb7fba Fix libcore not being included in rust-lang/rust module tree
If you are opening libcore from rust-lang/rust as opposed to e.g.
goto definition from some other crate which would use the sysroot
instance of libcore, a `#![cfg(not(test))]` would previously have made
all the code excluded from the module tree, breaking the editor
experience.

This puts in a slight hack that checks for the crate name "core" and
turns off `#[cfg(test)]`.
2021-06-19 01:09:19 -07:00
Milo
d8209e6378 fmt 2021-06-19 08:12:58 +01:00
Milo
664cc8c754 use num_format 2021-06-19 08:12:46 +01:00
Milo
d2f7e0fea4 clean up some wording 2021-06-19 07:51:44 +01:00
Milo
08ec80c093 remove incorrect double blank new lines 2021-06-18 23:34:00 +01:00
Milo
7aaadf929d make workspaces look better 2021-06-18 23:20:30 +01:00
Lukas Wirth
344cb5e76a Don't insert imports outside of cfg attributed items 2021-06-18 23:56:43 +02:00
bors[bot]
d9666ce509
Merge #9334
9334: feat: Allow to disable import insertion on single path glob imports r=Veykril a=Veykril

On by default as I feel like this is something the majority would prefer.

Closes #8490

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-06-18 21:23:22 +00:00
Lukas Wirth
2ee090faaf Allow to disable import insertion on single path glob imports 2021-06-18 23:11:56 +02:00
Aleksey Kladov
3762cc7465 minor: use minicore 2021-06-18 23:59:47 +03:00
Aleksey Kladov
90da9fc9b3 minor: use minicore 2021-06-18 23:48:18 +03:00
Aleksey Kladov
a9623f3165 minor: use minicore 2021-06-18 23:38:19 +03:00
Aleksey Kladov
cc73abf72c minor: use minicore 2021-06-18 23:33:01 +03:00
Aleksey Kladov
181184a350 minor: use minicore 2021-06-18 23:28:37 +03:00
Aleksey Kladov
89a0e58393 internal: use minicore deref more 2021-06-18 22:47:02 +03:00
Aleksey Kladov
991919e71f internal: add index to minicore 2021-06-18 22:37:34 +03:00
Aleksey Kladov
73b3ee664e minor: use minicore 2021-06-18 22:25:35 +03:00
Aleksey Kladov
2e4df27132 minor: use minicore 2021-06-18 22:25:35 +03:00
Aleksey Kladov
15c4b3fa7f internal: add Copy to minicore 2021-06-18 22:10:52 +03:00
kjeremy
e0e694620c Update test 2021-06-18 14:36:12 -04:00
Milo
7d502c7f08 Recreate PR. 2021-06-18 19:22:03 +01:00
bors[bot]
0657812bc2
Merge #9321
9321: Inline generics in const and function trait completions r=Veykril a=RDambrosio016

This PR does a couple of things:
- moves path_transform from ide_assists to ide_db to be shared by both assists and completions
- when completing a const or a function for a trait, it will "inline" any generics in those associated items instead 
of leaving the generic's name. For example:
```rust
trait Foo<T> {
    const BAR: T;
    fn foo() -> T;
}
struct Bar;

impl Foo<u32> for Bar {
    // autocompletes to this
    fn foo() -> u32;

    // and not this (old)
    fn foo() -> T;

    // also works for associated consts and where clauses
    const BAR: u32 = /* */
}
```

Currently this does not work for const generics, because `PathTransform` does not seem to account for them. If this should work on const generics too, `PathTransform` will need to be changed. However, it is uncommon to implement a trait only for a single const value, so this isnt a huge concern.

Co-authored-by: rdambrosio <rdambrosio016@gmail.com>
2021-06-18 16:47:58 +00:00
rdambrosio
b3e5c648e0 Lift ast -> hir out of the for_each 2021-06-18 12:42:13 -04:00
Laurențiu Nicola
6b1f0057f2 Avoid string allocation 2021-06-18 14:46:18 +03:00
Laurențiu Nicola
e3ce88f6f2 Minor clippy perf fixes 2021-06-18 14:40:51 +03:00
rdambrosio
23e3354ae0 Remove extra whitespace 2021-06-18 02:14:00 -04:00
rdambrosio
8e08b86304 Feat: inline generics in const and func trait completions 2021-06-17 19:54:28 -04:00
bors[bot]
0d863ccea9
Merge #9313
9313: fix: Don't complete keywords in attributes inside expressions r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-06-17 22:30:30 +00:00
Aleksey Kladov
66673eae2b internal: retire famous_defs_fixture
This is now done declaratively via `minicore`.
2021-06-18 00:42:32 +03:00
Aleksey Kladov
89c2dff58a minor: simplify 2021-06-18 00:36:25 +03:00
Aleksey Kladov
ebb591a570 internal: add derive and ord support to minicore 2021-06-18 00:30:22 +03:00
Lukas Wirth
c1bf1f88ad Complete repr attribute parameters 2021-06-17 21:15:49 +02:00
Aleksey Kladov
ca99aaa053 internal: add From to minicore 2021-06-17 21:04:12 +03:00
Aleksey Kladov
82c7afc703 minor: dead code 2021-06-17 20:51:34 +03:00
Aleksey Kladov
08c220ab2c internal: add default to minicore 2021-06-17 20:49:49 +03:00
bors[bot]
ce926aebc4
Merge #9315
9315: Nest all the or-patterns! r=Veykril a=Veykril

`cargo +nightly clippy --fix -Z unstable-options --allow-dirty -- -A clippy::all -D clippy::unnested_or_patterns`

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-06-17 16:22:32 +00:00
Lukas Wirth
02d25ab60d Fix parser tests for 1.53 2021-06-17 18:09:44 +02:00
Lukas Wirth
b6cb6d5abe simplify 2021-06-17 17:58:26 +02:00
Lukas Wirth
95c8c65139 Nest all the or-patterns! 2021-06-17 17:37:14 +02:00
Lukas Wirth
2ac03ef1d6 Don't complete keywords in attributes inside expressions 2021-06-17 16:02:51 +02:00
Lukas Wirth
2a48b53220 Correct completions in items tests 2021-06-17 15:43:21 +02:00
Lukas Wirth
a9a77671f2 Move item specific completion tests 2021-06-17 15:32:34 +02:00
Lukas Wirth
9df848c580 Less filtering in completion tests 2021-06-17 15:10:25 +02:00
bors[bot]
c82a9141ab
Merge #9310
9310: internal: Refine and test UseTree completions r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-06-17 12:01:43 +00:00
Lukas Wirth
9353f36516 Fix incorrect completions in empty braced use statement 2021-06-17 13:59:31 +02:00
Lukas Wirth
2225db2eb4 Refine self, super and crate completion in use paths 2021-06-17 13:56:55 +02:00
Lukas Wirth
e14f5cfff0 Move out and rewrite UseTree completion tests 2021-06-17 13:13:12 +02:00
bors[bot]
3b58d8f785
Merge #9308
9308: fix: Create modules in correct directory for nested modules in move_module assist r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-06-17 10:10:25 +00:00
Lukas Wirth
cd5f4121e3 Create modules in correct directory for nested modules in move_module assist 2021-06-17 12:09:28 +02:00
Aleksey Kladov
ac35645455 internal: remove dead code 2021-06-17 11:42:43 +03:00
Aleksey Kladov
a43bba760e internal: switch some tests to minicore 2021-06-17 11:41:36 +03:00
Aleksey Kladov
c42cdff3d2 internal: minimize minicore
We want to keep minicore small, so let's split out iterator adapters and
sources into a separate `iterators` region, and use them only when
needed.
2021-06-17 11:28:44 +03:00
Aleksey Kladov
9b3aa591cd internal: switch some tests to minicore 2021-06-17 11:18:37 +03:00
bors[bot]
7b4f5c0262
Merge #9304
9304: internal: cleanup tests r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-06-16 20:28:23 +00:00
Aleksey Kladov
35772256f8 internal: cleanup tests 2021-06-16 23:27:46 +03:00
Aleksey Kladov
ee7b649d44 internal: switch some tests to minicore 2021-06-16 22:54:57 +03:00
Lukas Wirth
aa644b5585 Move test_utils into tests module 2021-06-16 21:51:52 +02:00
Lukas Wirth
11115ebad8 Don't complete paths after attributes 2021-06-16 21:51:21 +02:00
Lukas Wirth
9ea6ee6b27 Don't show incorrect completions after unsafe or visiblity node 2021-06-16 21:51:20 +02:00
Lukas Wirth
1a8f76a224 Don't complete visibility accessors after existing ones 2021-06-16 21:51:20 +02:00
Lukas Wirth
d338a80394 Start refactoring ide_completion tests 2021-06-16 21:51:20 +02:00
Aleksey Kladov
604267088c internal: add iterator to minicore 2021-06-16 22:48:48 +03:00
Aleksey Kladov
7ba5482a04 internal: switch some tests to minicore 2021-06-16 22:26:46 +03:00
Aleksey Kladov
7e0d441687 internal: switch some tests to minicore 2021-06-16 22:24:11 +03:00
bors[bot]
f38770cd26
Merge #9302
9302: internal: Add builtin derives to attribute completion fixtures r=Veykril a=Veykril

bors R+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-06-16 17:28:13 +00:00
Lukas Wirth
a92ed1eef4 Don't complete already used derive attributes 2021-06-16 19:27:06 +02:00
Lukas Wirth
8f936c5571 Add builtin derives to attribute completion fixtures 2021-06-16 19:25:09 +02:00
bors[bot]
f6e73d510d
Merge #9258
9258: minor: Give `ImportPrefix` variants better config names r=matklad a=Veykril

I feel like `crate` and `self` work better than `by_crate` and `by_self`. The only reason for the current names were that `Self` doesn't work for the variant name on the rust side so I forgot about setting proper config names on serde layer.

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-06-16 14:53:06 +00:00
Lukas Wirth
66b701ed3e Simplify 2021-06-16 15:51:01 +02:00
bors[bot]
1c034c084d
Merge #9299
9299: minor: Filter out non-type completions in the respective completions modules instead r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-06-16 13:10:44 +00:00
Lukas Wirth
354ad29493 Filter out non-type completions in the respective completions modules instead 2021-06-16 15:08:44 +02:00
Aleksey Kladov
8a4d9bb80a internal: add fn to minicore 2021-06-16 12:15:45 +03:00
Aleksey Kladov
d2c9f3add1 internal: add deref_mut to minicore 2021-06-16 10:30:29 +03:00
bors[bot]
5ba5e6348f
Merge #9293
9293: fix: Show diagnostic fixes before assists r=matklad a=lnicola

Closes #9212

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2021-06-15 20:38:29 +00:00
bors[bot]
9bddd2af55
Merge #9294
9294: internal: introduce minicore -- a subset of libcore for testing r=matklad a=matklad

Clearly, we need one more fixed point iteration loop!

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-06-15 20:14:36 +00:00
Aleksey Kladov
7cbcbccc78 internal: switch some tests to minicore 2021-06-15 23:11:53 +03:00
Aleksey Kladov
0798cce9e5 internal: add result to minicore 2021-06-15 23:07:25 +03:00
Aleksey Kladov
ae92057df6 internal: switch some tests to minicore 2021-06-15 23:02:38 +03:00
Aleksey Kladov
2870d2bade internal: add option to minicore 2021-06-15 22:59:51 +03:00
Lukas Wirth
29054e02fb Highlight unsafe trait refs as unsafe only in impl blocks and definitions 2021-06-15 21:49:59 +02:00
Aleksey Kladov
3efe5c3426 internal: add future to minicore 2021-06-15 22:49:00 +03:00
Aleksey Kladov
2eef66a2ed internal: sanity-check minicore flags 2021-06-15 22:38:21 +03:00
Aleksey Kladov
09c4013ec0 internal: switch some tests to minicore 2021-06-15 22:02:29 +03:00
Aleksey Kladov
ee13e895e3 internal: switch some tests to minicore 2021-06-15 21:57:56 +03:00
Aleksey Kladov
0bb1f1bc90 internal: add ranges to minicore 2021-06-15 21:45:25 +03:00
Aleksey Kladov
f4b52682da internal: unindent some tests 2021-06-15 21:39:44 +03:00
Aleksey Kladov
b737b894cb internal: switch some tests to minicore 2021-06-15 21:36:50 +03:00
Aleksey Kladov
7ebac5e54c internal: switch some tests to minicore 2021-06-15 21:34:26 +03:00
Aleksey Kladov
0475201538 internal: switch some tests to minicore 2021-06-15 21:19:51 +03:00
Aleksey Kladov
f841369fee internal: switch some tests to minicore 2021-06-15 21:11:53 +03:00
Aleksey Kladov
f521e41853 internal: introduce minicore -- a subset of libcore for testing 2021-06-15 21:03:08 +03:00
Laurențiu Nicola
e58f63dc63 Show diagnostic fixes before assists 2021-06-15 20:55:27 +03:00
Aleksey Kladov
067e97d149 internal: enforce no #[ignore] and no #[should_panic] 2021-06-15 16:54:43 +03:00
Aleksey Kladov
4584868a7a internal: don't #[ignore] tests
See the style.md for motivation
2021-06-15 16:37:58 +03:00
Aleksey Kladov
1e100e8b3e internal: cleanup tests
* ensure standard, non-indented style (should add this check to
  `fixture` some day)
* removed a couple of ignores
2021-06-15 12:48:05 +03:00
Aleksey Kladov
7786ab2d44 minor: add a test variation 2021-06-15 11:58:39 +03:00
bors[bot]
fa4c851619
Merge #9278
9278: internal: document that we don't #[ignore] tests r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-06-15 08:48:15 +00:00
Aleksey Kladov
3f4ad44082 internal: document that we don't #[ignore] tests 2021-06-15 11:46:47 +03:00
Laurențiu Nicola
41949748a6 Use objects instead of bools for markers in package.json 2021-06-15 09:40:43 +03:00
bors[bot]
447d849c9e
Merge #9277
9277: internal: more natural order of sources for TypeParam r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-06-14 19:44:59 +00:00
Aleksey Kladov
c2015e7d18 internal: more natural order of sources for TypeParam
We usually use first (left) variant of `Either` for "usual" case, and
use right for odd things. For example, pat source is Pat | SelfParam.
2021-06-14 22:42:43 +03:00
bors[bot]
ce8fdf3ab0
Merge #9276
9276: internal: refactor diagnostics more r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-06-14 19:37:28 +00:00
Aleksey Kladov
4cfc767d7f internal: test diagnostic severeties and presense of fixes 2021-06-14 22:37:06 +03:00
Aleksey Kladov
58712088ac minor: make diagnostics more similar 2021-06-14 22:37:06 +03:00
bors[bot]
27a70492f7
Merge #9275
9275: feat: Support goto type for field expressions and patterns r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-06-14 19:08:05 +00:00
Lukas Wirth
2c8e89b6f0 Support goto type for field expressions and patterns 2021-06-14 21:07:07 +02:00
Aleksey Kladov
06f5d6f640 internal: don't pull tracing via chalk 2021-06-14 20:41:08 +03:00
bors[bot]
38ae18b759
Merge #9272
9272: internal: move diagnostics to a dedicated crate r=matklad a=matklad

bors r+

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-06-14 16:46:25 +00:00
Aleksey Kladov
4768e5fb23 internal: document diagnostics crate 2021-06-14 19:45:39 +03:00
bors[bot]
401d79ac06
Merge #9270
9270: minor: Add assoc type in trait bound completion test r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-06-14 16:17:55 +00:00
Lukas Wirth
5558e11282 Add assoc type in trait bound completion test 2021-06-14 18:17:21 +02:00
Aleksey Kladov
94f7b63522 minor: less ambiguous name 2021-06-14 19:16:03 +03:00
Aleksey Kladov
da534bdd07 internal: flatten module hierarchy
It seems that any crate can be made better by flattening the modules
down to a single layer?
2021-06-14 19:14:34 +03:00
Aleksey Kladov
9fb67e7477 internal: document rename challenges 2021-06-14 19:08:12 +03:00
Lukas Wirth
c7c2eb8b08 typo 2021-06-14 18:01:38 +02:00
Aleksey Kladov
26c978f258 internal: adapt diagnostics to the new rename API 2021-06-14 18:46:54 +03:00
Aleksey Kladov
a91071b57b internal: cut deps between assists and diagnostics 2021-06-14 17:45:17 +03:00
Aleksey Kladov
2e8dab631b internal: prepare to move assist definitions 2021-06-14 17:45:17 +03:00
Aleksey Kladov
1d2772c2c7 internal: move diagnostics to a new crate 2021-06-14 17:45:17 +03:00
Aleksey Kladov
3d2f0400a2 internal: start ide diagnostics crate 2021-06-14 17:45:17 +03:00
Aleksey Kladov
721feb1832 internal: prepare to move rename to base_db
It's better to handle magical cases upper in the stack, because it
allows for better re-use of the general implementation below. So, we
pull the `self` case up here.

The end goal is to put `Definition::rename` to the `ide_db`, because
it's a generally re-usable functionality useful for different ide
features, alongside with the search which is already there.
2021-06-14 17:28:39 +03:00
Lukas Wirth
178b5ffba3 Add configuration deprecation 2021-06-14 15:49:57 +02:00
Lukas Wirth
9043c5db86 Don't ignore hover documentation setting for keyword hovers 2021-06-14 15:31:14 +02:00
Lukas Wirth
a93d166f0f Make documentation on hover configurable 2021-06-14 15:25:10 +02:00
bors[bot]
d4ab49c533
Merge #9263
9263: fix: don't use display-related functionality where semantics matters r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-06-14 12:46:38 +00:00
Aleksey Kladov
e696188672 fix: don't use display-related functionality where semantics matters
NavigationTarget is strictly a UI-level thing -- it describes where the
cursor should be placed when the user presses goto definition. It
doesn't make any semantic guaratees about rage and focus range and, as
such, is not suitable for driving renames.
2021-06-14 15:43:59 +03:00
Lukas Wirth
7cf273a18e Don't keep a trailing self token in import paths after unmerge_use 2021-06-14 13:56:33 +02:00
bors[bot]
5a8ddb4b2d
Merge #9260
9260: tree-wide: make rustdoc links spiky so they are clickable r=matklad a=lf-

Rustdoc was complaining about these while I was running with --document-private-items and I figure they should be fixed.

Co-authored-by: Jade <software@lfcode.ca>
2021-06-14 07:16:48 +00:00
Jade
20b325c7d5 tree-wide: make rustdoc links spiky so they are clickable 2021-06-13 21:58:05 -07:00
Lukas Wirth
b58c1c9eb2 Give ImportPrefix variants better config names 2021-06-13 22:00:39 +02:00
Aleksey Kladov
500c909c76 internal: diagnostic code is mandatory 2021-06-13 22:17:36 +03:00
Aleksey Kladov
b404b91da6 minor: dead code 2021-06-13 22:11:33 +03:00
Aleksey Kladov
ff52167c9a internal: kill diagnostic sink 2021-06-13 22:05:47 +03:00
Aleksey Kladov
935c53b92e internal: use cov-mark rather than bailing out diagnostic 2021-06-13 21:55:51 +03:00
Aleksey Kladov
b292e1b9da internal: refactor missing match arms diagnostics 2021-06-13 21:44:31 +03:00
Aleksey Kladov
3478897f86 internal: remove DiagnosticWithFix infra 2021-06-13 21:33:54 +03:00
Aleksey Kladov
fc30c5ccbe internal: refactor incorrect case diagnostics 2021-06-13 21:09:03 +03:00
Aleksey Kladov
b66f4bb8d1 minor 2021-06-13 20:33:59 +03:00
Aleksey Kladov
de1fc70ccd internal: refactor find_map diagnostic 2021-06-13 20:32:54 +03:00
Aleksey Kladov
24262f9ff6 minor 2021-06-13 20:20:58 +03:00
Aleksey Kladov
949a6ec469 internal: refactor missing or or some diagnostic 2021-06-13 20:19:11 +03:00
Aleksey Kladov
74f3cca85a internal: refactor remove this semicolon diagnostics 2021-06-13 20:14:12 +03:00
Aleksey Kladov
8d391ec981 internal: refactor mismatched args count diagnostic 2021-06-13 20:06:25 +03:00
Aleksey Kladov
bccf77f26c internal: refactor missing unsafe diagnostic 2021-06-13 20:01:01 +03:00
Aleksey Kladov
886b66cd03 internal: refactor BreakOutsideOfLoop diagnostic 2021-06-13 19:51:19 +03:00
Aleksey Kladov
7166e8549b internal: refactor NoSuchField diagnostic 2021-06-13 19:45:16 +03:00
Aleksey Kladov
d3621eeb02 internal: refactor unimplemented builtin macro diagnostic 2021-06-13 19:35:30 +03:00
Aleksey Kladov
dec207f56a minor: simplify 2021-06-13 19:27:24 +03:00
Aleksey Kladov
a1940d8c75 internal: check diagnostics in all files and not just the first one 2021-06-13 19:23:37 +03:00
bors[bot]
7bff76d8ae
Merge #9249
9249: internal: remove def-level diagnostics tests r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-06-13 15:46:09 +00:00
Aleksey Kladov
4af7a35197 internal: remove def-level diagnostics tests 2021-06-13 18:45:38 +03:00
Aleksey Kladov
00303284b5 internal: refactor macro error 2021-06-13 18:41:04 +03:00
Aleksey Kladov
1e4aaee7bb internal: refactor unresolved proc macro diagnostic 2021-06-13 17:51:44 +03:00
Aleksey Kladov
f85e383b94 internal: refactor inactive code diagnostics 2021-06-13 17:29:25 +03:00
bors[bot]
3d8df2aef8
Merge #9248
9248: internal: refactor unresolved macro call diagnostic r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-06-13 14:09:41 +00:00
Aleksey Kladov
fa9ed4e0ce internal: refactor unresolved macro call diagnostic 2021-06-13 17:08:54 +03:00
Aleksey Kladov
6d104de15a internal: refactor unresolved import diagnostic 2021-06-13 16:42:34 +03:00
bors[bot]
e6fa9b016f
Merge #9247
9247: internal: refactor unresolved extern crate diagnostic r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-06-13 13:06:27 +00:00
Aleksey Kladov
39f190b72c internal: refactor unresolved extern crate diagnostic 2021-06-13 16:05:43 +03:00
bors[bot]
cc6d761a99
Merge #9246
9246: internal: unified missing fields diagnostic r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-06-13 12:49:37 +00:00
Aleksey Kladov
6383252cc2 internal: unified missing fields diagnostic 2021-06-13 15:48:54 +03:00
Aleksey Kladov
c6509a4592 internal: move missing_fields diagnostics 2021-06-13 15:27:15 +03:00
bors[bot]
3f53a5dd72
Merge #9245
9245: internal: start new diagnostics API r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-06-13 11:56:15 +00:00
Aleksey Kladov
efa069d288 internal: start new diagnostics API
At the moment, this moves only a single diagnostic, but the idea is
reafactor the rest to use the same pattern. We are going to have a
single file per diagnostic. This file will define diagnostics code,
rendering range and fixes, if any. It'll also have all of the tests.
This is similar to how we deal with assists.

After we refactor all diagnostics to follow this pattern, we'll probably
move them to a new `ide_diagnostics` crate.

Not that we intentionally want to test all diagnostics on this layer,
despite the fact that they are generally emitted in the guts on the
compiler. Diagnostics care to much about the end presentation
details/fixes to be worth-while "unit" testing. So, we'll unit-test only
the primary output of compilation process (types and name res tables),
and will use integrated UI tests for diagnostics.
2021-06-13 14:55:45 +03:00
bors[bot]
be9742809c
Merge #9244
9244: feat: Make block-local trait impls work r=flodiebold a=flodiebold

As long as either the trait or the implementing type are defined in the same block.

CC #8961

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2021-06-13 11:13:31 +00:00
Florian Diebold
5ca71a1990 Make block-local trait impls work
As long as either the trait or the implementing type are defined in the
same block.
2021-06-13 13:00:34 +02:00
Aleksey Kladov
546be18e3a internal: check that coverage marks are always paired 2021-06-13 13:13:26 +03:00
Aleksey Kladov
0eafc88079 minor: put a mark back 2021-06-13 11:49:32 +03:00
bors[bot]
adbee621a7
Merge #9242
9242: Clippy r=matklad a=Maan2003

Best viewed commit wise

Co-authored-by: Maan2003 <manmeetmann2003@gmail.com>
2021-06-13 07:18:49 +00:00
bors[bot]
f107b0f1e2
Merge #9240
9240: Fixed a small typo in comment r=matklad a=fee1-dead



Co-authored-by: fee1-dead <ent3rm4n@gmail.com>
2021-06-13 06:58:37 +00:00
Maan2003
5ac6804bb3
cargo fmt 2021-06-13 09:48:15 +05:30
Maan2003
aabd41cafc
clippy::redundant_field_names 2021-06-13 09:40:22 +05:30
Maan2003
b857a5dcf0
clippy::manual_str_repeat 2021-06-13 09:37:28 +05:30
Maan2003
c50b4579ec
clippy::useless_return 2021-06-13 09:35:29 +05:30
Maan2003
75370312fb
clippy::redundant_closure 2021-06-13 09:29:36 +05:30
Maan2003
705f7e6e26
clippy::clone_on_copy 2021-06-13 09:27:19 +05:30
Maan2003
6cc6dee9e9
clippy::useless_conversion 2021-06-13 09:25:55 +05:30
Maan2003
c9b4ac5be4
clippy::redudant_borrow 2021-06-13 09:24:16 +05:30
bors[bot]
d6737e55fb
Merge #9239
9239: fix: Fix coercion in match with expected type r=flodiebold a=flodiebold

Plus add infrastructure to test type mismatches without expect.

CC #8961

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2021-06-12 21:05:12 +00:00
Florian Diebold
20487a1b4a Fix coercion in match with expected type
Plus add infrastructure to test type mismatches without expect.
2021-06-12 23:04:43 +02:00
Aleksey Kladov
0463d76a1f internal: cross-crate cov-marks 2021-06-12 23:40:52 +03:00
bors[bot]
124123a53b
Merge #9237
9237: internal: move diagnostics infra to hir r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-06-12 19:05:58 +00:00
Aleksey Kladov
7731714578 internal: move diagnostics infra to hir 2021-06-12 22:05:23 +03:00
Kirill Bulatov
9c0b141dc9 Fix some typos in flyimport docs 2021-06-12 21:51:09 +03:00
bors[bot]
85d2cd331f
Merge #9233
9233: Move some hir_ty diagnostics to hir r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-06-12 18:01:00 +00:00
Aleksey Kladov
6940cfed1e Move some hir_ty diagnostics to hir 2021-06-12 21:00:22 +03:00
bors[bot]
10ca6b286c
Merge #9231
9231: minor: optimize r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-06-12 14:50:37 +00:00
Aleksey Kladov
6f0141a140 minor: optimize
We shouldn't be looking at the source map unless we actually have
diagnostics.
2021-06-12 17:49:41 +03:00
Aleksey Kladov
1b1e3de988 minor: reduce visibility 2021-06-12 17:41:47 +03:00
bors[bot]
f9e67d692d
Merge #9230
9230: internal: move inference diagnostics to hir r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-06-12 14:40:28 +00:00
Aleksey Kladov
0413d51317 internal: move missing unsafe diagnostic to hir 2021-06-12 17:39:46 +03:00
Aleksey Kladov
f8009666be internal: move inference diagnostics to hir 2021-06-12 17:17:23 +03:00
Aleksey Kladov
787d980c71 minor: squelch "unused" warning 2021-06-12 15:10:07 +03:00
bors[bot]
409f5fb563
Merge #9204
9204: feat: more accurate memory usage info on glibc Linux r=jonas-schievink a=jonas-schievink

This adds support for the new `mallinfo2` API added in glibc 2.33. It addresses a shortcoming in the `mallinfo` API where it was unable to handle memory usage of more than 2 GB, which we sometimes exceed.

Blocked on https://github.com/rust-lang/libc/pull/2228

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-06-11 22:00:23 +00:00
bors[bot]
72ea02869b
Merge #9223
9223: Complete associated types in dyn and impl trait r=Veykril a=Veykril

Fixes #9222
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-06-11 21:13:28 +00:00
Lukas Wirth
ec9ef9c283 Complete associated types in dyn and impl trait 2021-06-11 23:12:30 +02:00
Lukas Wirth
e09723f0af Highlight tuple field accesses correctly 2021-06-11 21:19:19 +02:00
bors[bot]
863e23f00f
Merge #9219
9219: minor: Replace some AssocItem::containing_trait calls trait_or_trait_impl r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-06-11 17:56:00 +00:00
Lukas Wirth
db4a1fcab4 Replace some AssocItem::containing_trait calls trait_or_trait_impl 2021-06-11 19:55:24 +02:00
bors[bot]
21d4416235
Merge #9218
9218: Item search now respects trait impl items r=Veykril a=Veykril

Fixes #2977

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-06-11 17:33:34 +00:00
Lukas Wirth
48f65b3b15 Item search now respects trait impl items 2021-06-11 19:24:52 +02:00
bors[bot]
6ac3e666b7
Merge #9217
9217: internal: Don't stringify and reparse `cfg_attr`-gated attributes r=jonas-schievink a=jonas-schievink

Bumps ungrammar to include https://github.com/rust-analyzer/ungrammar/pull/33

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-06-11 16:35:38 +00:00
Jonas Schievink
99d40e7a3a Don't stringify cfg_attr-gated attributes
This preserves the assigned `TokenId`s
2021-06-11 18:34:30 +02:00
Jonas Schievink
1d6eef1350 Update ungrammar 2021-06-11 18:34:30 +02:00
bors[bot]
5f69420ee3
Merge #9216
9216: fix: Don't allow lookup by self for unprefixed self access completions r=Veykril a=Veykril

Fixes #9211
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-06-11 16:27:42 +00:00
Lukas Wirth
4e588dfd88 Don't allow lookup by self for unprefixed self access completions 2021-06-11 18:26:52 +02:00
bors[bot]
80b3b74018
Merge #9215
9215: change visibility for use and macro items r=jonas-schievink a=Maan2003



Co-authored-by: Maan2003 <manmeetmann2003@gmail.com>
2021-06-11 14:10:22 +00:00
fee1-dead
7ad8cd8232
Fixed a small typo in comment 2021-06-11 22:01:34 +08:00
Maan2003
4c1a02288c
change visibility for use and macro items 2021-06-11 19:10:56 +05:30
bors[bot]
050232a37e
Merge #9192
9192: internal: Build test-macros in a build script r=jonas-schievink a=jonas-schievink

This build the test-proc-macros in `proc_macro_test` in a build script, and copies the artifact to `OUT_DIR`. This should make it available throughout all of rust-analyzer at no cost other than depending on `proc_macro_test`, fixing https://github.com/rust-analyzer/rust-analyzer/issues/9067.

This hopefully will let us later write inline tests that utilize proc macros, which makes my life fixing proc macro bugs easier.

Opening this as a sort of RFC, because I'm not totally sure this approach is the best.

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-06-11 10:44:07 +00:00
Maan2003
7f71000c12
Don't suggest Remove unused param in trait impls 2021-06-11 12:24:56 +05:30
Kirill Bulatov
339448157c Only prefill caches in the completion benchmark 2021-06-11 09:27:25 +03:00
Kirill Bulatov
b24f816c0d Fix visibility issues 2021-06-11 02:00:05 +03:00
Kirill Bulatov
ba65d259de Prime caches on workspace load 2021-06-11 02:00:03 +03:00
Kirill Bulatov
a6cdde0d0b Populate import maps eagerly 2021-06-11 01:27:20 +03:00
Kirill Bulatov
690cd95327 Reduce fst_path calls 2021-06-11 00:10:09 +03:00
Kirill Bulatov
3aaf07b8cb Add more profiling for flyimports 2021-06-10 23:43:46 +03:00
Jonas Schievink
35b18b2725 Add support for mallinfo2 on glibc Linux 2021-06-10 14:58:52 +02:00
bors[bot]
f4da4de7cd
Merge #9202
9202: feat: Make `MemoryUsage` work on Windows r=jonas-schievink a=jonas-schievink

Unfortunately there is no convenient API for heap statistics, so this instead uses the Commit Charge value, which is the amount of memory that needs to be allocated either in physical RAM or in the page file. This approximation seems to be good enough to find queries that waste a large amount of memory, but it should generally be expected to be off by several MB.

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-06-10 12:09:54 +00:00
Jonas Schievink
2c1ca98aba Make MemoryUsage work on Windows 2021-06-10 14:06:35 +02:00
Lukas Wirth
26c869ddc0 Don't classify attributes on macro-calls are the macro itself 2021-06-10 00:26:15 +02:00
bors[bot]
c6133fe51c
Merge #9195
9195: minor: Simplify r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-06-09 21:45:35 +00:00