about summary refs log tree commit diff
path: root/src/tools/rust-analyzer
AgeCommit message (Collapse)AuthorLines
2024-09-01Rollup merge of #129207 - GrigorenkoPV:elided-is-named, r=cjgillotMatthias Krüger-3/+3
Lint that warns when an elided lifetime ends up being a named lifetime As suggested in https://github.com/rust-lang/rust/issues/48686#issuecomment-1817334575 Fixes #48686
2024-08-31Fix `elided_named_lifetimes` in codePavel Grigorenko-3/+3
2024-08-29Auto merge of #17993 - ChayimFriedman2:convert-to-tuple-attrs, r=Veykrilbors-11/+49
Consider field attributes when converting from tuple to named struct and the opposite Fixes #17983. I tried to use the `SourceChangeBuilder::make_mut()` API, but it duplicated the attribute...
2024-08-29Auto merge of #17991 - ChayimFriedman2:extract-variable-ref, r=Veykrilbors-10/+140
fix: Don't add reference when it isn't needed for the "Extract variable" assist I.e. don't generate `let var_name = &foo()`. Because it always irritates me when I need to fix that. Anything that creates a new value don't need a reference. That excludes mostly field accesses and indexing. I had a thought that we can also not generate a reference for fields and indexing as long as the type is `Copy`, but sometimes people impl `Copy` even when they don't want to copy the values (e.g. a large type), so I didn't do that.
2024-08-29Auto merge of #17987 - ChayimFriedman2:column-macro, r=Veykrilbors-1/+33
fix: Fix name resolution of shadowed builtin macro Fixes #17969.
2024-08-29Auto merge of #17988 - darichey:fix-scip-def, r=Veykrilbors-1/+3
Fix incorrect symbol definitions in SCIP output The SCIP output incorrectly marks some symbols as definitions because it doesn't account for the file ID when comparing the token's range to its definition's range. This means that if a symbol is referenced in a file at the same position at which it is defined in another file, that reference will be marked as a definition. I was quite surprised by how common this is. For example, `PartialEq` is defined [here](https://github.com/rust-lang/rust/blob/1.80.1/library/core/src/cmp.rs#L273) and `uuid` references it [here](https://github.com/uuid-rs/uuid/blob/1.8.0/src/lib.rs#L329). And what do you know, they're both at offset 10083! In our large monorepo, this happens for basically every common stdlib type!
2024-08-29Auto merge of #17940 - ChayimFriedman2:closure-to-fn, r=Veykrilbors-13/+1511
feat: Create an assist to convert closure to freestanding fn The assist converts all captures to parameters. Closes #17920. This was more work than I though, since it has to handle a bunch of edge cases... Based on #17941. Needs to merge it first.
2024-08-29Merge from rust-lang/rustLaurențiu Nicola-2/+4
2024-08-29Preparing for merge from rust-lang/rustLaurențiu Nicola-1/+1
2024-08-29fix: Fix TokenStream::to_string implementation dropping quotation marksLukas Wirth-3/+8
2024-08-29fix: Fix proc-macro server crashing when parsing a non-lexable string into a ↵Lukas Wirth-3/+15
TokenStream
2024-08-29Auto merge of #17992 - Wilfred:newlines_in_logs, r=Veykrilbors-2/+2
internal: Avoid newlines in fetch errors Most logs lines don't have newlines, ensure fetch errors follow this pattern. This makes it easier to see which log line is associated with the error. Before: 2024-08-28T21:11:58.431856Z ERROR FetchWorkspaceError: rust-analyzer failed to discover workspace After: 2024-08-28T21:11:58.431856Z ERROR FetchWorkspaceError: rust-analyzer failed to discover workspace
2024-08-28Fix incorrect symbol definitions in SCIP outputDavid Richey-1/+3
2024-08-29Consider field attributes when converting from tuple to named struct and the ↵Chayim Refael Friedman-11/+49
opposite
2024-08-29Also handle deref expressions in "Extract variable"Chayim Refael Friedman-15/+59
And BTW, remove the parentheses of the extracted expression if there are.
2024-08-28internal: Avoid newlines in fetch workspace errorsWilfred Hughes-2/+2
Most logs lines don't have newlines, ensure fetch workspace errors follow this pattern. Before: 2024-08-28T21:11:58.431856Z ERROR FetchWorkspaceError: rust-analyzer failed to discover workspace After: 2024-08-28T21:11:58.431856Z ERROR FetchWorkspaceError: rust-analyzer failed to discover workspace
2024-08-29Don't add reference when it isn't needed for the "Extract variable" assistChayim Refael Friedman-1/+42
I.e. don't generate `let var_name = &foo()`. Anything that creates a new value don't need a reference. That excludes mostly field accesses and indexing. I had a thought that we can also not generate a reference for fields and indexing as long as the type is `Copy`, but sometimes people impl `Copy` even when they don't want to copy the values (e.g. a large type), so I didn't do that.
2024-08-28Consider all expressions that autoderef in "Extract variable", not just ↵Chayim Refael Friedman-3/+48
method and field accesses.
2024-08-28Fix name resolution of shadowed builtin macroChayim Refael Friedman-1/+33
2024-08-28Auto merge of #17981 - lnicola:proc-macro-cwd, r=Veykrilbors-2/+2
minor: Fix cwd used for proc macro expansion Fixes #17980.
2024-08-28Fix cwd used for proc macro expansionLaurențiu Nicola-2/+2
2024-08-27Create an assist to convert closure to freestanding fnChayim Refael Friedman-13/+1511
The assist converts all captures to parameters.
2024-08-27Auto merge of #17757 - alibektas:toggle_macro_delimiters, r=Veykrilbors-0/+279
assist: Add new assist toggle_macro_delimiter Closes #17716
2024-08-27Fix testsLukas Wirth-23/+23
2024-08-27Auto merge of #17974 - lnicola:rm-apache-appendix, r=lnicolabors-50/+0
internal: Drop Apache license appendices Closes #14586 Similar to https://github.com/rust-lang/rust/pull/67734
2024-08-27Auto merge of #17973 - Veykril:proc-macro-curr-dir, r=Veykrilbors-14/+34
Expand proc-macros in workspace root, not package root Should fix https://github.com/rust-lang/rust-analyzer/issues/17748. The approach is generally not perfect though as rust-project.json projects don't benefit from this (still, nothing changes in that regard)
2024-08-27Drop Apache license appendicesLaurențiu Nicola-50/+0
2024-08-27Expand proc-macros in workspace root, not package rootLukas Wirth-14/+34
2024-08-27Auto merge of #17970 - ChayimFriedman2:unwrap-unsafe-block, r=Veykrilbors-3/+55
fix: Fix "Unwrap block" assist with block modifiers The assist just assumes the `{` will be the first character, which led to strange outputs such as `nsafe {`. Fixes #17964.
2024-08-27Revert "feat: Implement `module_path` macro"Lukas Wirth-278/+71
2024-08-26Fix "Unwrap block" assist with block modifiersChayim Refael Friedman-3/+55
The assist just assumes the `{` will be the first character, which led to strange outputs such as `nsafe {`.
2024-08-26Auto merge of #17963 - avrong:avrong/error-lifetimes, r=Veykrilbors-33/+17
Always show error lifetime arguments as `'_` Fixes #17947 Changed error lifetime argument presentation in non-test environment to `'_` and now showing them even if all of args are error lifetimes. This also influenced some of the other tests like `extract_function.rs`, `predicate.rs` and `type_pos.rs`. Not sure whether I need to refrain from adding lifetimes args there. Happy to fix if needed
2024-08-26Show lifetime args if there are only error onesAleksei Trifonov-12/+2
2024-08-26Show and render error lifetime args as `'_`Aleksei Trifonov-21/+15
2024-08-26Auto merge of #17941 - ChayimFriedman2:pre-closure-to-fn, r=Veykrilbors-166/+815
Preliminary work for #17940 I split the PR as requested, and made small commits.
2024-08-26Fix Return Type Syntax to include `..` (i.e. `method(..)` and not ↵Chayim Refael Friedman-16/+183
`method()`) as specified in the RFC
2024-08-25Auto merge of #17960 - duncanawoods:master, r=HKalbasibors-0/+8
fix: add extra_test_bin_args to test explorer test runner `@HKalbasi` I thought I included this in #17470 but it appears not so I have created a new issue #17959 for this fix.
2024-08-25Auto merge of #17961 - Veykril:autoderef-alloc, r=Veykrilbors-26/+60
internal: Don't allocate autoderef steps when not needed
2024-08-25internal: Don't allocate autoderef steps when not neededLukas Wirth-26/+60
2024-08-25fix: add extra_test_bin_args to test explorer test runnerduncan-0/+8
trim whitespace
2024-08-25Auto merge of #17958 - Veykril:deref-chain-method-completions, r=Veykrilbors-33/+90
fix: Fix trait method completions not acknowledging Deref impls
2024-08-25fix: Fix trait method completions not acknowledging Deref implsLukas Wirth-33/+90
2024-08-25Auto merge of #17956 - Veykril:metadata-err, r=Veykrilbors-52/+60
fix: Fix metadata retrying eating original errors
2024-08-25fix: Fix metadata retrying eating original errorsLukas Wirth-52/+60
2024-08-25Don't enable the search fast path for short associated functions when a ↵Chayim Refael Friedman-0/+4
search scope is set In most places where we set a search scope it is a single file, and so the fast path will actually harm performance, since it has to search for aliases in the whole project. The only exception that qualifies for the fast path is SSR (there is an exception that don't qualify for the fast path as it search for `use` items). It sets the search scope to avoid dependencies. We could make it use the fast path, but I didn't bother.
2024-08-24Impl PartialEq and Eq for `IndentLevel`Chayim Refael Friedman-1/+1
We can impl PartialOrd and Ord too, but I didn't need that.
2024-08-24Provide `impl From<ast::TypeOrConstParam> for ast::GenericParam`Chayim Refael Friedman-1/+10
2024-08-24Modify `hacks::parse_expr_from_str()` to take an edition tooChayim Refael Friedman-10/+14
This will be needed as we parse unknown identifiers and want to insert them into source code.
2024-08-24Add helper methods to retrieve `Future::Output` and `Iterator::Item`Chayim Refael Friedman-1/+24
2024-08-24Provide `Future::Output` and `Iterator` lang itemsChayim Refael Friedman-3/+9