Skip to content

Subtree update of rust-analyzer #130812

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 220 commits into from
Sep 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
220 commits
Select commit Hold shift + click to select a range
6e387a3
fix: do not assume rustup is installed in xtask codegen
IvarWithoutBones Aug 27, 2024
6485452
Make cargo_ workspace again
alibektas Aug 22, 2024
15a1505
Make checkOnSave workspace
alibektas Aug 22, 2024
55078f0
Make check workspace
alibektas Aug 22, 2024
2ddb4e1
Make runnables workspace
alibektas Aug 22, 2024
7360dfe
Make rustc_* workspace
alibektas Aug 22, 2024
887dd4e
Make procMacro_* workspace
alibektas Aug 22, 2024
fcf505b
Make workspace_symbol_search_* workspace
alibektas Aug 22, 2024
5e6bfae
Make diagnostics_* local
alibektas Aug 22, 2024
f98c121
Make completion_* local
alibektas Aug 22, 2024
042a932
Make almost every client config global
alibektas Aug 22, 2024
0e52706
Remove invalid tests
alibektas Aug 22, 2024
9edea1e
Minor errors
alibektas Aug 28, 2024
e691f6d
internal: Add doc comments to OpQueue
Wilfred Aug 28, 2024
23bea2b
Auto merge of #17975 - IvarWithoutBones:dont-assume-rustup, r=Veykril
bors Aug 29, 2024
a54a7a8
feat: Implement object safety
ShoyuVanilla Aug 6, 2024
28142e4
Auto merge of #17814 - ShoyuVanilla:object-safety, r=Veykril
bors Aug 29, 2024
92f27dc
fix: `std::error::Error` is object unsafe
ShoyuVanilla Aug 29, 2024
8bb235b
Add diagnostic for accessing an `extern` static
ChayimFriedman2 Aug 29, 2024
0dfe40f
Do not report missing unsafe on `addr_of[_mut]!(EXTERN_OR_MUT_STATIC)`
ChayimFriedman2 Aug 29, 2024
29ecaa1
fix: consider indentation in the "Generate impl" and "Generate trait …
IvarWithoutBones Aug 28, 2024
16a29ce
Auto merge of #17982 - IvarWithoutBones:generate-impl-indent, r=Veykril
bors Aug 30, 2024
a729229
Auto merge of #17999 - ShoyuVanilla:issue-17998, r=Veykril
bors Aug 30, 2024
e77de38
Auto merge of #18003 - ChayimFriedman2:addr_of-static-mut, r=Veykril
bors Aug 30, 2024
9afdc3a
fix(ide-completion): fix handling of `for` in `impl T for A` in funct…
rami3l Aug 30, 2024
27979ad
Auto merge of #18005 - rami3l:fix/for-completion-in-impl, r=Veykril
bors Aug 30, 2024
be33a2e
Improve inlay hint resolution reliability
Veykril Aug 30, 2024
9fc8eae
Auto merge of #18008 - Veykril:inlay-hints-resolve, r=Veykril
bors Aug 30, 2024
e69d57f
Revert "fix: do not assume rustup is installed in xtask codegen"
Veykril Aug 30, 2024
6b15103
Allow xtask::reformat to work without rustup
Veykril Aug 30, 2024
bfaf631
Auto merge of #18009 - Veykril:reformat-no-rustup, r=Veykril
bors Aug 30, 2024
3f60208
Support fn-ptr and fn-path types for lifetime elision hints
Veykril Aug 30, 2024
63bb576
Auto merge of #18010 - Veykril:inlay-hints-lt, r=Veykril
bors Aug 30, 2024
1350769
Apply changes, fix path information in a comment in config.rs
alibektas Aug 31, 2024
09a421a
Auto merge of #17945 - alibektas:ratoml_categorization, r=alibektas
bors Aug 31, 2024
1850ce3
Auto merge of #18011 - Wilfred:op_queue_doc_comments, r=Veykril
bors Aug 31, 2024
5acbc4f
fix: Fix lifetime elision inlay hints breaking for ranged requests
Veykril Aug 31, 2024
7b01343
Auto merge of #18012 - Veykril:inlay-hints-lt, r=Veykril
bors Aug 31, 2024
ce3ca99
Add explicit enum discriminant assist
riverbl Aug 28, 2024
5392d56
Update generated doctests
riverbl Aug 28, 2024
d6573f9
Rename function and remove flag argument
riverbl Aug 31, 2024
8116b62
Provide an option to hide deprecated items from completion
ChayimFriedman2 Aug 31, 2024
89a39d9
Handle attributes correctly in "Flip comma"
ChayimFriedman2 Aug 31, 2024
20ed8ce
Auto merge of #18006 - ChayimFriedman2:hide-deprecated, r=Veykril
bors Sep 1, 2024
b987284
Auto merge of #18015 - ChayimFriedman2:flip-comma-attribute, r=Veykril
bors Sep 1, 2024
f558be0
minor: Downgrade cyclic deps error to warning
Veykril Sep 1, 2024
fc9ff79
feat(ide-completion): extra sugar auto-completion `async fn ...` in `…
hyf0 Jul 29, 2024
7f9f966
Auto merge of #18020 - Veykril:cyclic-deps, r=Veykril
bors Sep 1, 2024
e233c3a
Complete desugared and resugared async fn in trait impls
Veykril Sep 1, 2024
28bc643
Auto merge of #17737 - hyf0:hyf_32089420384, r=Veykril
bors Sep 1, 2024
61b0374
minor: Reduce friction for updating minicore
Veykril Aug 26, 2024
0b926e4
Auto merge of #17985 - riverbl:explicit-enum-discriminant, r=Veykril
bors Sep 1, 2024
01b7676
internal: Lay basic ground work for standalone mbe tests
Veykril Aug 26, 2024
c7f4874
Auto merge of #17967 - Veykril:mbe-tests, r=Veykril
bors Sep 1, 2024
92b8b56
fix: use Result type aliases in "Wrap return type in Result" assist
IvarWithoutBones Aug 30, 2024
2311e96
wip: new syntax tree editor
DropDemBits Jul 27, 2024
5e33650
elaborate SyntaxEdit comments
DropDemBits Sep 2, 2024
2094a2b
handle merging two syntax editors together
DropDemBits Sep 2, 2024
ddb1e41
chore: fix some comments
cuishuang Sep 2, 2024
fb38e4b
Auto merge of #18025 - cuishuang:master, r=lnicola
bors Sep 2, 2024
f5ccde6
Simplify CompletionRelevance
Veykril Sep 2, 2024
3414a9e
Adjust completions scoring
Veykril Sep 2, 2024
7a0fc46
Auto merge of #18026 - Veykril:completions, r=Veykril
bors Sep 2, 2024
86c6382
Auto merge of #18016 - IvarWithoutBones:wrap-return-ty-local-result, …
bors Sep 2, 2024
011a1fc
fix: lifetime hint panic in non generic defs
Veykril Sep 2, 2024
090a38c
Auto merge of #18028 - Veykril:lifetime-hints-panic, r=Veykril
bors Sep 2, 2024
42ed30f
Avoid Option::is_none_or for a while
lnicola Sep 2, 2024
2f8ef4c
Merge some strings
lnicola Sep 2, 2024
c2f9b47
Auto merge of #18029 - lnicola:minor-stuff, r=lnicola
bors Sep 2, 2024
111c690
feat: Implement cast typechecks
ShoyuVanilla Aug 28, 2024
b880890
refactor: move ide_assist::utils::suggest_name to ide-db
roife Sep 2, 2024
5f7fcbe
feat: suggest name in let_stmt and fn_param
roife Sep 2, 2024
ef491f2
tests: suggesting names in completions for let_stmt and fn_param
roife Sep 2, 2024
e4bce98
propagate annotations to mapped elements
DropDemBits Sep 2, 2024
8104457
support insert{_all}
DropDemBits Sep 2, 2024
f08299f
fix insert ranges not being excluded from disjointness
DropDemBits Sep 3, 2024
f74ef3a
properly sort changes by depth to sort between nodes that have the sa…
DropDemBits Sep 3, 2024
f03f95f
support replacing root node
DropDemBits Sep 3, 2024
f6e05a7
handle replace_with_many and replace_all
DropDemBits Sep 3, 2024
4e81ca3
misc fixes
DropDemBits Sep 3, 2024
6faf409
Auto merge of #18031 - roife:suggest-name-in-completion, r=Veykril
bors Sep 3, 2024
c01d5e0
Auto merge of #17984 - ShoyuVanilla:cast, r=Veykril
bors Sep 3, 2024
17e5f01
Bump smol_str
Veykril Sep 3, 2024
b7138a8
Auto merge of #18036 - Veykril:smol_str, r=Veykril
bors Sep 3, 2024
a07e54c
bundle old root into `SyntaxEdit` result
DropDemBits Sep 3, 2024
01b1bfd
Add edition dependent keyword highlighting tests
Veykril Sep 4, 2024
0b432fc
Auto merge of #18044 - Veykril:highlight-kw-test, r=Veykril
bors Sep 4, 2024
1e7d99f
fix: Fix lowering of for loops dropping the `loop` block
Veykril Sep 4, 2024
1c26c99
Auto merge of #18045 - Veykril:fix-loop-lower, r=Veykril
bors Sep 4, 2024
7222f2d
Parse builtin#asm expressions
Veykril Sep 1, 2024
38514ba
assist: ensure replace_qualified_name_with_use applies to the first p…
davidbarsky Sep 4, 2024
b41f6ab
fix: Fix `inline_const_as_literal` error when the number >= 10
Coekjan Sep 5, 2024
1328b52
Lower asm expressions
Veykril Sep 1, 2024
44e3b7d
Add Definition kind for asm register classes
Veykril Sep 5, 2024
304f54e
Add Definition kind for asm register operand
Veykril Sep 5, 2024
f3b6965
Give InlineAsmOperand a HIR representation
Veykril Sep 5, 2024
bdb734b
Support more IDE features for asm operands
Veykril Sep 5, 2024
2120b38
Add missing doc comments
Veykril Sep 5, 2024
72980c4
Fix name fetching being incorrect for asm operands
Veykril Sep 5, 2024
bdfb2f6
Auto merge of #18022 - Veykril:asm-parse, r=Veykril
bors Sep 5, 2024
20e9c8d
asm! parsing and lowering fixes
Veykril Sep 5, 2024
4e2e1bf
fix: Fix parser panicking on invalid asm options
Veykril Sep 5, 2024
a3be866
Auto merge of #18053 - Veykril:asm-parse, r=Veykril
bors Sep 5, 2024
f44bdb5
Add command to report unresolved references
darichey Sep 5, 2024
06c86a1
fix: Updating settings should not clobber discovered projects
Wilfred Sep 5, 2024
ecd835d
Auto merge of #18059 - Wilfred:config_cleanups, r=Veykril
bors Sep 6, 2024
7e5a0e5
fix: Catch panics from diagnostics computation
Veykril Sep 6, 2024
56fde6e
Auto merge of #18065 - Veykril:catchy-diagnostics, r=Veykril
bors Sep 6, 2024
775c5c8
fix: Don't panic lsp writer thread on dropped receiver
Veykril Sep 6, 2024
07544c5
Auto merge of #18066 - Veykril:lsp-server-no-panic, r=Veykril
bors Sep 6, 2024
5f8823b
Bump lsp-server
Veykril Sep 6, 2024
2c8e24e
fix: Always explicitly set trait ref self types when lowering
Veykril Sep 6, 2024
835972b
Auto merge of #18068 - Veykril:ty-fixes, r=Veykril
bors Sep 6, 2024
bdc9da9
fix: Properly prevent mir building with unknown types present
Veykril Sep 6, 2024
f16a03f
Auto merge of #18067 - Veykril:prevent-mir-building, r=Veykril
bors Sep 6, 2024
3bcc2b7
assist: ensure replace_qualified_name_with_use applies to the first p…
davidbarsky Sep 4, 2024
ca262a3
Automatically add semicolon when completing unit-returning functions
ChayimFriedman2 Sep 1, 2024
81227a3
Better testing infra for ratoml
alibektas Sep 1, 2024
06d1aa2
Remove unnecessary symbols and add missing symbols
cuishuang Sep 9, 2024
544cced
feat: Allow hir-def prettifier formatting into one-line
roife Sep 8, 2024
352bd9f
feat: add prettifier for Pat
roife Sep 8, 2024
81fae18
fix: use `pretty_print_pat` for params in fn
roife Sep 8, 2024
cbfa357
fix: add parenthesis for or-pattern
roife Sep 8, 2024
e1653b6
feat: better name suggestions for fn
roife Sep 3, 2024
600f7cf
Auto merge of #18041 - roife:fix-issue-17631, r=Veykril
bors Sep 9, 2024
129acd2
feat: use shorthand when pretty-print record pat
roife Sep 9, 2024
32d9597
refactor: introduce NameGenerator in suggest_name
roife Sep 3, 2024
b304701
feat: generate names for tuple-struct in add-missing-match-arms
roife Sep 3, 2024
2053d7d
Auto merge of #18032 - DropDemBits:sed-tree-edits, r=davidbarsky
bors Sep 10, 2024
16f3eb9
Correctly escape strings in our quote macro
ChayimFriedman2 Sep 10, 2024
14a4f07
Auto merge of #18092 - ChayimFriedman2:fix-stringify, r=lnicola
bors Sep 10, 2024
a169a5b
Skip checks for cast to dyn traits
ShoyuVanilla Sep 10, 2024
7d8c5ad
Auto merge of #18093 - ShoyuVanilla:skip-dyn-trait-cast-check, r=Veykril
bors Sep 11, 2024
69ab8c2
Remove crate graph deduplication logic
Veykril Sep 9, 2024
0233b77
Auto merge of #18050 - rust-lang:davidbarsky/push-uyvtlsvoqrxw, r=Vey…
bors Sep 11, 2024
aa883b4
Lift out workspace related data into a separate query to preserve cra…
Veykril Sep 9, 2024
ec72a99
Auto merge of #17904 - darichey:unresolved-references, r=Veykril
bors Sep 11, 2024
c503caa
Properly set the working directory for proc-macro execution
Veykril Sep 11, 2024
97907ca
Auto merge of #18018 - ChayimFriedman2:unit-ret-complete-semi, r=Veykril
bors Sep 11, 2024
91e9cd3
Auto merge of #18052 - Coekjan:fix-inline-const, r=Veykril
bors Sep 11, 2024
e26ad21
Auto merge of #18057 - alibektas:better_ratoml_testing, r=Veykril
bors Sep 11, 2024
e1f8bb6
Auto merge of #18050 - rust-lang:davidbarsky/push-uyvtlsvoqrxw, r=Vey…
bors Sep 11, 2024
b8e8f1c
Auto merge of #18078 - cuishuang:master, r=Veykril
bors Sep 11, 2024
4ed9c8d
Auto merge of #18080 - Veykril:dedup, r=Veykril
bors Sep 11, 2024
51cc5a7
Auto merge of #18075 - roife:fix-issue-17858, r=Veykril
bors Sep 11, 2024
5ea245e
Fix inference of literals when the expectation is Castable
ChayimFriedman2 Sep 11, 2024
972e8ba
Auto merge of #18101 - ChayimFriedman2:inference-fix, r=Veykril
bors Sep 12, 2024
a436bbf
fix: Faulty notifications should not bring down the server
Veykril Sep 12, 2024
628a3d7
Auto merge of #18105 - Veykril:push-rquxwznuuwpu, r=Veykril
bors Sep 12, 2024
4361c1b
fix: Don't report typed hole error in asm! out ops
Veykril Sep 12, 2024
8cd0a27
Auto merge of #18106 - Veykril:push-yzsqoykyowts, r=Veykril
bors Sep 12, 2024
d1e4f73
fix: Don't emit empty inlay hint parts
Veykril Sep 12, 2024
4fcad5a
Auto merge of #18107 - Veykril:push-oopkquknxqxs, r=Veykril
bors Sep 12, 2024
3831b72
Auto merge of #18038 - roife:fix-issue-18034, r=Veykril
bors Sep 12, 2024
a933329
Use more correct handling of lint attributes
ChayimFriedman2 Sep 11, 2024
50b7185
Auto merge of #18099 - ChayimFriedman2:diag-only-necessary, r=Veykril
bors Sep 12, 2024
bd085df
fix: Immutable tree panic in `generate_delegate_trait`
alibektas Sep 8, 2024
004d646
Auto merge of #18073 - alibektas:immutable_tree_panics, r=lnicola
bors Sep 13, 2024
3535507
Fix printing of constants greater than `i128::MAX`
ChayimFriedman2 Sep 15, 2024
b9be0f2
Auto merge of #18119 - ChayimFriedman2:signed-const, r=HKalbasi
bors Sep 15, 2024
7ac6a72
Always cache macro expansions' root node in Semantics
ChayimFriedman2 Sep 15, 2024
e425712
fix: fix ambigious package name in flycheck
jhgg Sep 16, 2024
fde01e9
Handle errors and lints from external macros
ChayimFriedman2 Sep 17, 2024
5bd2f42
internal: Extend `SourceChangeBuilder` to make make working with `Syn…
DropDemBits Sep 17, 2024
d34cbe0
Use `SyntaxEditor` in `extract_type_alias`
DropDemBits Sep 17, 2024
319bc52
Add diagnostics for `unsafe_op_in_unsafe_fn`
ChayimFriedman2 Sep 18, 2024
fcf38be
Don't lint names of #[no_mangle] extern fns
valadaptive Sep 18, 2024
c47a656
Auto merge of #18134 - DropDemBits:source-change-sed, r=lnicola
bors Sep 18, 2024
65e87e2
feat: Implement `expr_2021`
ShoyuVanilla Sep 18, 2024
44f8545
Auto merge of #18137 - ShoyuVanilla:expr-2021, r=Veykril
bors Sep 18, 2024
e700b48
Auto merge of #18135 - ChayimFriedman2:unsafe-op-in-unsafe-fn, r=Veykril
bors Sep 18, 2024
3ffeee3
Auto merge of #18136 - valadaptive:no-mangle-lints, r=Veykril
bors Sep 18, 2024
63cf6fe
Auto merge of #18128 - ChayimFriedman2:external-macros-lint, r=Veykril
bors Sep 18, 2024
ee38991
Auto merge of #18117 - ChayimFriedman2:issue-18089, r=Veykril
bors Sep 18, 2024
25cae94
Don't complete `;` when in closure return expression
ChayimFriedman2 Sep 17, 2024
493ab1b
Extract logic to decide how to complete semicolon for unit-returning …
ChayimFriedman2 Sep 18, 2024
59e3008
fix: Extend `type_variable_table` when modifying index is larger than…
ShoyuVanilla Sep 18, 2024
d878b53
Get rid of `$crate` in expansions shown to the user
ChayimFriedman2 Sep 17, 2024
627ccda
Auto merge of #18139 - ShoyuVanilla:issue-18109, r=Veykril
bors Sep 18, 2024
4ed7f4b
Auto merge of #18131 - ChayimFriedman2:macro-expand-dollar-crate, r=V…
bors Sep 18, 2024
65f83e4
Remove check that text of `parse_expr_from_str()` matches the produce…
ChayimFriedman2 Sep 19, 2024
814da15
Auto merge of #18146 - ChayimFriedman2:allow-comment, r=Veykril
bors Sep 19, 2024
288b365
Support the `${concat(...)}` metavariable expression
ChayimFriedman2 Sep 19, 2024
b97ef38
Handle lint attributes that are under `#[cfg_attr]`
ChayimFriedman2 Sep 12, 2024
6ec47a3
When checking for forbidden expr kind matches, account for rawness
ChayimFriedman2 Sep 19, 2024
c4949b7
Auto merge of #18153 - ChayimFriedman2:mbe-const, r=Veykril
bors Sep 20, 2024
da4a985
Auto merge of #18108 - ChayimFriedman2:lint-level-cfg, r=Veykril
bors Sep 20, 2024
3f6ca83
Auto merge of #18151 - ChayimFriedman2:metavar-concat, r=Veykril
bors Sep 20, 2024
85e1214
Auto merge of #18132 - ChayimFriedman2:fix-closure-semi, r=Veykril
bors Sep 20, 2024
f6138e2
analysis-stats: respect --disable-proc-macros flag
davidbarsky Sep 19, 2024
0a25908
Fix name resolution when an import is resolved to some namespace and …
ChayimFriedman2 Sep 22, 2024
2818d1e
Properly account for mutable references when postfix-completing consu…
ChayimFriedman2 Sep 22, 2024
ded3a5c
Include dereferences in consuming postfix completions (e.g. `call`)
ChayimFriedman2 Sep 22, 2024
393f9cc
Consider lifetime GATs object unsafe
ChayimFriedman2 Sep 22, 2024
b14cd71
Fix a bug in span map merge, and add explanations of how span maps ar…
ChayimFriedman2 Sep 22, 2024
a1eb50e
Disable GitHub releases for now
lnicola Sep 23, 2024
e00ba67
Auto merge of #18169 - lnicola:disable-gh-releases, r=lnicola
bors Sep 23, 2024
63ff4d6
Revert "internal: Disable GitHub releases for now"
lnicola Sep 23, 2024
fc58c94
Auto merge of #18170 - rust-lang:revert-18169-disable-gh-releases, r=…
bors Sep 23, 2024
26fdbf4
Support expect in attribute completion and hover
lnicola Sep 23, 2024
f75aebe
Auto merge of #18172 - lnicola:expect-attr-completions, r=davidbarsky
bors Sep 23, 2024
f049f5f
internal: Make COMPLETION_MARKER more explicitly r-a
Wilfred Sep 23, 2024
5bc2e65
Auto merge of #18162 - ChayimFriedman2:gat-object-safe, r=Veykril
bors Sep 24, 2024
622c701
Auto merge of #18175 - Wilfred:completion_marker, r=Veykril
bors Sep 24, 2024
6ec41ab
Auto merge of #18123 - jhgg:fix-ambigius-package-cargo-check, r=Veykril
bors Sep 24, 2024
80c0682
Auto merge of #18157 - davidbarsky:davidbarsky/respect-disabling-proc…
bors Sep 24, 2024
a8eaa9e
Auto merge of #18160 - ChayimFriedman2:fix-18138, r=Veykril
bors Sep 24, 2024
a5f028b
Auto merge of #18161 - ChayimFriedman2:postfix-mut, r=Veykril
bors Sep 24, 2024
ceb495a
Auto merge of #18166 - ChayimFriedman2:dollar-crate-root, r=Veykril
bors Sep 24, 2024
8ca54f2
fix: Temporary fix for `remove_unused_imports` not handling import al…
ShoyuVanilla Sep 22, 2024
316a15c
Auto merge of #18164 - ShoyuVanilla:use-as-alias, r=Veykril
bors Sep 24, 2024
96736ae
Preparing for merge from rust-lang/rust
lnicola Sep 25, 2024
ed7150f
Merge from rust-lang/rust
lnicola Sep 25, 2024
62aac8d
Bump rustc crates
lnicola Sep 25, 2024
329eef0
Add more LayoutError variants
lnicola Sep 25, 2024
78680ac
Pass all-targets for build scripts in more cli commands
Veykril Sep 25, 2024
8be1946
Run rustfmt
lnicola Sep 25, 2024
938c7b1
Auto merge of #18184 - Veykril:veykril/push-wsqsyxynttps, r=Veykril
bors Sep 25, 2024
34aff74
Auto merge of #18183 - lnicola:sync-from-rust, r=lnicola
bors Sep 25, 2024
35bc50f
Add missing rustc_private
lnicola Sep 25, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/tools/rust-analyzer/.typos.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ extend-ignore-re = [
'"flate2"',
"raison d'être",
"inout",
"INOUT",
"optin"
]

