about summary refs log tree commit diff
path: root/src/tools/rust-analyzer/crates
AgeCommit message (Collapse)AuthorLines
2024-06-02Auto merge of #17328 - Veykril:derive-helper-completions, r=Veykrilbors-98/+209
feat: Enable completions within derive helper attributes ![Code_zG5qInoQ6B](https://github.com/rust-lang/rust-analyzer/assets/3757771/db30b98d-4981-45e3-83a5-7ff23fbd3f66)
2024-06-02feat: Enable completions within derive helper attributesLukas Wirth-98/+209
2024-06-01Auto merge of #17326 - Veykril:fix-attr-derive-container, r=Veykrilbors-40/+48
fix: Fix container search failing for tokens originating within derive attributes
2024-06-01fix: Fix container search failing for tokens originating within derive ↵Lukas Wirth-40/+48
attributes
2024-06-01Auto merge of #17302 - mladedav:dm/fix-clear, r=Veykrilbors-13/+30
fix diagnostics clearing when flychecks run per-workspace This might be causing #17300 or it's a different bug with the same functionality. I wonder if the decision to clear diagnostics should stay in the main loop or maybe the flycheck itself should track it and tell the mainloop? I have used a hash map but we could just as well use a vector since the IDs are `usizes` in some given range starting at 0. It would be probably faster but this just felt a bit cleaner and it allows us to change the ID to newtype later and we can just use a hasher that returns the underlying integer.
2024-06-01Move state trackig of diagnostic clearing inside `FlycheckActor`David Mládek-41/+31
2024-06-01Auto merge of #17278 - chenx97:flycheck-process-wrap, r=lnicolabors-6/+12
internal: replace command-group with process-wrap Because command-group no longer receives updates and depends on an older version of nix.
2024-05-31docs: Missing word typoLuke Franceschini-1/+1
2024-05-31minor: replace command-group with process-wrapHenry Chen-6/+12
Because command-group no longer receives updates and depends on an older version of nix.
2024-05-28add `FlycheckStatus` to global stateDavid Mládek-7/+34
2024-05-28fix diagnostics clearing when flychecks run per-workspaceDavid Mládek-6/+6
2024-05-27Auto merge of #17258 - maxwase:code-assist-async-sugar, r=Veykrilbors-0/+644
Add `toggle_async_sugar` assist code action Implement code action for sugaring and de-sugaring asynchronous functions. This code action does not import `Future` trait when de-sugaring and does not touch function boby, I guess this can be implemented later if needed. This action also does not take into consideration other bounds because IMO it's usually "let me try to use sugared version here". Feel free to request changes, that's my first code action implementation 😄 Closes #17010 Relates to #16195
2024-05-27Auto merge of #17253 - ThouCheese:master, r=Veykrilbors-0/+702
Implement assist to switch between doc and normal comments Hey first PR to rust-analyzer to get my feet wet with the code base. It's an assist to switch a normal comment to a doc comment and back, something I've found myself doing by hand a couple of times. I shamelessly stole `relevant_line_comments` from `convert_comment_block`, because I didn't see any inter-assist imports happening in the files I peeked at so I thought this would be preferable.
2024-05-27Auto merge of #17291 - kilpkonn:master, r=Veykrilbors-5/+19
Fix `data_constructor` ignoring generics for struct Previously didn't work for structs with generics due to `field.ty()` having placeholders in type. _Enums were handeled correctly already._ Also renamed `type_constructor -> data_constructor` as this is more correct name for it
2024-05-25Avoid clone when constructing runnable label.Mathew Horner-3/+3
2024-05-25Fix `data_constructor` ignoring generics for structTavo Annus-5/+19
2024-05-24remove nested match with and_thenLuuk Wester-4/+1
2024-05-24add test for every keyword, fix bugLuuk Wester-16/+94
2024-05-24cosmetic and performance fixes, and drop support for adding //! comments ↵Luuk Wester-113/+78
anywhere, except for at the top of files.
2024-05-24Review fixes: Assist scope, trait qualifymaxwase-45/+126
2024-05-24Review fixes: Split into 2, check tuple fieldsmaxwase-57/+137
2024-05-24Add toggle_async_sugar assist code actionmaxwase-0/+483
2024-05-24tests: update test for runnablesroife-0/+93
2024-05-24Add cwd to CargoRunnableroife-0/+14
2024-05-23Auto merge of #17287 - Veykril:sysroot-encode-empty, r=Veykrilbors-353/+276
Allow sysroots to only consist of the source root dir Fixes https://github.com/rust-lang/rust-analyzer/issues/17159 This PR encodes the `None` case of an optional sysroot into `Sysroot` itself. This simplifies a lot of things and allows us to have sysroots that consist of nothing, only standard library sources, everything but the standard library sources or everything. This makes things a lot more flexible. Additionally, this removes the workspace status bar info again, as it turns out that that can be too much information for the status bar to handle (this is better rendered somewhere else, like in the status view).
2024-05-23Allow sysroots to only consist of the source root dirLukas Wirth-353/+276
2024-05-23Auto merge of #17284 - Veykril:doc-links, r=Veykrilbors-3/+7
fix: Use correct toolchain channel when generating builtin type doc links
2024-05-23Use correct toolchain channel when generating builtin type doc linksLukas Wirth-3/+7
2024-05-23Auto merge of #17174 - Kohei316:fix-infer-async-block-with-tail-return-expr, ↵bors-1/+43
r=Veykril Fix: infer type of async block with tail return expr Fixes #17106 The `infer_async_block` method calls the `infer_block` method internally, which returns the never type without coercion when `tail_expr` is `None` and `ctx.diverges` is `Diverges::Always`.This is the reason for the bug in this issue. https://github.com/rust-lang/rust-analyzer/blob/cfce2bb46da62950a8b70ddb0b2a12332da1b1e1/crates/hir-ty/src/infer/expr.rs#L1411-L1413 This PR solves the bug by adding a process to coerce after calling `infer_block` method. This code passes all the tests, including tests I added for this isuue, however, I am not sure if this solution is right. I think that this solution is an ad hoc solution. So, I would appreciate to have your review. I apologize if I'm off the mark, but `infer_async_block` method should be rewritten to share code with the process of infering type of `expr::Closure` instead of the `infer_block` method. That way it will be closer to the infer process of rustc.
2024-05-23Update crates/hir-ty/src/infer/expr.rsLukas Wirth-0/+1
2024-05-23Auto merge of #17140 - harrysarson:harry-unused-self, r=Veykrilbors-2/+53
handle {self} when removing unused imports Fixes #17139 On master ```rs mod inner { pub struct X(); pub struct Y(); } mod z { use super::inner::{self, X}$0; fn f() { let y = inner::Y(); } } ``` becomes ```rs mod inner { pub struct X(); pub struct Y(); } mod z { use super::inner:self; fn f() { let y = inner::Y(); } } ``` with this fix it instead becomes ``` ```rs mod inner { pub struct X(); pub struct Y(); } mod z { use super::inner; fn f() { let y = inner::Y(); } } ```
2024-05-22Auto merge of #17270 - ↵bors-2/+53
davidbarsky:david/fix-completions-from-associated-types, r=Veykril fix: ensure implied bounds from associated types are considered in autocomplete closes: #16989 rust-analyzer needs to consider implied bounds from associated types in order to get all methods suggestions people expect. A pretty easy way to do that is to keep the `candidate_trait_id`'s receiver if it matches `TyFingerprint::Unnameable`. When benchmarking this change, I didn't notice a meaningful difference in autocomplete latency. (`TyFingerprint::Unnameable` corresponds to `TyKind::AssociatedType`, `TyKind::OpaqueType`, `TyKind::FnDef`, `TyKind::Closure`, `TyKind::Coroutine`, and `TyKind::CoroutineWitness`.)
2024-05-22fix: ensure implied bounds from associated types are considered in autocompleteDavid Barsky-2/+53
2024-05-22Auto merge of #17251 - roife:fix-issue-17057, r=Veykrilbors-6/+71
fix: resolve extern prelude for local mods in block modules fix https://github.com/rust-lang/rust-analyzer/issues/17057, https://github.com/rust-lang/rust-analyzer/issues/17032. We should use `ModuleOrigin` to check if the current module is a pseudo-module introduced by blocks (where names might be shadowed), rather than checking `block_def_map`.
2024-05-22SimplifyLukas Wirth-16/+11
2024-05-22internal: refactor `prefer_no_std`/`prefer_prelude` bools into a structDavid Barsky-351/+304
2024-05-23fix: check pseudo-block by local_id instead of ModuleOriginroife-5/+3
2024-05-22Auto merge of #17277 - Veykril:find-path-fixes, r=Veykrilbors-346/+647
fix: Various find path fixes Fixes https://github.com/rust-lang/rust-analyzer/issues/17271
2024-05-22Auto merge of #17279 - Veykril:format_args-escape, r=Veykrilbors-6/+18
fix: Fix format_args lowering passing incorrect parameters to `rustc_parse_format`
2024-05-22fix: Fix format_args lowering passing incorrect parameters to rustc_parse_formatLukas Wirth-6/+18
2024-05-22Auto merge of #17248 - mladedav:dm/delay-clear, r=Veykrilbors-1/+10
Clear diagnostics only after new ones were received Closes #15934 This adds a flag inside the global state which controls when old diagnostics are cleared. Now, old diagnostics should be cleared only after at least one new diagnostic is available.
2024-05-22Auto merge of #17268 - Veykril:signatures, r=Veykrilbors-226/+388
feat: More callable info With this PR we retain more info about callables other than functions, allowing for closure parameter type inlay hints to be linkable as well as better signature help around closures and `Fn*` implementors.
2024-05-22Update assists test fixturesLukas Wirth-29/+18
2024-05-22expectify find_path testsLukas Wirth-184/+447
2024-05-22fix: Fix general find-path inconsistenciesLukas Wirth-193/+242
2024-05-21test: add tests for extern preludes resolving in local modsroife-0/+62
2024-05-19Merge from rust-lang/rustLaurențiu Nicola-11/+10
2024-05-18Show fn traits in signature info for trait implementorsLukas Wirth-68/+196
2024-05-18Enable linked locations for closure param inlay hintsLukas Wirth-10/+5
2024-05-18Render closure fn trait kind in siganture helpLukas Wirth-27/+79