about summary refs log tree commit diff
path: root/src/tools/rust-analyzer
AgeCommit message (Collapse)AuthorLines
2024-12-04fix: remove make_mut from introduce_named_generic assistTarek-2/+0
Signed-off-by: Tarek <tareknaser360@gmail.com>
2024-12-04feat: migrate introduce_named_generic assist to use SyntaxFactoryTarek-5/+41
Signed-off-by: Tarek <tareknaser360@gmail.com>
2024-12-04Complete diagnostics in ty lowering groundworkChayim Refael Friedman-103/+621
Implement diagnostics in all places left: generics (predicates, defaults, const params' types), fields, and type aliases. Unfortunately this results in a 20mb addition in `analysis-stats .` due to many type methods returning an addition diagnostics result now (even if it's `None` in most cases). I'm not sure if this can be improved. An alternative strategy that can prevent the memory usage growth is to never produce diagnostics in hir-ty methods. Instead, lower all types in the hir crate when computing diagnostics from scratch (with diagnostics this time). But this has two serious disadvantages: 1. This can cause code duplication (although it can probably be not that bad, it will still mean a lot more code). 2. I believe we eventually want to compute diagnostics for the *entire* workspace (either on-type or on-save or something alike), so users can know when they have diagnostics even in inactive files. Choosing this approach will mean we lose all precomputed salsa queries. For one file this is fine, for the whole workspace this will be very slow.
2024-12-04Lay the foundation for diagnostics in ty lowering, and implement a first ↵Chayim Refael Friedman-80/+811
diagnostic The diagnostic implemented is a simple one (E0109). It serves as a test for the new foundation. This commit only implements diagnostics for type in bodies and body-carrying signatures; the next commit will include diagnostics in the rest of the things. Also fix one weird bug that was detected when implementing this that caused `Fn::(A, B) -> C` (which is a valid, if bizarre, alternative syntax to `Fn(A, B) -> C` to lower incorrectly. And also fix a maybe-bug where parentheses were sneaked into a code string needlessly; this was not detected until now because the parentheses were removed (by the make-AST family API), but with a change in this commit they are now inserted. So fix that too.
2024-12-04Store some hir_def Paths in the type ref source mapsChayim Refael Friedman-77/+144
Most paths are types and therefore already are in the source map, but the trait in impl trait and in bounds are not. We do this by storing them basically as `TypeRef`s. For convenience, I created a wrapper around `TypeRefId` called `PathId` that always stores a path, and implemented indexing from the types map to it. Fortunately, this change impacts memory usage negligibly (adds 2mb to `analysis-stats .`, but that could be just fluff). Probably because there aren't that many trait bounds and impl traits, and this also shrinks `TypeBound` by 8 bytes. I also added an accessor to `TypesSourceMap` to get the source code, which will be needed for diagnostics.
2024-12-04Fix parsing of parenthesized type args and RTNLukas Wirth-698/+1020
2024-12-04refactor: change target parameter to a reference in add_rewrite methodTarek-12/+6
Signed-off-by: Tarek <tareknaser360@gmail.com>
2024-12-04feat: migrate `sort_items` assist to use `SyntaxFactory`Tarek-18/+22
Signed-off-by: Tarek <tareknaser360@gmail.com>
2024-12-04Merge pull request #18609 from ChayimFriedman2/unsafe-coverageLukas Wirth-113/+499
feat: Extend reported unsafe operations
2024-12-04Merge pull request #18604 from ChayimFriedman2/complete-helpersLukas Wirth-4/+111
feat: Complete derive helper attributes
2024-12-04Extend reported unsafe operationsChayim Refael Friedman-113/+499
We add union fields access (in both expressions and patterns) and inline assembly. That completes the unsafe check (there are some other unsafe things but they are unstable), and so also opens the door to reporting unused unsafe without annoying people about their not-unused unsafe blocks.
2024-12-04Complete derive helper attributesChayim Refael Friedman-4/+111
Only their names, anything can go inside.
2024-12-04Merge pull request #18608 from Veykril/push-rrozmpnyknkxLukas Wirth-40/+154
Better parser recovery for paths
2024-12-04Update mbe test outputLukas Wirth-2/+3
2024-12-04fix: Don't create empty path nodesLukas Wirth-24/+26
2024-12-04Better parser recovery for incomplete attributesLukas Wirth-19/+130
2024-12-04Merge pull request #18522 from tareknaser/configure_typing_exclude_charsLukas Wirth-15/+20
Add Configurable Option to Exclude Trigger Characters for Typing Assists
2024-12-04Merge pull request #18605 from ChayimFriedman2/wildcard-importsLukas Wirth-2/+46
fix: Fixed another bug with glob imports
2024-12-04Merge pull request #18595 from markmurphydev/remove_platform_intrinsicLaurențiu Nicola-5/+0
Remove references to platform-intrinsic ABI
2024-12-04Merge pull request #18607 from ChayimFriedman2/pattern-record-no-recordLaurențiu Nicola-7/+30
fix: Fix shadowing of record enum variant in patterns
2024-12-04Fix shadowing of record enum variant in patternsChayim Refael Friedman-7/+30
2024-12-04Improve soundness a bit by making `TaggedArcPtr::try_as_arc_owned()` unsafeChayim Refael Friedman-13/+17
Since the `ManuallyDrop` it returns can be safely used to consume the `Arc`, which is can cause UB if done incorrectly. See #18499.
2024-12-04Fixed another bug with glob importsChayim Refael Friedman-2/+46
When a glob import overriding the visibility of a previous glob import was not properly resolved when the items are only available in the next fixpoint iteration. The bug was hidden until #18390.
2024-12-03Remove references to platform-intrinsic ABIMark Murphy-5/+0
2024-12-03chore: deprecate `typing.autoClosingAngleBrackets` configurationTarek-31/+1
Signed-off-by: Tarek <tareknaser360@gmail.com>
2024-12-03internal: Make exclude characters for typing assists configurable, default ↵Tarek-2/+37
to None Signed-off-by: Tarek <tareknaser360@gmail.com>
2024-12-03Support `AsyncFnX` traitsChayim Refael Friedman-68/+291
Only in calls, because to support them in bounds we need support from Chalk. However we don't yet report error from bounds anyway, so this is less severe. The returned future is shown in its name within inlay hints instead of as a nicer `impl Future`, but that can wait for another PR.
2024-12-03Merge pull request #18555 from ChayimFriedman2/issue-17321Lukas Wirth-4/+80
fix: Fix a bug when synthetic AST node were searched in the AST ID map and caused panics
2024-12-03Only show status bar item in relevant filesDavid Richey-1/+56
2024-12-03Advertise completions and inlay hints resolve server capabilities based on ↵Kirill Bulatov-22/+45
the client capabilities.
2024-12-02Use c"lit" for CStrings without unwrapKornel-3/+1
2024-12-02Merge pull request #18561 from markmurphydev/macro_name_raw_variableLukas Wirth-0/+28
Add macro expansion test for raw variable names
2024-12-02Merge pull request #18587 from Veykril/push-urrlrursyrwsLukas Wirth-1/+17
fix: Fix syntax fixup inserting unnecessary semicolons
2024-12-02fix: Fix syntax fixup inserting unnecessary semicolonsLukas Wirth-1/+17
2024-12-02Fix debug configuration querying not inheriting environmentLukas Wirth-154/+42
2024-11-30Remove redundant associated type bounds from dynMichael Goulet-4/+4
2024-11-28Merge from rust-lang/rustLaurențiu Nicola-0/+1
2024-11-28Preparing for merge from rust-lang/rustLaurențiu Nicola-1/+1
2024-11-28Fix proc macro testLaurențiu Nicola-0/+1
2024-11-28Bump rustc cratesLaurențiu Nicola-17/+17
2024-11-28Merge from rust-lang/rustLaurențiu Nicola-1/+1
2024-11-28Preparing for merge from rust-lang/rustLaurențiu Nicola-1/+1
2024-11-26Remove target.is_some() to handle it later inside ra::flycheckAli Bektas-3/+1
2024-11-26Revert #18197Ali Bektas-1/+1
Our first attempt to make flycheck only check the current crate if the crate is one of bin/bench/test targets had caused `check_workspace` to be ignored, which should have been a config with higher precedence all along. This commit revert #18197 and closes #18562
2024-11-26Merge pull request #18511 from darichey/sysroot-query-metadataLaurențiu Nicola-51/+150
Re-add `rust-analyzer.cargo.sysrootQueryMetadata`
2024-11-26Add macro expansion test for raw variable namesMark Murphy-0/+28
2024-11-25Merge pull request #18559 from ChayimFriedman2/recur-unsizedLaurențiu Nicola-10/+47
fix: Fix a stack overflow when computing the sizedness of a struct that includes itself as the tail field
2024-11-25Fix a stack overflow when computing the sizedness of a struct that includes ↵Chayim Refael Friedman-10/+47
itself as the tail field
2024-11-26Migrate `add_turbo_fish` to `SyntaxEditor`Shoyu Vanilla-24/+77
2024-11-25Fix a bug when synthetic AST node were searched in the AST ID map and caused ↵Chayim Refael Friedman-4/+80
panics