hkalbasi
01c1b3dc71
Fix panic in const eval and parameter destructing
2023-04-24 00:49:57 +03:30
jakhh8
f502169f1c
minor: use extra_args for fetching workspace
2023-04-23 21:19:40 +02:00
hkalbasi
232f293c19
Fix some typos in StructFlags
2023-04-23 21:55:47 +03:30
Ryo Yoshida
c6aea8c2f9
Minor refactorings
2023-04-24 02:19:08 +09:00
Lukas Wirth
cebc018e2a
Remove unnecessary is_derive field from MacroCallKind::Attr
2023-04-22 14:29:28 +02:00
bors
2feabc4dc4
Auto merge of #14622 - alibektas:make_ty_alias, r=alibektas
...
Add syntax::make::ty_alias
There was until now no function that returns TypeAlias. This commit introduces a func that is fully compliant with the Rust Reference. I had problems working with Ident so for now the function uses simple string manipulation until ast_from_text function is called. I am however open to any ideas that could replace ident param in such a way that it accepts syntax::ast::Ident
2023-04-22 11:43:42 +00:00
alibektas
e275f77b2c
Comment clean-up. Use display where possible
2023-04-22 13:23:52 +02:00
bors
5750d81e30
Auto merge of #14632 - Veykril:lru-macro, r=lnicola
...
internal: Increase LRU cache size for parse_expansion and macro_expand queries
2023-04-22 11:13:35 +00:00
bors
442a769f82
Auto merge of #14634 - Veykril:assoc-collect, r=Veykril
...
fix: Report remaining macro errors in assoc item collection
2023-04-22 09:49:57 +00:00
Lukas Wirth
77afc6e793
fix: Report remaining macro errors in assoc item collection
2023-04-22 11:49:00 +02:00
bors
34ebb30e84
Auto merge of #14610 - lowr:fix/hygiene-for-meta-item, r=Veykril
...
fix: Resolve `$crate` in derive paths
Paths in derive meta item list may contain any kind of paths, including those that start with `$crate` generated by macros. We need to take hygiene into account when we lower paths in the list.
This issue was identified while investigating #14607 , though this patch doesn't fix the broken trait resolution.
2023-04-22 09:36:38 +00:00
Lukas Wirth
6253fc031b
Increase LRU cache size for parse_expansion and macro_expand queries
2023-04-22 11:28:56 +02:00
Ryo Yoshida
85e76542fe
Cache Hygiene
in DefCollector
2023-04-22 18:22:29 +09:00
bors
6f43a56201
Auto merge of #14633 - Veykril:assoc-collect, r=Veykril
...
internal: Don't reparse files when trying to expand assoc item macro calls
2023-04-22 09:02:25 +00:00
Lukas Wirth
2aa44c8e37
internal: Don't reparse files when trying to expand assoc item macro calls
2023-04-22 11:02:11 +02:00
bors
1379b5fac7
Auto merge of #14630 - Veykril:arc, r=Veykril
...
internal: `Arc<String>` -> `Arc<str>`
2023-04-22 07:58:13 +00:00
Lukas Wirth
f2295cda42
Report vfs memory usage in status command
2023-04-22 09:57:48 +02:00
Lukas Wirth
f00dcf9a69
internal: Arc<String> -> Arc<str>
2023-04-22 09:48:37 +02:00
bors
11c55b2e27
Auto merge of #14629 - Veykril:stats, r=Veykril
...
internal: Add some additional status ouput
We should be able to use this infra to get a better grasp about what we might want to LRU
2023-04-22 07:35:29 +00:00
Lukas Wirth
63e3bf118d
internal: Add some additional status ouput
2023-04-22 09:34:47 +02:00
bors
779b891526
Auto merge of #14628 - Veykril:symbols, r=Veykril
...
internal: Restructure symbol queries a bit
2023-04-22 07:04:33 +00:00
Lukas Wirth
e7285507f6
Restructure symbol queries
2023-04-22 08:27:10 +02:00
Jake Heinz
a497e9a05e
mbe: fix token conversion for doc comments
2023-04-22 03:06:06 +00:00
alibektas
caa13b3f95
Small changes in str formatting
2023-04-21 22:09:11 +03:00
bors
af3b6a0893
Auto merge of #14621 - alibektas:make_impl_trait_fix, r=Veykril
...
Simple fix for make::impl_trait
This is my first PR in this project. I made this PR because I needed this function to work properly for the main PR I am working on (#14386 ). This is a small amendment to what it was before. We still need to improve this in order for it to fully comply with its syntactic definition as stated [here](https://doc.rust-lang.org/reference/items/implementations.html ).
2023-04-21 18:25:42 +00:00
alibektas
7c9e4e10bc
Add syntax::make::ty_alias
...
The function is fully compliant with the specifications from the Rust Reference.
2023-04-21 21:19:36 +03:00
alibektas
4601331ceb
Simple fix for make::impl_trait
2023-04-21 20:46:57 +03:00
hkalbasi
0c621065fb
Fix need-mut large span in closures and a false positive
2023-04-21 02:15:19 +03:30
bors
0289dfa261
Auto merge of #14599 - HKalbasi:dev2, r=HKalbasi
...
Detect sysroot dependencies using symlink copy
cc #7637
It is currently in a proof of concept stage, and it doesn't generates a copy. You need to provide your own sysroot copy in `/tmp/ra-sysroot-hack` in a way that `/tmp/ra-sysroot-hack/library/std/lib.rs` exists and `/tmp/ra-sysroot-hack/Cargo.toml` is [the one from this comment](https://github.com/rust-lang/rust-analyzer/issues/7637#issuecomment-1495008329 ). I will add the symlink code if we decide that this approach is not a dead end.
It seems to somehow work on my system. Go to definition into std dependencies works, type checking can look through fields if I make them public and `cfg_if` appears to work (I tested it by hovering both sides and seeing that the correct one is enabled). Though finding layout of `HashMap` didn't work.
Please try it and let me know if I should go forward in this direction or not.
2023-04-20 22:26:17 +00:00
hkalbasi
39715ce26f
Add RA_UNSTABLE_SYSROOT_HACK
2023-04-20 22:55:39 +03:30
Ryo Yoshida
cf72b6232b
Resolve $crate
in derive paths
2023-04-20 15:50:17 +09:00
bors
2400b36a2e
Auto merge of #14577 - jsoref:spelling, r=lnicola
...
Spelling
This PR corrects misspellings identified by the [check-spelling action](https://github.com/marketplace/actions/check-spelling ).
The misspellings have been reported at https://github.com/jsoref/rust-analyzer/actions/runs/4699991040#summary-12751355796
The action reports that the changes in this PR would make it happy: https://github.com/jsoref/rust-analyzer/actions/runs/4699991284#summary-12751356293
closes #14567
2023-04-19 14:05:40 +00:00
Josh Soref
bc7d84c3ce
Spelling
...
* a rule
* access
* after
* amount
* annotations
* assignment
* assist
* associated
* attribute
* borrowed
* built-in type
* clarification
* command
* const
* constructor
* corresponding
* counterparts
* curlies
* dependencies
* deterministic
* diagnostic
* duplicates
* edge
* edited
* efficient
* elsewhere
* execution
* expression
* extensions
* extracted
* fill
* github
* helper
* heuristic
* incomplete
* indent end
* inlay
* invocation
* lifetime
* looking
* maybe
* move
* mutability
* mutable
* necessarily
* necessary
* negative
* nonexistent
* occurred
* offsets
* offsetted
* overridden
* parameters
* params
* params_and_where_preds_in_scope
* paredit
* parent
* parentheses
* prepended if
* punctuation
* receive
* receiver
* referring
* repeated
* representing
* semantically
* separately
* shouldnot
* siblings
* similar
* something's
* statement
* struct
* structure
* surprise
* the
* this
* transparent
* unimplemented
* unnamed
* unnecessary
* unneeded
* unreachable
* unterminated
* utilities
* variant
* variants
* visibility
* work around (v)
* workaround
Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
2023-04-19 09:45:55 -04:00
bors
112464fd6b
Auto merge of #14604 - HKalbasi:dev3, r=Veykril
...
internal: Add minicore smoke test
fix #14501
2023-04-18 14:34:44 +00:00
hkalbasi
f05f7ab082
Add minicore smoke test
2023-04-18 17:38:38 +03:30
Lukas Wirth
9c408970ea
Deduplicate loaded projects
2023-04-18 14:27:01 +02:00
Lukas Wirth
f5f68e4dc7
Make workspace fields of config private
2023-04-18 13:25:54 +02:00
bors
9b835f334f
Auto merge of #14594 - Veykril:Simplify, r=Veykril
...
internal: Move Expander and LowerCtx into separate modules
2023-04-17 19:00:42 +00:00
Lukas Wirth
bca8029a6e
Move Expander and LowerCtx into separate modules
2023-04-17 20:44:06 +02:00
Ryo Yoshida
4db87f9346
Fix release channel detection
...
See bootstrap code in rust-lang/rust for versioning details: e49122fb1c/src/bootstrap/lib.rs (L1244)
2023-04-18 02:12:17 +09:00
Laurențiu Nicola
160ab88bb9
Bump bitflags
2023-04-17 18:42:59 +03:00
bors
5111207d9a
Auto merge of #14591 - justahero:gh-14516, r=Veykril
...
Restrict "sort items" assist for traits & impls
This restricts the "sort items alphabetically" assist when the selection is inside a `Impl` or `Trait` node & intersects with one of the associated items.
It re-orders the conditional checks of AST nodes in the `sort_items` function to check for more specific nodes first before checking `Trait` or `Impl` nodes. The `AssistContext` is passed into the `add_sort_methods_assist` function to check if the selection intersects with any inner items, e.g. associated const or type alias, function. In this case the assist does not apply.
Fixes : #14516
2023-04-17 12:45:31 +00:00
Sebastian Ziebell
c1712e55c6
Restrict "sort items" assist inside Impl & Trait
...
This fixes the applicability of the "sort items alphabetically" assist
when the selection is inside a `Trait` or `Impl`. It's now tested if the
selection is inside or overlaps with an inner node, e.g. associated
const or type alias, function.
2023-04-17 12:36:32 +02:00
bors
bab80dae44
Auto merge of #14588 - Veykril:macro-def-err, r=Veykril
...
fix: Actually bring back LRU limit for macro_expand query
2023-04-16 21:13:02 +00:00
Lukas Wirth
fd4bbcabe8
Actually bring back LRU limit for macro_expand query
2023-04-16 23:12:25 +02:00
bors
9b54e39762
Auto merge of #14587 - Veykril:macro-def-err, r=Veykril
...
fix: Bring back LRU limit for macro_expand query
Should fix the memory increase
2023-04-16 19:30:42 +00:00
Lukas Wirth
76718ea2fc
Bring back LRU limit for macro_expand query
2023-04-16 21:30:04 +02:00
bors
924d30a772
Auto merge of #14585 - Veykril:macro-def-err, r=Veykril
...
Make `ExpandDatabase::parse_macro_expansion` and `ExpandDatabase::parse_or_expand` infallible
2023-04-16 18:50:02 +00:00
Lukas Wirth
4ea5d7f6a0
Re-introduce option for macro_arg to prevent calling macros with empty inputs
2023-04-16 20:26:26 +02:00
bors
697b335fda
Auto merge of #14584 - Veykril:macro-def-err, r=Veykril
...
internal: Report item-level macro expansion syntax errors
2023-04-16 17:40:20 +00:00
Lukas Wirth
a2a3fecae3
Option begone part 2
2023-04-16 19:20:48 +02:00
Lukas Wirth
96a774261f
Option begone part 1
2023-04-16 19:20:42 +02:00
Lukas Wirth
0f4ffaa5af
Fix duplicate eager expansion errors
2023-04-16 19:20:35 +02:00
Lukas Wirth
d1632c2727
Report syntax errors from item level macro expansions
2023-04-16 17:22:06 +02:00
Lukas Wirth
71b50f9f09
Record eager expansion errors in EagerCallInfo
2023-04-16 16:11:59 +02:00
Lukas Wirth
6ae8d49e15
Simplify eager macro error handling
2023-04-16 15:46:12 +02:00
bors
f0a40c3a0e
Auto merge of #14583 - Veykril:macro-def-err, r=Veykril
...
internal: Report macro definition errors on the definition
We still report them on the call site as well for the time being, and the diagnostic doesn't know where the error in the definition comes from, but that can be done later on
2023-04-16 12:17:24 +00:00
Lukas Wirth
a5558cdfe5
internal: Report macro definition errors on the definition
2023-04-16 14:15:59 +02:00
bors
c0889589d1
Auto merge of #14581 - Veykril:layout-ty, r=Veykril
...
internal: Move layout logic from hir-def to hir-ty
2023-04-16 10:22:24 +00:00
Lukas Wirth
0bb9a17312
internal: Move layout logic from hir-def to hir-ty
2023-04-16 12:21:12 +02:00
Ryo Yoshida
83a93f4bd3
Parse inline const pattern in nested patterns
2023-04-16 04:28:37 +09:00
Ryo Yoshida
89a1439de3
Parse exclusive range pattern
2023-04-16 04:28:29 +09:00
bors
b218009f46
Auto merge of #14576 - HKalbasi:dev2, r=HKalbasi
...
Fix explicit deref problems in closure capture
fix the `need-mut` part of #14562
Perhaps surprisingly, it wasn't unique immutable borrow. The code still doesn't emit any of them, and I think those won't happen in edition 2021 (which is currently the only thing implemented), since we always capture `&mut *x` instead of `&mut x`. But I'm not very sure about it.
2023-04-14 13:23:49 +00:00
Laurențiu Nicola
febd5065ad
Make inherent_impls_in_block and trait_impls_in_block infallible
2023-04-14 16:03:45 +03:00
hkalbasi
7cb4318331
Fix explicit deref problems in closure capture
2023-04-14 15:32:40 +03:30
bors
96407424de
Auto merge of #14574 - Veykril:blocks, r=Veykril
...
internal: Make block_def_map infallible
2023-04-14 11:48:33 +00:00
Lukas Wirth
c32d51979d
internal: Make block_def_map infallible
2023-04-14 13:17:38 +02:00
bors
4667379f7e
Auto merge of #14575 - Veykril:attrs, r=Veykril
...
internal: Put Attrs behind a query instead of AttsWithOwner
We call this for pretty much every item, so this is unnecessary wasted memory
2023-04-14 11:17:18 +00:00
Lukas Wirth
ed3a5eac3c
internal: Put Attrs behind a query instead of AttsWithOwner
2023-04-14 12:47:33 +02:00
bors
1a331689d1
Auto merge of #14573 - Veykril:expr-scopes, r=Veykril
...
internal: Allocate ExprScopes ScopeEntries in a single arena instead of per ScopeData
2023-04-14 10:22:33 +00:00
Lukas Wirth
ce0896b78c
Allocate ExprScopes ScopeEntries in a single arena instead of per ScopeData
2023-04-14 12:05:11 +02:00
Lukas Wirth
9fb1b04826
Encode closing delimiter span in FlatTrees
2023-04-14 10:34:41 +02:00
Lukas Wirth
3c7b6716d1
fix: Fix inverted code lens resolve file version check
2023-04-14 08:41:53 +02:00
Jonas Schievink
901c8a4259
Map tokens from include!
expansion to the included file
2023-04-13 17:41:24 +02:00
bors
41ee5ca79d
Auto merge of #14559 - Veykril:version-code-lens, r=Veykril
...
internal: Skip code lens resolution for mismatched document versions
Closes https://github.com/rust-lang/rust-analyzer/issues/12718
2023-04-13 08:55:40 +00:00
Lukas Wirth
0286e46e5f
internal: Skip code lens resolution for mismatched document versions
2023-04-13 10:55:28 +02:00
bors
b093423d12
Auto merge of #14556 - Veykril:sysroot-no-core-warn, r=Veykril
...
internal: Warn when loading sysroot fails to find the core library
Should help a bit more with user experience, before we only logged this now we show it in the status
Closes https://github.com/rust-lang/rust-analyzer/issues/11606
2023-04-13 06:41:06 +00:00
Lukas Wirth
dd5c3c30b6
internal: Warn when loading sysroot fails to find the core library
2023-04-13 08:40:14 +02:00
Ryo Yoshida
c978d4bf0c
Implement text edits for inlay hints
2023-04-12 19:03:57 +09:00
Ryo Yoshida
fcbc250723
Add field for text edits to InlayHint
2023-04-12 19:03:55 +09:00
Ryo Yoshida
ac03de773f
Add flag to disallow opaque types for DisplayTarget::SourceCode
2023-04-12 19:03:48 +09:00
hecatia-elegua
398af0259f
Merge branch 'master' into alias-based-completion2
2023-04-11 21:14:52 +02:00
bors
7501d3b721
Auto merge of #14551 - lowr:patch/no-unstable-item-compl-on-stable, r=Veykril
...
Fix faulty variable extraction
Followup to #14549
Fixes https://github.com/rust-lang/rust-analyzer/pull/14549#discussion_r1163128814 and https://github.com/rust-lang/rust-analyzer/pull/14549#discussion_r1163132104
2023-04-11 17:43:15 +00:00
Ryo Yoshida
0a638676d1
Fix faulty variable extraction
2023-04-12 02:35:43 +09:00
bors
a1af8bb141
Auto merge of #14548 - Veykril:smol-str, r=Veykril
...
minor: Bump smol-str
2023-04-11 15:03:24 +00:00
bors
7afd2048f0
Auto merge of #14544 - HKalbasi:dev, r=Veykril
...
Infer types of nested RPITs
fix https://github.com/rust-lang/rust-analyzer/issues/14474#issuecomment-1501235394
2023-04-11 14:49:04 +00:00
bors
fd276218ec
Auto merge of #14549 - lowr:patch/no-unstable-item-compl-on-stable, r=Veykril
...
Don't suggest unstable items on stable toolchain
Closes #3020
This PR implements stability check in `ide-completion` so that unstable items are only suggested if you're on nightly toolchain.
It's a bit unfortunate `CompletionContext::check_stability()` is spammed all over the crate, but we should call it before building `CompletionItem` as you cannot get attributes on the item it's completing from that struct. I looked up every callsite of `Builder::add_to()`, `Completions::add[_opt]()`, and`Completions::add_all()` and inserted the check wherever necessary.
The tests are admittedly incomplete in that I didn't add tests for every kind of item as I thought that would be too big and not worthwhile. I copy-pasted some existing basic tests in every test module and adjusted them.
2023-04-11 14:34:47 +00:00
bors
600283f2de
Auto merge of #14550 - HKalbasi:mir, r=HKalbasi
...
Fix inference in nested closures
fix https://github.com/rust-lang/rust-analyzer/pull/14470#issuecomment-1503084796
2023-04-11 13:34:49 +00:00
hkalbasi
85f9235de8
fix inference in nested closure
2023-04-11 17:02:00 +03:30
Lukas Wirth
1456b53051
Bump smol-str
2023-04-11 14:39:19 +02:00
Ryo Yoshida
e6e48728da
Add tests for stability check in completion
2023-04-11 21:21:15 +09:00
Ryo Yoshida
0ce71dd76f
completion: check stability
2023-04-11 21:21:13 +09:00
Ryo Yoshida
584d2697cc
Add toolchain
meta for tests
2023-04-11 21:21:10 +09:00
bors
5d41affc77
Auto merge of #14547 - Veykril:extract_adjust, r=Veykril
...
fix: Fix receiver adjustments for extract_variable assist
2023-04-11 12:01:47 +00:00
Lukas Wirth
72d47144e8
fix: Fix receiver adjustments for extract_variable assist
2023-04-11 14:01:23 +02:00
bors
f9f443076a
Auto merge of #14540 - AmrDeveloper:disallow_extract_fun_single_brace, r=Veykril
...
Fix allow extracting function from single brace of block expression
Fix allow extracting function when selecting either `{` or `}`
Fix #14514
2023-04-11 10:10:25 +00:00
AmrDeveloper
5ded22065e
Make all kind of braces not applicable in function extraction
2023-04-11 11:22:52 +02:00
bors
fa3db447d7
Auto merge of #14536 - ClSlaid:feat/reorder-impl-items/not-applicative-editing-assoc-items, r=Veykril
...
fix: restrict applicable range of `reorder-impl-trait-items`
This PR should complete the need for restricting the applicable range of `reorder-impl-trait-items`.
When the cursor is in the associated items of the `impl` range, the assist will be disabled.
Fix : #14515
## Showcases
Note: If there is any available `code-action` (`ide-assist`) available, a lightbulb icon from `lspsaga` will show in the left.
- cursor in `impl` headers
![code action available](https://user-images.githubusercontent.com/44747719/230756854-7b236018-cfa8-4005-b589-2996ec42917f.png )
Code action is available. And it is reordering impl items.
![code action detail](https://user-images.githubusercontent.com/44747719/230756971-341c7fbc-f2ba-4715-a1e5-b1add984d4dd.png )
- cursor in `impl` associated items
![code action unavailable](
https://user-images.githubusercontent.com/44747719/230756906-bee7784e-bd9d-49b2-801b-743c94b4af54.png )
2023-04-11 07:36:42 +00:00
hkalbasi
a584cb998f
Infer types of nested RPITs
2023-04-11 04:32:11 +03:30
hkalbasi
59b6f2d9f2
Compute closure captures
2023-04-10 23:04:34 +03:30