bors[bot]
50225fe630
Merge #11869
...
11869: fix: code blocks with tilde also works like code block r=Veykril a=moreal
The `rustdoc` uses the `pulldown_cmark` package to parse *doc_comment* and the package also treat triple `~` characters also as code block fences. So when we run `cargo doc`, they will be placed also.
<img width="965" alt="image" src="https://user-images.githubusercontent.com/26626194/161208072-5a09a209-57fc-4a52-b190-b0a9be9ffcd6.png ">
But `rust-analyzer` doesn't support it so it doesn't have any injected code highlights and any `Run doctest` hint. This pull request tries to allow also them. 🙇🏻♂️
Before:
<img width="224" alt="image" src="https://user-images.githubusercontent.com/26626194/161207405-b1d6cfda-82b1-4f60-8e42-c51d0ed98f38.png ">
After:
<img width="161" alt="image" src="https://user-images.githubusercontent.com/26626194/161207693-8e39997c-9ca6-4e69-8c65-e9b70899f7db.png ">
Co-authored-by: Lee Dogeon <dev.moreal@gmail.com>
2022-04-01 12:40:51 +00:00
Lee Dogeon
e3f32d13e1
Code blocks with tilde also works like code block
2022-04-01 20:29:32 +09:00
Jake Vossen
bccf013010
create generate is, as, try_into group
2022-03-31 21:22:08 -06:00
Felix Maurer
feb8ccacba
Add test against line number underflow
2022-03-31 23:37:23 +02:00
Felix Maurer
a98ffe4268
Prevent underflow when converting line numbers
...
Previously, when line numbers of Rust spans were converted to LSP
ranges, they could underflow resulting in very large line numbers. As
an underflow is always wrong, prevent it and use 0 instead.
2022-03-31 23:00:48 +02:00
Jonas Bushart
c039810b16
Fix: Select correct insert position for disabled group import
...
The logic for importing with and without `group_imports` differed
significantly when no previous group existed. This lead to the problem
of using the wrong position when importing inside a module (#11585 ) or
when inner attributes are involved.
The existing code for grouped imports is better and takes these things
into account.
This PR changes the flow to use the pre-existing code for adding a new
import group even for the non-grouped import settings.
Some coverage markers are updated and the `group` is removed, since they
are now invoked in both cases (grouping and no grouping).
Tests are updated and two tests (empty module and inner attribute) are
added.
Fixes #11585
2022-03-31 18:15:01 +00:00
Jonas Schievink
42ecf406e8
Remove parser restriction on varargs positioning
2022-03-31 16:03:27 +02:00
bors[bot]
9b000b544b
Merge #11827
...
11827: internal: Enforce Invariant that Resolver always contains a ModuleScope r=Veykril a=Veykril
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-03-31 13:01:10 +00:00
Jonas Schievink
ec2d023383
Add "view file text" command to debug sync issues
2022-03-31 14:50:33 +02:00
Lukas Wirth
75689f2ad8
internal: Enforce Resolver to always have a module scope
2022-03-31 11:12:08 +02:00
Aleksei Trifonov
41d8369d1c
Fix formatting
2022-03-31 02:59:15 +03:00
Aleksei Trifonov
0d1f4f9b27
Lower postfix suggestions in completions list
2022-03-31 02:27:33 +03:00
Lukas Wirth
ef92453dfe
internal: Refactor FamousDefs builtin crate search
2022-03-30 22:23:54 +02:00
Manas
1be8b2ff98
Type mismatch when last expression is noreturn asm
...
When last expression in a function body is noreturn asm, then analyzer
complains about the type mismatch by highlighting entire body. This
fixes it by introducing loop {} in the expanded code.
2022-03-30 19:07:02 +05:30
Gibson Fahnestock
6b38c2d75e
docs(auto_import): change by_self -> self and by_crate -> crate
...
Keep things consistent with the package.json , which uses `self` and
`crate` instead of `by_self` and `by_crate`. Both names are in fact
allowed as aliases, but we should be consistent so that people reading
the docs and using a schema do not see red squiggles.
2022-03-30 12:33:07 +01:00
Florian Diebold
ea1d0bccef
Fix divergence detection for bare match arms
...
Fixes #11814 and #11837 .
2022-03-29 21:56:49 +02:00
Florian Diebold
0c4bdd2f32
Fix duplicate type mismatches with blocks
...
E.g. when there's a type mismatch on the return value of a function. To
fix this, we have to return the expected type as the type of the block
when there's a mismatch. That meant some IDE code that expected
otherwise had to be adapted, in particular the "add return type" assist.
For the "wrap in Ok/Some" quickfix, this sadly means it usually can't be applied
in all branches of an if expression at the same time anymore, because
there's a type mismatch for each branch that has the wrong type.
2022-03-29 18:06:52 +02:00
bors[bot]
89d495eb30
Merge #11840
...
11840: Fix another const generic panic r=flodiebold a=HKalbasi
fix #11835
If I change `dyn` to `impl` in the test, it will infer the type as `IntoIterator::Item<impl Iterator<Item = [Ar<u8, 7>; 9]> + ?Sized>` instead of `[Ar<u8, 7>; 9]`. Maybe it needs some action?
Co-authored-by: hkalbasi <hamidrezakalbasi@protonmail.com>
2022-03-29 10:55:17 +00:00
hkalbasi
4fe0545bb6
fix regression_11688_3
2022-03-29 11:03:55 +04:30
Florian Diebold
c2a31bfbb8
Remove legacy_const_generics_indices from CallableSig
...
I want to remove CallableSig anyway, and it's not needed anymore.
2022-03-27 19:21:09 +02:00
Florian Diebold
2be7e26d7d
Move mismatched-arg-count diagnostic to inference
2022-03-27 19:21:09 +02:00
Florian Diebold
9a427839fa
fix: Disable ref_match for qualified paths as well
...
I.e. don't suggest `Foo::&foo()`.
CC #8058 .
2022-03-27 12:50:55 +02:00
Laurențiu Nicola
85f797f59c
Bump chalk
2022-03-27 10:11:02 +03:00
bors[bot]
4d05d29fad
Merge #11825
...
11825: fix: Don't complete `Drop::drop` for qualified paths r=Veykril a=Veykril
bors r+
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-03-26 18:49:41 +00:00
Laurențiu Nicola
03cb7d9448
Revert "Emit #[must_use] in Generate new assist"
...
This reverts commit 7e05e10495
.
2022-03-26 20:39:36 +02:00
Lukas Wirth
0ae795136d
Sort runnable test results to make them deterministic
2022-03-26 19:38:20 +01:00
Lukas Wirth
9b046d1051
fix: Don't complete Drop::drop for qualified paths
2022-03-26 18:46:49 +01:00
Lukas Wirth
e55ed52003
Simplify
2022-03-26 18:37:40 +01:00
bors[bot]
e30747dfa8
Merge #11793
...
11793: LSIF: consolidate references into a single edge where possible. r=Veykril a=khuey
Co-authored-by: Kyle Huey <khuey@kylehuey.com>
2022-03-25 22:46:15 +00:00
bors[bot]
68dfda6e48
Merge #11817
...
11817: minor: fix comment r=jonas-schievink a=jonas-schievink
bors r+
Co-authored-by: Jonas Schievink <jonas.schievink@ferrous-systems.com>
2022-03-25 15:26:10 +00:00
bors[bot]
903d3bc4f7
Merge #11809
...
11809: feat: disable experimental diagnostics by default r=jonas-schievink a=jonas-schievink
Now that we diagnose type mismatches, we have another diagnostic that can potentially produce false positives, so let's disable experimental diagnostics by default.
Co-authored-by: Jonas Schievink <jonas.schievink@ferrous-systems.com>
2022-03-25 15:11:56 +00:00
Jonas Schievink
755aaf6feb
fix comment
2022-03-25 15:30:52 +01:00
Jonas Schievink
ea0325b2da
Rename the 1.47 ABI to 1.48
2022-03-24 18:26:10 +01:00
Jonas Schievink
44a99d6e49
Disable experimental diagnostics by default
2022-03-24 17:00:17 +01:00
hkalbasi
bf4a1e4842
use pat_id instead of name in const eval stack
2022-03-24 13:36:37 +04:30
hkalbasi
22eaee25b8
organize const eval tests
2022-03-24 13:20:35 +04:30
hkalbasi
0e2989e421
Support constants in const eval
2022-03-24 13:09:22 +04:30
bors[bot]
b8e1d09b90
Merge #11806
...
11806: fix: Fix async block type inference using containing function return type r=Veykril a=Veykril
Fixes https://github.com/rust-analyzer/rust-analyzer/issues/11804
Should fix https://github.com/rust-analyzer/rust-analyzer/issues/11798#issuecomment-1076880521
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-03-23 22:45:44 +00:00
Lukas Wirth
ed0c62597f
fix: Fix async block type inference using containing function return type
2022-03-23 23:43:04 +01:00
bors[bot]
15fdb95183
Merge #11802
...
11802: fix: add stubs to make proc macros work that use the `SourceFile` API r=jonas-schievink a=jonas-schievink
Helps with the rocket 0.4 macros, at least on some Rust versions.
Fixes https://github.com/rust-analyzer/rust-analyzer/issues/11264
bors r+
Co-authored-by: Jonas Schievink <jonas.schievink@ferrous-systems.com>
2022-03-23 20:58:45 +00:00
bors[bot]
75fada4aab
Merge #11805
...
11805: fix: Don't try to resolve methods on unknown types r=Veykril a=flodiebold
Fixes #10454 , and some type mismatches.
Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2022-03-23 20:20:09 +00:00
Florian Diebold
e0e6bfb924
Fix filter_map in minicore
2022-03-23 19:47:11 +01:00
Florian Diebold
fa923f9b19
Adjust value in syntax highlighting benchmark
2022-03-23 19:28:01 +01:00
Florian Diebold
8d98f3c983
Don't try to resolve methods on unknown types
...
Fixes #10454 , and some type mismatches.
2022-03-23 19:18:12 +01:00
Jonas Schievink
ef8365b1ae
Stub out SourceFile
related proc macro functions
2022-03-23 16:11:05 +01:00
Jonas Schievink
1e2a4c1bdb
Return the first span from Span::join
2022-03-23 15:09:39 +01:00
Jonas Schievink
18ad750786
fix: properly import all types of macros with #[macro_use] again
2022-03-23 14:34:27 +01:00
Waffle Maybe
c8762a17fd
Fix typo in abi_1_57/mod.rs
comment
2022-03-23 16:48:25 +04:00
Jonas Schievink
40856f01a1
Introduce new fixed proc macro ABI for 1.57.0
2022-03-23 12:20:00 +01:00
bors[bot]
652233283b
Merge #11791
...
11791: fix: some fixes and improvements to signature help r=jonas-schievink a=jonas-schievink
bors r+
Co-authored-by: Jonas Schievink <jonas.schievink@ferrous-systems.com>
2022-03-23 00:36:11 +00:00
bors[bot]
c2ea378920
Merge #11795
...
11795: fix: Correctly suggest auto importing traits from aliases r=Veykril a=unexge
Fixes https://github.com/rust-analyzer/rust-analyzer/issues/11506
Co-authored-by: unexge <unexge@gmail.com>
2022-03-22 21:44:06 +00:00
unexge
4e4c9ea4ac
fix: Correctly suggest auto importing traits from aliases
2022-03-22 22:30:29 +01:00
bors[bot]
1a92ee5db5
Merge #11792
...
11792: minor: Bump dependencies r=Veykril a=Veykril
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-03-22 21:00:24 +00:00
Kyle Huey
af1aa86ac0
Preserve order when grouping references.
2022-03-22 12:38:59 -07:00
Kyle Huey
0583919919
LSIF: consolidate references into a single edge where possible.
2022-03-22 12:00:52 -07:00
Lukas Wirth
8e91bb7660
minor: Bump dependencies
2022-03-22 17:42:24 +01:00
Jonas Schievink
4e07864f59
signature help: skip lifetimes when non-lifetime arguments are present
2022-03-22 16:44:27 +01:00
bors[bot]
f1dbc2acd4
Merge #11789
...
11789: fix: Fix lifetime elision hint configuration key r=Veykril a=Veykril
This is inconsistent with the other configuration keys unfortunately, but this is an issue of how we structured them here in general.
I feel like we'll have to do a proper pass over all the configs, check them for consistency and then write down some documentation of how our configs should be laid out, then apply fixes to the inconsistencies all at once which will entail breaking some user configurations unfortunately since we won't be able to do proper fallback handling for some of these.
Fixes https://github.com/rust-analyzer/rust-analyzer/issues/11778
bors r+
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-03-22 15:31:45 +00:00
Lukas Wirth
ecf2c98859
fix: Fix lifetime elision hint configuration key
2022-03-22 16:28:36 +01:00
bors[bot]
800ae516db
Merge #11788
...
11788: internal: Improve `find_path` and extern prelude handling r=Veykril a=Veykril
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-03-22 15:17:50 +00:00
Jonas Schievink
b7cc9a7275
Trigger call info when completing generic type
...
Closes #11763
2022-03-22 16:10:17 +01:00
Jonas Schievink
4bb5df0ce5
Avoid signature help inside multiline expressions
...
Fixes #11768
2022-03-22 16:08:46 +01:00
bors[bot]
98d1724cb0
Merge #11786
...
11786: fix: fill_match_arms doesn't add wildcard pat for local enums r=Veykril a=OleStrohm
Fix #11783
This adds similar logic to non_exhaustive as is currently on doc(hidden)
Co-authored-by: Ole Strohm <strohm99@gmail.com>
2022-03-22 14:58:17 +00:00
Lukas Wirth
cb1b7e18fe
internal: Improve find_path
and extern prelude handling
2022-03-22 15:54:46 +01:00
Jonas Schievink
c9cefb9916
Improve readability of signature help tests
2022-03-22 15:03:19 +01:00
Ole Strohm
b3bd547dda
applied rustfmt
2022-03-22 11:10:48 +00:00
Ole Strohm
94113b0ac6
fix: fill_match_arms doesn't add wildcard pat for local enums
2022-03-22 10:56:20 +00:00
bors[bot]
5d2cd18765
Merge #11780
...
11780: feat: Add type mismatch diagnostic r=flodiebold a=flodiebold
This adds a proper diagnostic for type mismatches, turning "Add reference here", "Missing Ok or Some" and "Remove this semicolon" into quickfixes for this single diagnostic.
The diagnostic is marked as experimental when it does not have one of these quickfixes, so it can be turned off with `rust-analyzer.diagnostics.enableExperimental` (or specifically with `rust-analyzer.diagnostics.disabled` of course, the ID is `type-mismatch`).
There will still be some false positives, but I think there shouldn't be too many especially when the Chalk fix lands, and it's still experimental anyway 🙂
This also fixes type checking for `rustc_legacy_const_generics` just to avoid some errors in tests.
Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2022-03-22 10:40:23 +00:00
Lukas Wirth
000e681d5f
fix: Fix tuple- and record struct completions not working with existing braces
2022-03-21 22:01:26 +01:00
Lukas Wirth
7370a6b5b8
fix: Fix flyimport showing functions in pattern position
2022-03-21 19:41:39 +01:00
Florian Diebold
3bdb68d80f
Clean up commented-out lines
2022-03-21 19:16:58 +01:00
Florian Diebold
5f24ff0d84
Fix unreachable_pub
2022-03-21 18:54:20 +01:00
Florian Diebold
344cf1db5f
Fix expect
2022-03-21 17:00:03 +01:00
Florian Diebold
baa43a86ab
Add a FIXME
2022-03-21 16:49:01 +01:00
Florian Diebold
8498eaa6ab
Implement type checking for legacy_const_generics
2022-03-21 16:46:01 +01:00
Florian Diebold
2ef541b35f
Cleanups
2022-03-21 16:46:01 +01:00
Florian Diebold
b632d706c7
Remove old diagnostics
2022-03-21 16:46:01 +01:00
Florian Diebold
a49a0ab883
Add 'remove this semicolon'
2022-03-21 16:46:01 +01:00
Florian Diebold
0689fdb650
Add "add missing Ok/Some" fix
2022-03-21 16:46:01 +01:00
Florian Diebold
ab3313b1cb
Add new type-mismatch diagnostic
2022-03-21 16:46:01 +01:00
Florian Diebold
2d30dd67d3
Expose coercion logic in hir API
2022-03-21 16:45:59 +01:00
Florian Diebold
6133e6a002
Extract coercion logic to InferenceTable
...
To make it accessible without an InferenceContext.
2022-03-21 16:45:30 +01:00
Laurențiu Nicola
1a37b17162
Replace write! with direct calls
2022-03-21 10:43:36 +02:00
bors[bot]
b594f9c441
Merge #11690
...
11690: feat: Add an assist for inlining type aliases r=Veykril a=steven-joruk
I'm working towards implementing #10881 , but I'd like to get this in first with earlier feedback.
Is `inline_type_alias` a good enough name? I guess the follow up assist would be called `inline_type_alias_into_all_users` based on that.
![valid_inlines](https://user-images.githubusercontent.com/1277939/158020510-fed78b5c-4c7e-46d1-9151-3044a29b9990.gif )
![invalid_inlines](https://user-images.githubusercontent.com/1277939/158020516-8a2deb6d-c6ec-4adf-a15b-c514fc97dc43.gif )
Co-authored-by: Steven Joruk <steven@joruk.com>
2022-03-20 21:15:49 +00:00
Steven Joruk
1381a2de23
refactor: Do more work in inline_type_alias closure
2022-03-20 20:53:03 +00:00
bors[bot]
6f2b118605
Merge #11775
...
11775: internal: Treat `global_asm` and `asm` macros as unsafe r=Veykril a=Veykril
bors r+
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-03-20 18:31:27 +00:00
Lukas Wirth
ddf144051a
internal: Treat {global_}asm macros as unsafe
2022-03-20 19:31:00 +01:00
bors[bot]
fedf724d82
Merge #11774
...
11774: feat: Tag macro calls as unsafe if they expand to unsafe expressions r=Veykril a=Veykril
as long as they aren't inside an unsafe block inside the macro that is.
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-03-20 18:15:29 +00:00
Lukas Wirth
3b7b223b25
Simplify
2022-03-20 19:13:50 +01:00
Lukas Wirth
68de7b30e0
feat: Tag macro calls as unsafe if they expand to unsafe expressions
2022-03-20 19:07:44 +01:00
bors[bot]
966b692422
Merge #11771
...
11771: feat: Visualize compiler inserted reborrows via inlay hints r=Veykril a=Veykril
Disabled by default.
![image](https://user-images.githubusercontent.com/3757771/159165178-baaf968a-4381-468e-933f-5326ca1b203d.png )
Closes https://github.com/rust-analyzer/rust-analyzer/issues/11275
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-03-20 13:47:16 +00:00
Lukas Wirth
5a87f09a71
Update inlay hint feature docs
2022-03-20 14:41:27 +01:00
Lukas Wirth
37b48ceb8f
feat: Visualize compiler inserted reborrows via inlay hints
2022-03-20 14:38:16 +01:00
bors[bot]
a82caff588
Merge #11765
...
11765: fix: Fix closure hints using macro ranges r=Veykril a=Veykril
bors r+
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-03-19 19:26:34 +00:00
Lukas Wirth
2598575a35
fix: Fix closure hints using macro ranges
2022-03-19 20:24:09 +01:00
bors[bot]
7315d97347
Merge #11755
...
11755: feat: Implement lifetime elision hints r=Veykril a=Veykril
With names on:
![Code_erl26zKvuf](https://user-images.githubusercontent.com/3757771/159134856-e2c75d2d-f17c-45c7-9a78-3da5ee8b1acd.png )
With names off:
![Code_MRP1Pbfe9d](https://user-images.githubusercontent.com/3757771/159134857-30fac3a1-825e-4f49-ba9b-9fa0bb215694.png )
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-03-19 19:15:06 +00:00
Lukas Wirth
7da5b80f25
Change skip trivial behaviour
2022-03-19 20:12:14 +01:00
Lukas Wirth
7ab0aaa82a
Add option to skip trivial cases
2022-03-19 19:01:19 +01:00
Lukas Wirth
45756c823f
Use numbers for lifetimes by default, add setting to prefer using parameter names
2022-03-19 18:11:56 +01:00
Jonas Schievink
55d2a25123
Rename call info to "signature help"
...
It is no longer limited to just calls
2022-03-18 20:19:35 +01:00
Jonas Schievink
0642724e94
Provide signature help when editing generic args
2022-03-18 19:59:41 +01:00
Lukas Wirth
c22fed895e
Fix test fixtures
2022-03-18 18:57:15 +01:00
Lukas Wirth
b634d99361
Give the lifetimes better names
2022-03-18 18:55:03 +01:00
Lukas Wirth
673e2b1d8f
feat: Implement lifetime elision hints
2022-03-18 18:11:16 +01:00
bors[bot]
e3217c5015
Merge #11752
...
11752: internal: Allow explicitly specifying end of fixture annotation r=Veykril a=Veykril
bors r+
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-03-18 16:38:32 +00:00
Lukas Wirth
890f98f21f
internal: Allow explicitly specifying end of fixture annotation
2022-03-18 15:42:19 +01:00
Jonas Schievink
14203c6378
Complete assoc const patterns on builtin types
2022-03-18 15:36:18 +01:00
bors[bot]
849ac25f05
Merge #11713
...
11713: Complete associated consts in patterns r=jonas-schievink a=hi-rustin
Try close https://github.com/rust-analyzer/rust-analyzer/issues/11555
Co-authored-by: hi-rustin <rustin.liu@gmail.com>
Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2022-03-18 13:54:09 +00:00
Jonas Schievink
e7564086f4
Update crates/ide_completion/src/tests/pattern.rs
2022-03-18 14:53:44 +01:00
bors[bot]
6ad8c022ed
Merge #11750
...
11750: fix: Fix runnables trying to add doc tests in the crate root from #[macro_export] macros r=Veykril a=Veykril
Fixes https://github.com/rust-analyzer/rust-analyzer/issues/11746
bors r+
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-03-18 11:13:37 +00:00
Lukas Wirth
828196be3b
fix: Fix runnables trying to add doc tests in the crate root from #[macro_export] macros
2022-03-18 12:01:59 +01:00
Laurențiu Nicola
86b1ef9ab2
Bump deps
2022-03-17 19:24:37 +02:00
Florian Diebold
60aeb8fa1a
Move fallback_bound_vars to the only place it's used now
2022-03-17 17:08:43 +01:00
Florian Diebold
9ea2e0bd5b
Fixes for consts
2022-03-17 17:04:32 +01:00
Florian Diebold
59b5696aaa
Snapshot obligations
2022-03-17 17:04:32 +01:00
Florian Diebold
8f5b6ac556
Properly try unifying the receivers during method resolution
...
Instead of hackily checking if they're equal.
2022-03-17 17:03:54 +01:00
hi-rustin
bc8665e14d
Fix typo
...
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2022-03-17 22:59:47 +08:00
Florian Diebold
1b71cd074d
Add test for DynMap type inference
2022-03-17 15:44:14 +01:00
hi-rustin
2bc545d9ef
Match the enum and union
...
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2022-03-17 21:38:21 +08:00
bors[bot]
631b504991
Merge #11741
...
11741: Emit #[must_use] in Generate enum is_variant assist r=lnicola a=lnicola
bors r+
Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2022-03-17 13:23:22 +00:00
bors[bot]
0a18e4355a
Merge #11740
...
11740: Insert #[must_use] in generate_is_empty_from_len r=lnicola a=Walther
Inserts `#[must_use]` for the generated `is_empty` methods. I also added the `#[must_use]` for the `len()` methods in the documentation examples and tests for this generator while at it, to make sure they too encourage the use of the annotation.
From discussion in https://github.com/rust-analyzer/rust-analyzer/issues/11736 and https://github.com/rust-analyzer/rust-analyzer/pull/11738
Co-authored-by: Walther <veeti.haapsamo@gmail.com>
2022-03-17 13:14:26 +00:00
Laurențiu Nicola
de53232ada
Emit #[must_use] in Generate enum is_variant assist
2022-03-17 15:10:25 +02:00
Walther
217b30568e
Insert #[must_use] in generate_is_empty_from_len
2022-03-17 15:03:02 +02:00
bors[bot]
502e30e676
Merge #11737 #11739
...
11737: Emit `#[must_use]` in `Generate new` assist r=lnicola a=lnicola
Closes #11736
11739: Insert #[must_use] in generate_getter r=lnicola a=Walther
Inserts `#[must_use]` for the generated getter methods.
From discussion in https://github.com/rust-analyzer/rust-analyzer/issues/11736 and https://github.com/rust-analyzer/rust-analyzer/pull/11738
Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
Co-authored-by: Walther <veeti.haapsamo@gmail.com>
2022-03-17 12:58:14 +00:00
Walther
e5adbd88e9
Insert #[must_use] in generate_getter
2022-03-17 14:49:22 +02:00
hi-rustin
c6ef4e830e
Fix the wrong path resolution
...
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2022-03-17 20:39:04 +08:00
hi-rustin
a9aae250ed
Add completes_associated_const test
...
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2022-03-17 20:39:00 +08:00
hi-rustin
37d0c722ef
Complete associated consts in patterns
...
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2022-03-17 20:35:04 +08:00
Laurențiu Nicola
7e05e10495
Emit #[must_use] in Generate new assist
2022-03-17 14:21:42 +02:00
hkalbasi
0141f28475
fix regression_11688_2
2022-03-17 12:47:31 +03:30
bors[bot]
3bff42fd14
Merge #11734
...
11734: internal: Bump `xshell` and fix `dist` r=lnicola a=lnicola
bors r+
Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2022-03-17 06:54:27 +00:00
Laurențiu Nicola
be6d5001e4
Bump xshell and fix dist
2022-03-17 08:53:33 +02:00
bors[bot]
b3cfa1986b
Merge #11731
...
11731: feat: Add return type hints for closures with block bodies r=Veykril a=Veykril
Fixes https://github.com/rust-analyzer/rust-analyzer/issues/11386
bors r+
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-03-16 20:31:47 +00:00
Lukas Wirth
bd17933c31
feat: Add return type hints for closures with block bodies
2022-03-16 21:25:03 +01:00
bors[bot]
a57fee6b6f
Merge #11694
...
11694: fix: "Extract to function" assist preserves `break` and `continue` labels r=Veykril a=m0rg-dev
Adds a label / lifetime parameter to `ide_assists::handlers::extract_function::FlowKind::{Break, Continue}`, adds support for emitting labels to `syntax::ast::make::{expr_break, expr_continue}`, and implements the required machinery to let `extract_function` make use of them.
This does modify the external API of the `syntax` crate, but the changes there are simple, not used outside `ide_assists`, and, well, we should probably support emitting `break` and `continue` labels through `syntax` anyways, they're part of the language spec.
Closes #11413 .
Co-authored-by: Morgan Thomas <corp@m0rg.dev>
2022-03-16 16:35:34 +00:00
Lukas Wirth
a40a847d77
Revert omitting field completions
2022-03-16 16:41:35 +01:00
Lukas Wirth
c1f6f135e1
Remove code duplication
2022-03-16 16:32:36 +01:00
Lukas Wirth
02b401b130
Simplify completion render functionality
2022-03-16 16:27:55 +01:00
Lukas Wirth
4fe5f03c7f
Rename compound things to variant things
2022-03-16 13:41:47 +01:00
Laurențiu Nicola
620411df80
Mark chaining hints as types, since that's what they are
2022-03-16 07:46:09 +02:00
bors[bot]
fb9e66d9fc
Merge #11718
...
11718: Fix const generic panic r=lnicola a=HKalbasi
fix https://github.com/rust-analyzer/rust-analyzer/pull/11688#issuecomment-1066824954
Co-authored-by: hkalbasi <hamidrezakalbasi@protonmail.com>
2022-03-15 20:27:51 +00:00
hkalbasi
1f3d18718c
fix const generic panic
2022-03-15 22:34:05 +03:30
bors[bot]
61b1449387
Merge #11714
...
11714: fix: Fix completions not always working in for-loop patterns r=Veykril a=Veykril
Fixes https://github.com/rust-analyzer/rust-analyzer/issues/11205
bors r+
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-03-15 17:58:21 +00:00
Lukas Wirth
d5f8d91872
fix: Fix completions not always working in for-loop patterns
2022-03-15 18:46:32 +01:00
bors[bot]
683fea4de4
Merge #11707
...
11707: minor: Simplify r=Veykril a=Veykril
bors r+
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-03-14 20:05:46 +00:00
Lukas Wirth
fbc1d2a514
Simplify
2022-03-14 20:36:35 +01:00
bors[bot]
83575c96ed
Merge #11700
...
11700: ⬆️ xshell r=matklad a=matklad
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2022-03-14 15:02:34 +00:00
Aleksey Kladov
56e43c34e7
⬆️ xshell
2022-03-14 14:57:24 +00:00
hkalbasi
b301b040f5
Add const generics
2022-03-14 14:38:37 +03:30
Steven Joruk
1981a3dc65
test: Make imported_external test that the full path is replaced
2022-03-13 13:25:06 +00:00