Laurențiu Nicola
791f2a0bec
Bump smallvec
2022-07-03 10:09:35 +03:00
Laurențiu Nicola
e6fcb23445
Bump either
2022-07-03 10:09:35 +03:00
Lukas Wirth
531e152390
fix: Simplify macro statement expansion handling
2022-07-01 14:49:30 +02:00
bors
642084093a
Auto merge of #12634 - iDawer:match-check.witnesses, r=flodiebold
...
feat: Show witnesses of non-exhaustiveness in `missing-match-arm` diagnostic
Shamelessly copied from rustc. Thus reporting format is same.
This extends public api `hir::diagnostics::MissingMatchArms` with `uncovered_patterns: String` field. It does not expose data for implementing a quick fix yet.
-----
Worth to note: current implementation does not give a comprehensive list of missing patterns. Also mentioned in [paper](http://moscova.inria.fr/~maranget/papers/warn/warn.pdf ):
> One may think that algorithm I should make an additional effort to provide more
> non-matching values, by systematically computing recursive calls on specialized
> matrices when possible, and by returning a list of all pattern vectors returned by
> recursive calls. We can first observe that it is not possible in general to supply the
> users with all non-matching values, since the signature of integers is (potentially)
> infinite.
2022-06-30 14:51:58 +00:00
Florian Diebold
8b3ec12aac
fix: Report proc macro errors in expressions correctly as well
...
They didn't have a krate before, resulting in the generic "proc macro
not found" error.
Also improve error messages a bit more.
2022-06-28 10:43:22 +02:00
Lukas Wirth
bdbffdd463
fix: Fix completions for locals not working properly inside macro calls
2022-06-27 14:39:44 +02:00
bitgaoshu
0dbc091fee
add test for suggest_name
2022-06-25 17:33:27 +08:00
Florian Diebold
c80c34867f
Improve proc macro errors a bit
...
Distinguish between
- there is no build data (for some reason?)
- there is build data, but the cargo package didn't build a proc macro dylib
- there is a proc macro dylib, but it didn't contain the proc macro we expected
- the name did not resolve to any macro (this is now an
unresolved_macro_call even for attributes)
I changed the handling of disabled attribute macro expansion to
immediately ignore the macro and report an unresolved_proc_macro,
because otherwise they would now result in loud unresolved_macro_call
errors. I hope this doesn't break anything.
Also try to improve error ranges for unresolved_macro_call / macro_error
by reusing the code for unresolved_proc_macro. It's not perfect but
probably better than before.
2022-06-24 13:45:19 +02:00
bitgaoshu
6ecabe352a
functions resolve to impl
2022-06-24 19:11:35 +08:00
yue4u
472ae16bfb
fix: completes non exhaustive variant within the defining crate
2022-06-24 00:00:51 +09:00
Florian Diebold
29f01cd9d2
Various cleanups
...
- remove Valid, it serves no purpose and just obscures the diff
- rename some things
- don't use is_valid_candidate when searching for impl, it's not necessary
2022-06-23 14:38:28 +02:00
bitgaoshu
1ef5e14c2c
goto where trait method impl
2022-06-23 14:01:22 +02:00
Lukas Wirth
7a0774defa
internal: Simplify some completions
2022-06-20 21:55:33 +02:00
iDawer
4ff9bedbed
Display witnesses of non-exhaustive match
...
Reporting format follows rustc and shows at most three witnesses.
2022-06-20 15:48:09 +05:00
XFFXFF
6df969f5f4
the offset used for the completion cursor should always be relative to the original file and not to the marco file
2022-06-16 20:34:37 +08:00
XFFXFF
fbf8e12234
the scope of the return type is not the body of the function
2022-06-16 16:24:18 +08:00
Lukas Wirth
0e41d15b82
Use the correct crates proc-macro loading error message
2022-06-15 18:06:33 +02:00
Lukas Wirth
7d51fc4640
Show proc-macro loading errors in unresolved-proc-macro diagnostics
2022-06-15 17:34:01 +02:00
Lukas Wirth
325ceaef19
fix: Check for the correct proc-macro settings in missing proc-macro diagnostics
2022-06-14 11:00:06 +02:00
Lukas Wirth
0e4eb647f6
More precise proc-macro errors
2022-06-12 18:44:46 +02:00
Lukas Wirth
76ae5434fa
internal: Bump Dependencies
2022-06-10 17:30:02 +02:00
Nikita Podoliako
d98c04aac1
fix(ide-db): correct single-file module rename
2022-05-28 15:07:22 +03:00
Lukas Wirth
ad537be194
fix: When reference searching macro inputs, don't search everything that was downmapped
2022-05-23 16:09:56 +02:00
Jonas Schievink
52ff863abc
Teach Callable
about closures properly
2022-05-19 18:53:08 +02:00
Jonas Schievink
f1b6e45fba
Handle getters and setters in documentation template assist
2022-05-16 19:10:38 +02:00
Lukas Wirth
6b696fced8
feat: Add binding mode inlay hints
2022-05-14 14:58:35 +02:00
Jonas Schievink
7e45915aa4
Resolve assoc. types of supertraits in the IDE layer
2022-05-09 17:30:49 +02:00
Lukas Wirth
0ce620686c
fix: Fix snippets triggering where they shouldn't
2022-05-06 15:44:41 +02:00
Lukas Wirth
0c4e23b8ef
internal: Remove unqualified_path completions module
2022-05-05 22:21:42 +02:00
bors
0218aeba7a
Auto merge of #12150 - rainy-me:feat/fix-doc-url-links, r=rainy-me
...
fix: doc url link type
fix : #12033
I did some debugging and found the cause looks like to be some doc links' `LinkType` are kept as `Shortcut` which don't make sense for url links.
This PR should resolve both problems in the origin issue, but aside this PR, more work are needed for doc_links.
about `LinkType`: f29bd1e228/src/lib.rs (L191-L210)
2022-05-05 04:54:12 +00:00
rainy-me
5f4351fbb6
fix: doc url link type
2022-05-05 00:41:29 +09:00
Benjamin Coenen
6344eea242
improve the default constructor mode when filling fields
...
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2022-05-04 09:45:12 +02:00
Lukas Wirth
4f97950595
fix: Fix uncorrect use of double braces in HirDisplay implementations
2022-05-02 12:39:38 +02:00
Peh
1f011fa4a3
style: rename crates to kebab case
2022-05-01 10:48:58 +00:00
Jonas Schievink
fa42888e27
Diagnose unresolved derive macros
2022-04-27 20:03:57 +02:00
bitgaoshu
5d1aff3357
#11973 associated type is unresolved
2022-04-24 20:51:48 +08:00
iDawer
d26deb5b9f
Show impl Trait
in argument positon in completion details
...
`hir`: Use `db.callable_item_signature` query more.
2022-04-16 19:18:42 +05:00
iDawer
9d787e1bfe
Add hir::Function::async_ret_type
method
...
Adjust completion detail for `async fn` return types
2022-04-16 13:53:22 +05:00
iDawer
f972adc201
fix: comletion detail shows {unknown}
for impl Trait
in return position
2022-04-16 13:41:10 +05:00
bors
e10284a10c
Auto merge of #12003 - Veykril:hir-ty-simplify, r=Veykril
...
internal: Remove duplicated crate id field from hir::Type
2022-04-15 18:25:02 +00:00
Lukas Wirth
4b4a34327e
Remove duplicated crate id field from hir::Type
2022-04-15 20:14:35 +02:00
Lukas Wirth
58660dee2a
fix: Do reference search on all downmapped tokens with the same kind only
2022-04-15 19:42:48 +02:00
Lukas Wirth
295f0c57a5
Revert #11912 as it parses all visited files
2022-04-09 13:41:06 +02:00
Lukas Wirth
9050db2e80
fix: Don't create hir::Local
s from const path patterns
2022-04-09 01:08:13 +02:00
Lukas Wirth
15e7112da3
fix: Check whether a parameter can be converted to a local
2022-04-09 00:55:45 +02:00
Jonas Schievink
5d8b4c40eb
Determine function unsafety semantically
2022-04-07 18:33:03 +02:00
bors[bot]
12f803d1e3
Merge #11925
...
11925: internal: Add and use `HirFormatter::write_{str,char}` r=Veykril a=lnicola
Saves slightly over 3 KB of `text`, but comparing the total with that from two weeks ago in #11776 , this is a losing battle (we're 951 KB larger).
```
text data bss dec hex filename
24693512 1542704 4424 26240640 1906680 rust-analyzer-baseline
24690216 1542112 4424 26236752 1905750 rust-analyzer-pr
```
Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2022-04-07 14:38:46 +00:00
Laurențiu Nicola
bd570903b0
Add and use HirFormatter::write_{str,char}
2022-04-07 16:41:07 +03:00
Lukas Wirth
3632d5946f
minor: Remove pointless rebindings
2022-04-07 01:29:31 +02:00
Lukas Wirth
4a1423337f
fix: Attempt to resolve paths in const arguments heuristically
...
While we don't support const args in type inference yet, we can at least
make use of the fallback path resolution to resolve paths in const args
in the IDE layer to enable some features for them.
2022-04-06 20:24:24 +02:00
Lukas Wirth
7959c24876
fix: Fix path qualifiers not resolving generic type params when shadowed by trait
2022-04-06 19:38:45 +02:00
Jonas Schievink
872b7b9660
Wrap macros in expr position in MacroExpr
node
2022-04-05 17:43:34 +02:00
Lukas Wirth
c290e68ff9
internal: Remove PathResolution::AssocItem
2022-04-01 18:32:05 +02:00
Lukas Wirth
75689f2ad8
internal: Enforce Resolver to always have a module scope
2022-03-31 11:12:08 +02:00
Lukas Wirth
ef92453dfe
internal: Refactor FamousDefs builtin crate search
2022-03-30 22:23:54 +02:00
Florian Diebold
2be7e26d7d
Move mismatched-arg-count diagnostic to inference
2022-03-27 19:21:09 +02:00
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
Jonas Schievink
18ad750786
fix: properly import all types of macros with #[macro_use] again
2022-03-23 14:34:27 +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
Lukas Wirth
8e91bb7660
minor: Bump dependencies
2022-03-22 17:42:24 +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
2ef541b35f
Cleanups
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
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
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
37b48ceb8f
feat: Visualize compiler inserted reborrows via inlay hints
2022-03-20 14:38:16 +01:00
Jonas Schievink
0642724e94
Provide signature help when editing generic args
2022-03-18 19:59:41 +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
Florian Diebold
9ea2e0bd5b
Fixes for consts
2022-03-17 17:04: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
hkalbasi
b301b040f5
Add const generics
2022-03-14 14:38:37 +03:30
Matthias Krüger
56e4ea59d9
more clippy fixes:
...
clippy::match_like_matches_macro
clippy::to_string_in_format_args
clippy::single_char_add_str
clippy::filter_map_identity
clippy::clone_on_copy
clippy::useless_format
clippy::unused_unit
2022-03-12 16:50:49 +01:00
Matthias Krüger
21ffc5350d
fix clippy::redundant_clone
2022-03-12 16:50:49 +01:00
Matthias Krüger
d64d711db2
fix clippy::map_flatten
2022-03-12 16:50:49 +01:00
Matthias Krüger
62ed658311
fix clippy::useless_conversion
2022-03-12 16:50:49 +01:00
Matthias Krüger
7912e33ed6
fix clippy::needless_borrow
2022-03-12 16:50:49 +01:00
Lukas Wirth
301711ee71
internal: Remove ide_completion::render::build_ext module
2022-03-12 16:13:49 +01:00
Lukas Wirth
a9dd606387
fix: Show what file paths were expected for unresolved modules
2022-03-11 17:08:30 +01:00
Lukas Wirth
6c8c02f625
Don't parse source files to generate macro completion details
2022-03-10 22:21:58 +01:00
Lukas Wirth
2abe19e46a
Don't offer qualified path completions for buitlin derives
2022-03-10 21:22:13 +01:00
Lukas Wirth
a8b76b632c
Expand into pseudo-derive attribute expansions in completions
2022-03-10 20:53:50 +01:00
bors[bot]
4fcaefa62a
Merge #11660
...
11660: Insert dummy values for const generics in subst r=flodiebold a=HKalbasi
fix #11659
This is a band-aid until proper const generic support.
Co-authored-by: hkalbasi <hamidrezakalbasi@protonmail.com>
2022-03-09 17:18:03 +00:00
Lukas Wirth
2537ad0d9e
Simplify
2022-03-09 11:26:06 +01:00
Lukas Wirth
f9c8646d89
fix symbol index collection not collecting legacy macros
2022-03-09 01:44:20 +01:00
Lukas Wirth
4e94fb7028
Fix ProcMacroData recording wrong name for derives
2022-03-09 01:13:38 +01:00
Lukas Wirth
c37fe779c6
Add data queries for macros
2022-03-09 00:41:54 +01:00
Lukas Wirth
55ec93a337
Remove unnecessary macro_declarations from ItemScope
2022-03-09 00:19:53 +01:00
Lukas Wirth
c04b0f435b
Move hir to new MacroId
2022-03-08 23:51:48 +01:00
hkalbasi
1282178783
insert dummy values for const generics in subst
2022-03-09 02:02:42 +03:30
Lukas Wirth
93b09ca067
Update tidy ignore list
2022-03-06 19:18:40 +01:00
Lukas Wirth
c1f91c93b2
minor: Simplify
2022-03-06 17:56:02 +01:00