| Age | Commit message (Collapse) | Author | Lines |
|
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
|
|
|
|
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...
|
|
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.
|
|
fix: Fix name resolution of shadowed builtin macro
Fixes #17969.
|
|
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!
|
|
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.
|
|
|
|
|
|
|
|
TokenStream
|
|
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
|
|
|
|
opposite
|
|
And BTW, remove the parentheses of the extracted expression if there are.
|
|
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
|
|
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.
|
|
method and field accesses.
|
|
|
|
minor: Fix cwd used for proc macro expansion
Fixes #17980.
|
|
|
|
The assist converts all captures to parameters.
|
|
assist: Add new assist toggle_macro_delimiter
Closes #17716
|
|
|
|
internal: Drop Apache license appendices
Closes #14586
Similar to https://github.com/rust-lang/rust/pull/67734
|
|
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)
|
|
|
|
|
|
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.
|
|
|
|
The assist just assumes the `{` will be the first character, which led to strange outputs such as `nsafe {`.
|
|
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
|
|
|
|
|
|
Preliminary work for #17940
I split the PR as requested, and made small commits.
|
|
`method()`) as specified in the RFC
|
|
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.
|
|
internal: Don't allocate autoderef steps when not needed
|
|
|
|
trim whitespace
|
|
fix: Fix trait method completions not acknowledging Deref impls
|
|
|
|
fix: Fix metadata retrying eating original errors
|
|
|
|
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.
|
|
We can impl PartialOrd and Ord too, but I didn't need that.
|
|
|
|
This will be needed as we parse unknown identifiers and want to insert them into source code.
|
|
|
|
|