Expand Down
57 changes: 38 additions & 19 deletions src/tools/rust-analyzer/Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,15 @@ version = "2.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de"

[[package]]
name = "borsh"
version = "1.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a6362ed55def622cddc70a4746a68554d7b687713770de539e59a739b249f8ed"
dependencies = [
"cfg_aliases 0.2.1",
]

[[package]]
name = "byteorder"
version = "1.5.0"
Expand Down Expand Up @@ -167,6 +176,12 @@ version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fd16c4719339c4530435d38e511904438d07cce7950afa3718a84ac36c10e89e"

[[package]]
name = "cfg_aliases"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724"

[[package]]
name = "chalk-derive"
version = "0.98.0"
Expand Down Expand Up @@ -982,7 +997,7 @@ checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24"

[[package]]
name = "lsp-server"
version = "0.7.6"
version = "0.7.7"
dependencies = [
"crossbeam-channel",
"ctrlc",
Expand All @@ -994,9 +1009,9 @@ dependencies = [

[[package]]
name = "lsp-server"
version = "0.7.6"
version = "0.7.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "248f65b78f6db5d8e1b1604b4098a28b43d21a8eb1deeca22b1c421b276c7095"
checksum = "550446e84739dcaf6d48a4a093973850669e13e8a34d8f8d64851041be267cd9"
dependencies = [
"crossbeam-channel",
"log",
Expand Down Expand Up @@ -1029,8 +1044,10 @@ version = "0.0.0"
dependencies = [
"arrayvec",
"cov-mark",
"expect-test",
"intern",
"parser",
"ra-ap-rustc_lexer",
"rustc-hash",
"smallvec",
"span",
Expand Down Expand Up @@ -1113,7 +1130,7 @@ checksum = "ab2156c4fce2f8df6c499cc1c763e4394b7482525bf2a9701c9d79d215f519e4"
dependencies = [
"bitflags 2.6.0",
"cfg-if",
"cfg_aliases",
"cfg_aliases 0.1.1",
"libc",
]

Expand Down Expand Up @@ -1468,9 +1485,9 @@ dependencies = [

[[package]]
name = "ra-ap-rustc_abi"
version = "0.63.0"
version = "0.68.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b011c39d409940a890414e3a7b239762ac16d88029ad71b050a8374831b93790"
checksum = "2a8cb51bb4534ac3e9c74f1d9bd90e607e60f94f734b1cf1a66f753ad2af6ed7"
dependencies = [
"bitflags 2.6.0",
"ra-ap-rustc_index",
Expand All @@ -1479,9 +1496,9 @@ dependencies = [

[[package]]
name = "ra-ap-rustc_index"
version = "0.63.0"
version = "0.68.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9027acdee649b0b27eb10b7db5be833efee3362d394935c5eed8f0745a9d43ce"
checksum = "8b640fba2b7ef4f875459e2e76daeb846ef341d1d376fa758962ac0eba79bce6"
dependencies = [
"arrayvec",
"ra-ap-rustc_index_macros",
Expand All @@ -1490,9 +1507,9 @@ dependencies = [

[[package]]
name = "ra-ap-rustc_index_macros"
version = "0.63.0"
version = "0.68.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "540b86dc0384141ac8e825fc2874cd44bffd4277d99d8ec63ee416f1a98d5997"
checksum = "faef502419ba5ac9d3079b1a835c6e5b4e605388254bbe55eb5683936f541be9"
dependencies = [
"proc-macro2",
"quote",
Expand All @@ -1501,29 +1518,29 @@ dependencies = [

[[package]]
name = "ra-ap-rustc_lexer"
version = "0.63.0"
version = "0.68.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3bdf98bb457b47b9ae4aeebf867d0ca440c86925e0b6381658c4a02589748c9d"
checksum = "5da7f9d533b8d5be6704558da741ff20b982ad4647b1e9e08632853e4fecf9d5"
dependencies = [
"unicode-properties",
"unicode-xid",
]

[[package]]
name = "ra-ap-rustc_parse_format"
version = "0.63.0"
version = "0.68.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e8fe3556ab6311bb775220563a300e2bf62ec56404521fe0c511a583937683d5"
checksum = "94389cf81c651b1bda9ac45d3de6a2d851bb6fd4cb893875daa44e419c94205f"
dependencies = [
"ra-ap-rustc_index",
"ra-ap-rustc_lexer",
]

[[package]]
name = "ra-ap-rustc_pattern_analysis"
version = "0.63.0"
version = "0.68.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1709080fdeb5db630e1c2644026c2962aaa32416cd92f0190c04b0c21e114b91"
checksum = "3679d8dd0114ed6000918309f843782738e51c99d8e4baec0d0f706e4d948819"
dependencies = [
"ra-ap-rustc_index",
"rustc-hash",
Expand Down Expand Up @@ -1636,7 +1653,7 @@ dependencies = [
"intern",
"itertools",
"load-cargo",
"lsp-server 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)",
"lsp-server 0.7.7 (registry+https://github.com/rust-lang/crates.io-index)",
"lsp-types",
"memchr",
"mimalloc",
Expand Down Expand Up @@ -1843,10 +1860,11 @@ checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67"

[[package]]
name = "smol_str"
version = "0.2.2"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dd538fb6910ac1099850255cf94a94df6551fbdd602454387d0adb2d1ca6dead"
checksum = "66eaf762c5af19db3108300515c8aa7a50efc90ff745f4c62288052ebf9fdd25"
dependencies = [
"borsh",
"serde",
]

Expand Down Expand Up @@ -2607,6 +2625,7 @@ version = "0.1.0"
dependencies = [
"anyhow",
"directories",
"either",
"flate2",
"itertools",
"proc-macro2",
Expand Down
13 changes: 7 additions & 6 deletions src/tools/rust-analyzer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,11 @@ tt = { path = "./crates/tt", version = "0.0.0" }
vfs-notify = { path = "./crates/vfs-notify", version = "0.0.0" }
vfs = { path = "./crates/vfs", version = "0.0.0" }

ra-ap-rustc_lexer = { version = "0.63.0", default-features = false }
ra-ap-rustc_parse_format = { version = "0.63.0", default-features = false }
ra-ap-rustc_index = { version = "0.63.0", default-features = false }
ra-ap-rustc_abi = { version = "0.63.0", default-features = false }
ra-ap-rustc_pattern_analysis = { version = "0.63.0", default-features = false }
ra-ap-rustc_lexer = { version = "0.68.0", default-features = false }
ra-ap-rustc_parse_format = { version = "0.68.0", default-features = false }
ra-ap-rustc_index = { version = "0.68.0", default-features = false }
ra-ap-rustc_abi = { version = "0.68.0", default-features = false }
ra-ap-rustc_pattern_analysis = { version = "0.68.0", default-features = false }

# local crates that aren't published to crates.io. These should not have versions.
test-fixture = { path = "./crates/test-fixture" }
Expand Down Expand Up @@ -145,7 +145,7 @@ smallvec = { version = "1.10.0", features = [
"union",
"const_generics",
] }
smol_str = "0.2.1"
smol_str = "0.3.1"
snap = "1.1.0"
text-size = "1.1.1"
tracing = "0.1.40"
Expand Down Expand Up @@ -185,6 +185,7 @@ style = { level = "warn", priority = -1 }
suspicious = { level = "warn", priority = -1 }

## allow following lints
too_long_first_doc_paragraph = "allow"
# subjective
single_match = "allow"
# () makes a fine error in most cases
Expand Down
14 changes: 13 additions & 1 deletion src/tools/rust-analyzer/crates/base-db/src/change.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,23 @@

use std::fmt;

use rustc_hash::FxHashMap;
use salsa::Durability;
use triomphe::Arc;
use vfs::FileId;

use crate::{CrateGraph, SourceDatabaseFileInputExt, SourceRoot, SourceRootDatabase, SourceRootId};
use crate::{
CrateGraph, CrateId, CrateWorkspaceData, SourceDatabaseFileInputExt, SourceRoot,
SourceRootDatabase, SourceRootId,
};

/// Encapsulate a bunch of raw `.set` calls on the database.
#[derive(Default)]
pub struct FileChange {
pub roots: Option<Vec<SourceRoot>>,
pub files_changed: Vec<(FileId, Option<String>)>,
pub crate_graph: Option<CrateGraph>,
pub ws_data: Option<FxHashMap<CrateId, Arc<CrateWorkspaceData>>>,
}

impl fmt::Debug for FileChange {
Expand Down Expand Up @@ -50,6 +55,10 @@ impl FileChange {
self.crate_graph = Some(graph);
}

pub fn set_ws_data(&mut self, data: FxHashMap<CrateId, Arc<CrateWorkspaceData>>) {
self.ws_data = Some(data);
}

pub fn apply(self, db: &mut dyn SourceRootDatabase) {
let _p = tracing::info_span!("FileChange::apply").entered();
if let Some(roots) = self.roots {
Expand All @@ -74,6 +83,9 @@ impl FileChange {
if let Some(crate_graph) = self.crate_graph {
db.set_crate_graph_with_durability(Arc::new(crate_graph), Durability::HIGH);
}
if let Some(data) = self.ws_data {
db.set_crate_workspace_data_with_durability(Arc::new(data), Durability::HIGH);
}
}
}

Expand Down
76 changes: 11 additions & 65 deletions src/tools/rust-analyzer/crates/base-db/src/input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -374,64 +374,24 @@ impl CrateGraph {
self.arena.alloc(data)
}

/// Remove the crate from crate graph. If any crates depend on this crate, the dependency would be replaced
/// with the second input.
pub fn remove_and_replace(
&mut self,
id: CrateId,
replace_with: CrateId,
) -> Result<(), CyclicDependenciesError> {
for (x, data) in self.arena.iter() {
if x == id {
continue;
}
for edge in &data.dependencies {
if edge.crate_id == id {
self.check_cycle_after_dependency(edge.crate_id, replace_with)?;
}
}
}
// if everything was ok, start to replace
for (x, data) in self.arena.iter_mut() {
if x == id {
continue;
}
for edge in &mut data.dependencies {
if edge.crate_id == id {
edge.crate_id = replace_with;
}
}
}
Ok(())
}

pub fn add_dep(
&mut self,
from: CrateId,
dep: Dependency,
) -> Result<(), CyclicDependenciesError> {
let _p = tracing::info_span!("add_dep").entered();

self.check_cycle_after_dependency(from, dep.crate_id)?;

self.arena[from].add_dep(dep);
Ok(())
}

/// Check if adding a dep from `from` to `to` creates a cycle. To figure
/// that out, look for a path in the *opposite* direction, from `to` to
/// `from`.
fn check_cycle_after_dependency(
&self,
from: CrateId,
to: CrateId,
) -> Result<(), CyclicDependenciesError> {
if let Some(path) = self.find_path(&mut FxHashSet::default(), to, from) {
// Check if adding a dep from `from` to `to` creates a cycle. To figure
// that out, look for a path in the *opposite* direction, from `to` to
// `from`.
if let Some(path) = self.find_path(&mut FxHashSet::default(), dep.crate_id, from) {
let path = path.into_iter().map(|it| (it, self[it].display_name.clone())).collect();
let err = CyclicDependenciesError { path };
assert!(err.from().0 == from && err.to().0 == to);
assert!(err.from().0 == from && err.to().0 == dep.crate_id);
return Err(err);
}

self.arena[from].add_dep(dep);
Ok(())
}

Expand Down Expand Up @@ -531,43 +491,29 @@ impl CrateGraph {
.for_each(|(_, data)| data.dependencies.sort_by_key(|dep| dep.crate_id));
}

/// Extends this crate graph by adding a complete disjoint second crate
/// Extends this crate graph by adding a complete second crate
/// graph and adjust the ids in the [`ProcMacroPaths`] accordingly.
///
/// This will deduplicate the crates of the graph where possible.
/// Note that for deduplication to fully work, `self`'s crate dependencies must be sorted by crate id.
/// If the crate dependencies were sorted, the resulting graph from this `extend` call will also
/// have the crate dependencies sorted.
///
/// Returns a mapping from `other`'s crate ids to the new crate ids in `self`.
/// Returns a map mapping `other`'s IDs to the new IDs in `self`.
pub fn extend(
&mut self,
mut other: CrateGraph,
proc_macros: &mut ProcMacroPaths,
merge: impl Fn((CrateId, &mut CrateData), (CrateId, &CrateData)) -> bool,
) -> FxHashMap<CrateId, CrateId> {
let m = self.len();
let topo = other.crates_in_topological_order();
let mut id_map: FxHashMap<CrateId, CrateId> = FxHashMap::default();
for topo in topo {
let crate_data = &mut other.arena[topo];

crate_data.dependencies.iter_mut().for_each(|dep| dep.crate_id = id_map[&dep.crate_id]);
crate_data.dependencies.sort_by_key(|dep| dep.crate_id);
let res = self
.arena
.iter_mut()
.take(m)
.find_map(|(id, data)| merge((id, data), (topo, crate_data)).then_some(id));

let new_id =
if let Some(res) = res { res } else { self.arena.alloc(crate_data.clone()) };

let new_id = self.arena.alloc(crate_data.clone());
id_map.insert(topo, new_id);
}

*proc_macros =
mem::take(proc_macros).into_iter().map(|(id, macros)| (id_map[&id], macros)).collect();

id_map
}

Expand Down
Loading
Loading