Unnamed repository; edit this file 'description' to name the repository.
Merge pull request #5105 from rust-lang/rustup-2026-06-13
Automatic Rustup
Ralf Jung 5 weeks ago
parent 3a38689 · parent 0b0258c · commit 12124ce
-rw-r--r--.github/workflows/release.yaml13
-rw-r--r--.github/workflows/rustdoc.yaml2
-rw-r--r--AI_POLICY.md28
-rw-r--r--CONTRIBUTING.md8
-rw-r--r--Cargo.lock1170
-rw-r--r--Cargo.toml21
-rw-r--r--crates/base-db/src/lib.rs20
-rw-r--r--crates/hir-def/src/expr_store.rs1
-rw-r--r--crates/hir-def/src/expr_store/lower.rs3
-rw-r--r--crates/hir-def/src/expr_store/pretty.rs6
-rw-r--r--crates/hir-def/src/hir.rs4
-rw-r--r--crates/hir-def/src/lang_item.rs19
-rw-r--r--crates/hir-def/src/lib.rs8
-rw-r--r--crates/hir-def/src/resolver.rs9
-rw-r--r--crates/hir-def/src/test_db.rs2
-rw-r--r--crates/hir-expand/src/builtin/fn_macro.rs12
-rw-r--r--crates/hir-expand/src/name.rs7
-rw-r--r--crates/hir-ty/src/builtin_derive.rs9
-rw-r--r--crates/hir-ty/src/consteval.rs8
-rw-r--r--crates/hir-ty/src/db.rs19
-rw-r--r--crates/hir-ty/src/diagnostics/match_check/pat_analysis.rs2
-rw-r--r--crates/hir-ty/src/display.rs10
-rw-r--r--crates/hir-ty/src/drop.rs11
-rw-r--r--crates/hir-ty/src/infer.rs14
-rw-r--r--crates/hir-ty/src/infer/cast.rs2
-rw-r--r--crates/hir-ty/src/infer/closure/analysis/expr_use_visitor.rs4
-rw-r--r--crates/hir-ty/src/infer/expr.rs20
-rw-r--r--crates/hir-ty/src/infer/mutability.rs3
-rw-r--r--crates/hir-ty/src/infer/pat.rs6
-rw-r--r--crates/hir-ty/src/inhabitedness.rs2
-rw-r--r--crates/hir-ty/src/layout.rs12
-rw-r--r--crates/hir-ty/src/layout/tests.rs14
-rw-r--r--crates/hir-ty/src/lib.rs6
-rw-r--r--crates/hir-ty/src/lower.rs100
-rw-r--r--crates/hir-ty/src/lower/diagnostics.rs14
-rw-r--r--crates/hir-ty/src/mir.rs328
-rw-r--r--crates/hir-ty/src/mir/borrowck.rs31
-rw-r--r--crates/hir-ty/src/mir/eval.rs75
-rw-r--r--crates/hir-ty/src/mir/eval/shim.rs2
-rw-r--r--crates/hir-ty/src/mir/eval/shim/simd.rs2
-rw-r--r--crates/hir-ty/src/mir/lower.rs84
-rw-r--r--crates/hir-ty/src/mir/lower/pattern_matching.rs48
-rw-r--r--crates/hir-ty/src/mir/pretty.rs81
-rw-r--r--crates/hir-ty/src/next_solver/interner.rs8
-rw-r--r--crates/hir-ty/src/next_solver/ty.rs10
-rw-r--r--crates/hir-ty/src/representability.rs4
-rw-r--r--crates/hir-ty/src/test_db.rs2
-rw-r--r--crates/hir-ty/src/traits.rs98
-rw-r--r--crates/hir-ty/src/variance.rs2
-rw-r--r--crates/hir/src/diagnostics.rs112
-rw-r--r--crates/hir/src/lib.rs52
-rw-r--r--crates/hir/src/semantics.rs17
-rw-r--r--crates/hir/src/source_analyzer.rs67
-rw-r--r--crates/ide-assists/src/handlers/add_missing_impl_members.rs63
-rw-r--r--crates/ide-assists/src/handlers/extract_function.rs59
-rw-r--r--crates/ide-assists/src/handlers/generate_trait_from_impl.rs117
-rw-r--r--crates/ide-db/src/generated/lints.rs49
-rw-r--r--crates/ide-db/src/lib.rs2
-rw-r--r--crates/ide-db/src/syntax_helpers/node_ext.rs3
-rw-r--r--crates/ide-db/src/traits.rs47
-rw-r--r--crates/ide-diagnostics/src/handlers/infer_vars_not_allowed.rs49
-rw-r--r--crates/ide-diagnostics/src/handlers/type_must_be_known.rs13
-rw-r--r--crates/ide-diagnostics/src/lib.rs2
-rw-r--r--crates/ide/src/folding_ranges.rs126
-rw-r--r--crates/ide/src/goto_definition.rs17
-rw-r--r--crates/ide/src/inlay_hints/implicit_drop.rs3
-rw-r--r--crates/ide/src/inlay_hints/param_name.rs8
-rw-r--r--crates/ide/src/lib.rs11
-rw-r--r--crates/ide/src/predicate_eval.rs165
-rw-r--r--crates/intern/Cargo.toml5
-rw-r--r--crates/intern/src/symbol/symbols.rs1
-rw-r--r--crates/parser/src/grammar/expressions/atom.rs4
-rw-r--r--crates/parser/src/grammar/items/adt.rs31
-rw-r--r--crates/parser/src/grammar/types.rs4
-rw-r--r--crates/parser/src/syntax_kind/generated.rs8
-rw-r--r--crates/parser/test_data/generated/runner.rs2
-rw-r--r--crates/parser/test_data/parser/inline/ok/include_bytes.rast23
-rw-r--r--crates/parser/test_data/parser/inline/ok/include_bytes.rs1
-rw-r--r--crates/parser/test_data/parser/ok/0019_enums.rast10
-rw-r--r--crates/parser/test_data/parser/ok/0019_enums.rs1
-rw-r--r--crates/proc-macro-srv/Cargo.toml3
-rw-r--r--crates/proc-macro-srv/src/dylib.rs57
-rw-r--r--crates/proc-macro-srv/src/dylib/proc_macros.rs43
-rw-r--r--crates/proc-macro-srv/src/dylib/version.rs168
-rw-r--r--crates/proc-macro-srv/src/lib.rs6
-rw-r--r--crates/rust-analyzer/src/command.rs6
-rw-r--r--crates/rust-analyzer/src/handlers/request.rs22
-rw-r--r--crates/rust-analyzer/src/lsp/ext.rs33
-rw-r--r--crates/rust-analyzer/src/lsp/to_proto.rs4
-rw-r--r--crates/rust-analyzer/src/main_loop.rs1
-rw-r--r--crates/rust-analyzer/src/target_spec.rs2
-rw-r--r--crates/rust-analyzer/tests/slow-tests/main.rs39
-rw-r--r--crates/syntax/rust.ungram8
-rw-r--r--crates/syntax/src/ast/generated/nodes.rs60
-rw-r--r--crates/syntax/src/ast/prec.rs10
-rw-r--r--crates/syntax/src/ast/token_ext.rs4
-rw-r--r--crates/test-utils/src/fixture.rs10
-rw-r--r--crates/test-utils/src/minicore.rs16
-rw-r--r--docs/book/src/contributing/lsp-extensions.md2
-rw-r--r--editors/code/package.json9
-rw-r--r--editors/code/src/commands.ts96
-rw-r--r--editors/code/src/lsp_ext.ts15
-rw-r--r--editors/code/src/main.ts1
-rw-r--r--rust-version2
-rw-r--r--xtask/src/codegen/grammar/ast_src.rs1
-rw-r--r--xtask/src/tidy.rs6
106 files changed, 2772 insertions, 1288 deletions
diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml
index ef61e397fc..f682937e9d 100644
--- a/.github/workflows/release.yaml
+++ b/.github/workflows/release.yaml
@@ -29,36 +29,44 @@ jobs:
- os: windows-latest
target: x86_64-pc-windows-msvc
code-target: win32-x64
+ allocator: mimalloc
pgo: clap-rs/[email protected]
- os: windows-latest
target: i686-pc-windows-msvc
+ allocator: mimalloc
pgo: clap-rs/[email protected]
- os: windows-latest
target: aarch64-pc-windows-msvc
code-target: win32-arm64
+ allocator: mimalloc
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
# Use a container with glibc 2.28
# Zig is not used because it doesn't work with PGO
container: quay.io/pypa/manylinux_2_28_x86_64
code-target: linux-x64
+ allocator: system
pgo: clap-rs/[email protected]
- os: ubuntu-24.04-arm
target: aarch64-unknown-linux-gnu
container: quay.io/pypa/manylinux_2_28_aarch64
code-target: linux-arm64
+ allocator: system
pgo: clap-rs/[email protected]
- os: ubuntu-latest
target: arm-unknown-linux-gnueabihf
zig_target: arm-unknown-linux-gnueabihf.2.28
code-target: linux-armhf
+ allocator: system
- os: macos-14
target: x86_64-apple-darwin
code-target: darwin-x64
+ allocator: system
pgo: clap-rs/[email protected]
- os: macos-14
target: aarch64-apple-darwin
code-target: darwin-arm64
+ allocator: system
pgo: clap-rs/[email protected]
name: dist (${{ matrix.target }})
@@ -67,6 +75,7 @@ jobs:
env:
RA_TARGET: ${{ matrix.target }}
+ ALLOCATOR_FLAG: ${{ matrix.allocator != 'system' && format('--{0}', matrix.allocator) || '' }}
steps:
- name: Checkout repository
@@ -102,11 +111,11 @@ jobs:
- name: Dist (plain)
if: ${{ !matrix.zig_target }}
- run: cargo xtask dist --client-patch-version ${{ github.run_number }} ${{ matrix.pgo && format('--pgo {0}', matrix.pgo) || ''}}
+ run: cargo xtask dist --client-patch-version ${{ github.run_number }} ${{ env.ALLOCATOR_FLAG }} ${{ matrix.pgo && format('--pgo {0}', matrix.pgo) || ''}}
- name: Dist (using zigbuild)
if: ${{ matrix.zig_target }}
- run: RA_TARGET=${{ matrix.zig_target}} cargo xtask dist --client-patch-version ${{ github.run_number }} --zig ${{ matrix.pgo && format('--pgo {0}', matrix.pgo) || ''}}
+ run: RA_TARGET=${{ matrix.zig_target}} cargo xtask dist --client-patch-version ${{ github.run_number }} --zig ${{ env.ALLOCATOR_FLAG }} ${{ matrix.pgo && format('--pgo {0}', matrix.pgo) || ''}}
- run: npm ci
working-directory: editors/code
diff --git a/.github/workflows/rustdoc.yaml b/.github/workflows/rustdoc.yaml
index c5588a29f6..7039f78eb1 100644
--- a/.github/workflows/rustdoc.yaml
+++ b/.github/workflows/rustdoc.yaml
@@ -31,7 +31,7 @@ jobs:
- name: Deploy Docs
if: github.event_name == 'push' && github.repository == 'rust-lang/rust-analyzer' && github.ref == 'refs/heads/master'
- uses: peaceiris/actions-gh-pages@4f9cc6602d3f66b9c108549d475ec49e8ef4d45e # v4.0.0
+ uses: peaceiris/actions-gh-pages@84c30a85c19949d7eee79c4ff27748b70285e453 # v4.1.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_branch: gh-pages
diff --git a/AI_POLICY.md b/AI_POLICY.md
new file mode 100644
index 0000000000..f5912a3c19
--- /dev/null
+++ b/AI_POLICY.md
@@ -0,0 +1,28 @@
+We allow using AI (i.e., LLMs) as tools for contributing to rust-analyzer.
+However, you remain responsible for any code you publish and we are responsible for any code we merge and release.
+We hold a high bar for all contributions to our projects.
+
+**AI should not be used to generate comments when communicating with maintainers**.
+We expect comments on our projects to be written by humans.
+We may hide any comments that we believe are AI generated.
+
+If you are opening an issue, we expect you to describe the problem in your own words.
+
+If you are opening a pull request, we expect you to be able to explain the proposed changes in your own words. This includes the pull request body and responses to questions.
+**Do not copy responses from the AI when replying to questions from maintainers.**
+
+Due to the foundational nature of our projects, we require a human in the loop who understands the work produced by AI.
+**We do not allow autonomous agents to be used to open pull requests or issues to our projects**.
+We will close any pull requests that we believe were created autonomously.
+
+If you wish to include context from an interaction with AI in your comments, it must be in a quote block (e.g., using `>`) and disclosed as such.
+It must be accompanied by human commentary explaining the relevance and implications of the context.
+Do not share long snippets.
+
+We understand that AI is useful when communicating as a non-native English speaker.
+If you are using AI to edit your comments for this purpose, please take the time to ensure it reflects your own voice and ideas.
+If using AI for translation, we recommend writing in your native language and including the AI translation in a quote block.
+
+This policy was adapted from [uv's AI policy].
+
+[uv's AI policy]: https://github.com/astral-sh/.github/blob/c5187e200db51bfe11d56e13053d29bd3793fdd8/AI_POLICY.md
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index e6ab3d75a0..b6a2210ca5 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -34,10 +34,8 @@ it out of scope (be it due to generally not fitting in with rust-analyzer, or ju
maintenance capacity). If there already is a feature issue open but it is not clear whether it is
considered accepted feel free to just drop a comment and ask!
-## Use of AI tools
+## Use of AI
-AI tool use is not discouraged on the rust-analyzer codebase, as long as it meets our quality standards.
-We kindly ask you to disclose usage of AI tools in your contributions.
-If you used them without disclosing it, we may reject your contribution on that basis alone due to the assumption that you have, most likely, not reviewed your own submission (so why should we?).
+All use of AI in contributions must follow the [AI Policy](./AI_POLICY.md).
-We may still reject AI-assisted contributions if we deem the quality of the contribution to be unsatisfactory as to reduce impact on the team's review budget.
+Contributions not following the AI Policy will be closed.
diff --git a/Cargo.lock b/Cargo.lock
index 440ceb362d..5e39dfe870 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -4,9 +4,9 @@ version = 4
[[package]]
name = "addr2line"
-version = "0.24.2"
+version = "0.25.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "dfbe277e56a376000877090da837660b4427aad530e3028d44e0bffe4f89a1c1"
+checksum = "1b5d307320b3181d6d7954e663bd7c774a838b8220fe0593c86d9fb09f498b4b"
dependencies = [
"gimli",
]
@@ -40,15 +40,15 @@ checksum = "4b46cbb362ab8752921c97e041f5e366ee6297bd428a31275b9fcf1e380f7299"
[[package]]
name = "anstyle"
-version = "1.0.11"
+version = "1.0.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "862ed96ca487e809f1c8e5a8447f6ee2cf102f846893800b20cebdf541fc6bbd"
+checksum = "940b3a0ca603d1eade50a4846a2afffd5ef57a9feac2c0e2ec2e14f9ead76000"
[[package]]
name = "anyhow"
-version = "1.0.100"
+version = "1.0.102"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a23eb6b1614318a8071c9b2521f36b424b2c83db5eb3a0fead4a6c0809af6e61"
+checksum = "7f202df86484c868dbad7eaa557ef785d5c66295e41b460ef922eca0723b842c"
[[package]]
name = "arbitrary"
@@ -76,23 +76,23 @@ dependencies = [
[[package]]
name = "autocfg"
-version = "1.5.0"
+version = "1.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8"
+checksum = "f2032f911046de80f0a198e0901378627c33f59ea0ac00e363d481118bd70a53"
[[package]]
name = "backtrace"
-version = "0.3.75"
+version = "0.3.76"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6806a6321ec58106fea15becdad98371e28d92ccbc7c8f1b3b6dd724fe8f1002"
+checksum = "bb531853791a215d7c62a30daf0dde835f381ab5de4589cfe7c649d2cbe92bd6"
dependencies = [
"addr2line",
"cfg-if",
"libc",
"miniz_oxide",
- "object",
+ "object 0.37.3",
"rustc-demangle",
- "windows-targets 0.52.6",
+ "windows-link",
]
[[package]]
@@ -105,7 +105,7 @@ dependencies = [
"intern",
"la-arena 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
"query-group-macro",
- "rustc-hash 2.1.1",
+ "rustc-hash 2.1.2",
"salsa",
"salsa-macros",
"semver",
@@ -145,16 +145,26 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
[[package]]
name = "bitflags"
-version = "2.9.4"
+version = "2.12.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "84d7ced0ae9557296835c32bf1b1e02b44c746701f898460fb000d7eaa84f00a"
+
+[[package]]
+name = "block2"
+version = "0.6.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2261d10cca569e4643e526d8dc2e62e433cc8aba21ab764233731f8d369bf394"
+checksum = "cdeb9d870516001442e364c5220d3574d2da8dc765554b4a617230d33fa58ef5"
+dependencies = [
+ "objc2",
+]
[[package]]
name = "borsh"
-version = "1.5.7"
+version = "1.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ad8646f98db542e39fc66e68a20b2144f6a732636df7c2354e74645faaa433ce"
+checksum = "cfd1e3f8955a5d7de9fab72fc8373fade9fb8a703968cb200ae3dc6cf08e185a"
dependencies = [
+ "bytes",
"cfg_aliases",
]
@@ -166,9 +176,9 @@ checksum = "36f64beae40a84da1b4b26ff2761a5b895c12adc41dc25aaee1c4f2bbfe97a6e"
[[package]]
name = "bumpalo"
-version = "3.19.0"
+version = "3.20.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "46c5e41b57b8bba42a04676d81cb89e9ee8e859a1a66f80a5a72e1cb76b34d43"
+checksum = "72f5acc6cb2ba439de613abc23857ec3d78374d8ed5ac84e9d11336e87da8649"
[[package]]
name = "byteorder"
@@ -177,6 +187,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b"
[[package]]
+name = "bytes"
+version = "1.11.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1e748733b7cbc798e1434b6ac524f0c1ff2ab456fe201501e6497c8417a4fc33"
+
+[[package]]
name = "camino"
version = "1.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -187,25 +203,26 @@ dependencies = [
[[package]]
name = "cargo-platform"
-version = "0.3.1"
+version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "122ec45a44b270afd1402f351b782c676b173e3c3fb28d86ff7ebfb4d86a4ee4"
+checksum = "dd0061da739915fae12ea00e16397555ed4371a6bb285431aab930f61b0aa4ba"
dependencies = [
"serde",
+ "serde_core",
]
[[package]]
name = "cargo_metadata"
-version = "0.23.0"
+version = "0.23.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "981a6f317983eec002839b90fae7411a85621410ae591a9cab2ecf5cb5744873"
+checksum = "ef987d17b0a113becdd19d3d0022d04d7ef41f9efe4f3fb63ac44ba61df3ade9"
dependencies = [
"camino",
"cargo-platform",
"semver",
"serde",
"serde_json",
- "thiserror 2.0.16",
+ "thiserror 2.0.18",
]
[[package]]
@@ -216,9 +233,9 @@ checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5"
[[package]]
name = "cc"
-version = "1.2.38"
+version = "1.2.63"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "80f41ae168f955c12fb8960b057d70d0ca153fb83182b57d86380443527be7e9"
+checksum = "556e016178bb5662a08681bbe0f00f8e17631781a4dfc8c45e466e4b185ec27f"
dependencies = [
"find-msvc-tools",
"shlex",
@@ -233,7 +250,7 @@ dependencies = [
"expect-test",
"intern",
"oorandom",
- "rustc-hash 2.1.1",
+ "rustc-hash 2.1.2",
"syntax",
"syntax-bridge",
"tracing",
@@ -242,9 +259,9 @@ dependencies = [
[[package]]
name = "cfg-if"
-version = "1.0.3"
+version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2fd1289c04a9ea8cb22300a459a72a385d7c73d3259e2ed7dcb2af674838cfa9"
+checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801"
[[package]]
name = "cfg_aliases"
@@ -281,18 +298,18 @@ dependencies = [
[[package]]
name = "clap"
-version = "4.5.48"
+version = "4.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e2134bb3ea021b78629caa971416385309e0131b351b25e01dc16fb54e1b5fae"
+checksum = "1ddb117e43bbf7dacf0a4190fef4d345b9bad68dfc649cb349e7d17d28428e51"
dependencies = [
"clap_builder",
]
[[package]]
name = "clap_builder"
-version = "4.5.48"
+version = "4.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c2ba64afa3c0a6df7fa517765e31314e983f51dda798ffba27b988194fb65dc9"
+checksum = "714a53001bf66416adb0e2ef5ac857140e7dc3a0c48fb28b2f10762fc4b5069f"
dependencies = [
"anstyle",
"clap_lex",
@@ -300,9 +317,9 @@ dependencies = [
[[package]]
name = "clap_lex"
-version = "0.7.5"
+version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b94f61472cee1439c0b966b47e3aca9ae07e45d070759512cd390ea2bebc6675"
+checksum = "c8d4a3bb8b1e0c1050499d1815f5ab16d04f0959b233085fb31653fbfc9d98f9"
[[package]]
name = "cobs"
@@ -310,7 +327,7 @@ version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0fa961b519f0b462e3a3b4a34b64d119eeaca1d59af726fe450bbba07a9fc0a1"
dependencies = [
- "thiserror 2.0.16",
+ "thiserror 2.0.18",
]
[[package]]
@@ -321,9 +338,9 @@ checksum = "7704b5fdd17b18ae31c4c1da5a2e0305a2bf17b5249300a9ee9ed7b72114c636"
[[package]]
name = "cov-mark"
-version = "2.1.0"
+version = "2.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3f1d92727879fb4f24cec33a35e3bff74035541326cbc12ad44ba8886d1927b0"
+checksum = "90863d8442510cddf7f46618c4f92413774635771a3e80830c8b30d183420b14"
[[package]]
name = "crc32fast"
@@ -424,20 +441,20 @@ checksum = "460fbee9c2c2f33933d720630a6a0bac33ba7053db5344fac858d4b8952d77d5"
[[package]]
name = "ctrlc"
-version = "3.5.0"
+version = "3.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "881c5d0a13b2f1498e2306e82cbada78390e152d4b1378fb28a84f4dcd0dc4f3"
+checksum = "e0b1fab2ae45819af2d0731d60f2afe17227ebb1a1538a236da84c93e9a60162"
dependencies = [
- "dispatch",
+ "dispatch2",
"nix",
- "windows-sys 0.61.0",
+ "windows-sys 0.61.2",
]
[[package]]
name = "dashmap"
-version = "6.1.0"
+version = "6.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5041cc499144891f3790297212f32a74fb938e5136a14943f338ef9e0ae276cf"
+checksum = "e6361d5c062261c78a176addb82d4c821ae42bed6089de0e12603cd25de2059c"
dependencies = [
"cfg-if",
"crossbeam-utils",
@@ -449,9 +466,9 @@ dependencies = [
[[package]]
name = "deranged"
-version = "0.5.3"
+version = "0.5.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d630bccd429a5bb5a64b5e94f693bfc48c9f8566418fda4c494cc94f911f87cc"
+checksum = "7cd812cc2bc1d69d4764bd80df88b4317eaef9e773c75226407d9bc0876b211c"
dependencies = [
"powerfmt",
]
@@ -512,20 +529,26 @@ dependencies = [
"libc",
"option-ext",
"redox_users",
- "windows-sys 0.61.0",
+ "windows-sys 0.61.2",
]
[[package]]
-name = "dispatch"
-version = "0.2.0"
+name = "dispatch2"
+version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bd0c93bb4b0c6d9b77f4435b0ae98c24d17f1c45b2ff844c6151a07256ca923b"
+checksum = "1e0e367e4e7da84520dedcac1901e4da967309406d1e51017ae1abfb97adbd38"
+dependencies = [
+ "bitflags 2.12.1",
+ "block2",
+ "libc",
+ "objc2",
+]
[[package]]
name = "displaydoc"
-version = "0.2.5"
+version = "0.2.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0"
+checksum = "1ac70aa55017e108007fbaf5aa0f54b021c98f92ff8af59d42eda9da96e3dd4f"
dependencies = [
"proc-macro2",
"quote",
@@ -534,9 +557,9 @@ dependencies = [
[[package]]
name = "dissimilar"
-version = "1.0.10"
+version = "1.0.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8975ffdaa0ef3661bfe02dbdcc06c9f829dfafe6a3c474de366a8d5e44276921"
+checksum = "aeda16ab4059c5fd2a83f2b9c9e9c981327b18aa8e3b313f7e6563799d4f093e"
[[package]]
name = "dot"
@@ -556,9 +579,9 @@ version = "0.0.0"
[[package]]
name = "either"
-version = "1.15.0"
+version = "1.16.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719"
+checksum = "91622ff5e7162018101f2fea40d6ebf4a78bbe5a49736a2020649edf9693679e"
[[package]]
name = "embedded-io"
@@ -574,9 +597,9 @@ checksum = "edd0f118536f44f5ccd48bcb8b111bdc3de888b58c74639dfb034a357d0f206d"
[[package]]
name = "ena"
-version = "0.14.3"
+version = "0.14.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3d248bdd43ce613d87415282f69b9bb99d947d290b10962dd6c56233312c2ad5"
+checksum = "eabffdaee24bd1bf95c5ef7cec31260444317e72ea56c4c91750e8b7ee58d5f1"
dependencies = [
"log",
]
@@ -594,7 +617,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb"
dependencies = [
"libc",
- "windows-sys 0.61.0",
+ "windows-sys 0.61.2",
]
[[package]]
@@ -609,15 +632,15 @@ dependencies = [
[[package]]
name = "fastrand"
-version = "2.3.0"
+version = "2.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be"
+checksum = "9f1f227452a390804cdb637b74a86990f2a7d7ba4b7d5693aac9b4dd6defd8d6"
[[package]]
name = "find-msvc-tools"
-version = "0.1.2"
+version = "0.1.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1ced73b1dacfc750a6db6c0a0c3a3853c8b41997e2e2c563dc90804ae6867959"
+checksum = "5baebc0774151f905a1a2cc41989300b1e6fbb29aff0ceffa1064fdd3088d582"
[[package]]
name = "fixedbitset"
@@ -627,9 +650,9 @@ checksum = "1d674e81391d1e1ab681a28d99df07927c6d4aa5b027d7da16ba32d1d21ecd99"
[[package]]
name = "flate2"
-version = "1.1.2"
+version = "1.1.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4a3d7db9596fecd151c5f638c0ee5d5bd487b6e0ea232e5dc96d5250f6f94b1d"
+checksum = "843fba2746e448b37e26a819579957415c8cef339bf08564fe8b7ddbd959573c"
dependencies = [
"crc32fast",
"miniz_oxide",
@@ -678,10 +701,34 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7ab85b9b05e3978cc9a9cf8fea7f01b494e1a09ed3037e16ba39edc7a29eb61a"
[[package]]
+name = "futures-core"
+version = "0.3.32"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7e3450815272ef58cec6d564423f6e755e25379b217b0bc688e295ba24df6b1d"
+
+[[package]]
+name = "futures-task"
+version = "0.3.32"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "037711b3d59c33004d3856fbdc83b99d4ff37a24768fa1be9ce3538a1cde4393"
+
+[[package]]
+name = "futures-util"
+version = "0.3.32"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "389ca41296e6190b48053de0321d02a77f32f8a5d2461dd38762c0593805c6d6"
+dependencies = [
+ "futures-core",
+ "futures-task",
+ "pin-project-lite",
+ "slab",
+]
+
+[[package]]
name = "getrandom"
-version = "0.2.16"
+version = "0.2.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "335ff9f135e4384c8150d6f27c6daed433577f86b4750418338c01a1a2528592"
+checksum = "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0"
dependencies = [
"cfg-if",
"libc",
@@ -696,15 +743,28 @@ checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd"
dependencies = [
"cfg-if",
"libc",
- "r-efi",
+ "r-efi 5.3.0",
+ "wasip2",
+]
+
+[[package]]
+name = "getrandom"
+version = "0.4.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0de51e6874e94e7bf76d726fc5d13ba782deca734ff60d5bb2fb2607c7406555"
+dependencies = [
+ "cfg-if",
+ "libc",
+ "r-efi 6.0.0",
"wasip2",
+ "wasip3",
]
[[package]]
name = "gimli"
-version = "0.31.1"
+version = "0.32.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f"
+checksum = "e629b9b98ef3dd8afe6ca2bd0f89306cec16d43d907889945bc5d6687f2f13c7"
[[package]]
name = "half"
@@ -738,22 +798,23 @@ version = "0.15.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1"
dependencies = [
- "allocator-api2",
- "equivalent",
"foldhash 0.1.5",
]
[[package]]
name = "hashbrown"
-version = "0.16.0"
+version = "0.16.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5419bdc4f6a9207fbeba6d11b604d481addf78ecd10c11ad51e76c2f6482748d"
+checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100"
+dependencies = [
+ "foldhash 0.2.0",
+]
[[package]]
name = "hashbrown"
-version = "0.17.0"
+version = "0.17.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4f467dd6dccf739c208452f8014c75c18bb8301b050ad1cfb27153803edb0f51"
+checksum = "ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a"
dependencies = [
"allocator-api2",
"equivalent",
@@ -762,11 +823,11 @@ dependencies = [
[[package]]
name = "hashlink"
-version = "0.10.0"
+version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7382cf6263419f2d8df38c55d7da83da5c18aef87fc7a7fc1fb1e344edfe14c1"
+checksum = "ea0b22561a9c04a7cb1a302c013e0259cd3b4bb619f145b32f72b8b4bcbed230"
dependencies = [
- "hashbrown 0.15.5",
+ "hashbrown 0.16.1",
]
[[package]]
@@ -784,6 +845,12 @@ dependencies = [
]
[[package]]
+name = "heck"
+version = "0.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
+
+[[package]]
name = "hermit-abi"
version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -805,7 +872,7 @@ dependencies = [
"itertools 0.14.0",
"la-arena 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
"ra-ap-rustc_type_ir",
- "rustc-hash 2.1.1",
+ "rustc-hash 2.1.2",
"serde_json",
"smallvec",
"span",
@@ -827,7 +894,7 @@ version = "0.0.0"
dependencies = [
"arrayvec",
"base-db",
- "bitflags 2.9.4",
+ "bitflags 2.12.1",
"cfg",
"cov-mark",
"drop_bomb",
@@ -842,7 +909,7 @@ dependencies = [
"query-group-macro",
"ra-ap-rustc_abi",
"ra-ap-rustc_parse_format",
- "rustc-hash 2.1.1",
+ "rustc-hash 2.1.2",
"rustc_apfloat",
"salsa",
"salsa-macros",
@@ -873,7 +940,7 @@ dependencies = [
"mbe",
"parser",
"query-group-macro",
- "rustc-hash 2.1.1",
+ "rustc-hash 2.1.2",
"salsa",
"salsa-macros",
"smallvec",
@@ -893,7 +960,7 @@ version = "0.0.0"
dependencies = [
"arrayvec",
"base-db",
- "bitflags 2.9.4",
+ "bitflags 2.12.1",
"cov-mark",
"either",
"ena",
@@ -915,7 +982,7 @@ dependencies = [
"ra-ap-rustc_next_trait_solver",
"ra-ap-rustc_pattern_analysis",
"ra-ap-rustc_type_ir",
- "rustc-hash 2.1.1",
+ "rustc-hash 2.1.2",
"rustc_apfloat",
"salsa",
"salsa-macros",
@@ -941,17 +1008,18 @@ version = "0.5.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cc627f471c528ff0c4a49e1d5e60450c8f6461dd6d10ba9dcd3a61d3dff7728d"
dependencies = [
- "windows-sys 0.61.0",
+ "windows-sys 0.61.2",
]
[[package]]
name = "icu_collections"
-version = "2.0.0"
+version = "2.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "200072f5d0e3614556f94a9930d5dc3e0662a652823904c3a75dc3b0af7fee47"
+checksum = "2984d1cd16c883d7935b9e07e44071dca8d917fd52ecc02c04d5fa0b5a3f191c"
dependencies = [
"displaydoc",
"potential_utf",
+ "utf8_iter",
"yoke",
"zerofrom",
"zerovec",
@@ -959,9 +1027,9 @@ dependencies = [
[[package]]
name = "icu_locale_core"
-version = "2.0.0"
+version = "2.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0cde2700ccaed3872079a65fb1a78f6c0a36c91570f28755dda67bc8f7d9f00a"
+checksum = "92219b62b3e2b4d88ac5119f8904c10f8f61bf7e95b640d25ba3075e6cac2c29"
dependencies = [
"displaydoc",
"litemap",
@@ -972,11 +1040,10 @@ dependencies = [
[[package]]
name = "icu_normalizer"
-version = "2.0.0"
+version = "2.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "436880e8e18df4d7bbc06d58432329d6458cc84531f7ac5f024e93deadb37979"
+checksum = "c56e5ee99d6e3d33bd91c5d85458b6005a22140021cc324cea84dd0e72cff3b4"
dependencies = [
- "displaydoc",
"icu_collections",
"icu_normalizer_data",
"icu_properties",
@@ -987,42 +1054,38 @@ dependencies = [
[[package]]
name = "icu_normalizer_data"
-version = "2.0.0"
+version = "2.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "00210d6893afc98edb752b664b8890f0ef174c8adbb8d0be9710fa66fbbf72d3"
+checksum = "da3be0ae77ea334f4da67c12f149704f19f81d1adf7c51cf482943e84a2bad38"
[[package]]
name = "icu_properties"
-version = "2.0.1"
+version = "2.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "016c619c1eeb94efb86809b015c58f479963de65bdb6253345c1a1276f22e32b"
+checksum = "bee3b67d0ea5c2cca5003417989af8996f8604e34fb9ddf96208a033901e70de"
dependencies = [
- "displaydoc",
"icu_collections",
"icu_locale_core",
"icu_properties_data",
"icu_provider",
- "potential_utf",
"zerotrie",
"zerovec",
]
[[package]]
name = "icu_properties_data"
-version = "2.0.1"
+version = "2.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "298459143998310acd25ffe6810ed544932242d3f07083eee1084d83a71bd632"
+checksum = "8e2bbb201e0c04f7b4b3e14382af113e17ba4f63e2c9d2ee626b720cbce54a14"
[[package]]
name = "icu_provider"
-version = "2.0.0"
+version = "2.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "03c80da27b5f4187909049ee2d72f276f0d9f99a42c306bd0131ecfe04d8e5af"
+checksum = "139c4cf31c8b5f33d7e199446eff9c1e02decfc2f0eec2c8d71f65befa45b421"
dependencies = [
"displaydoc",
"icu_locale_core",
- "stable_deref_trait",
- "tinystr",
"writeable",
"yoke",
"zerofrom",
@@ -1031,6 +1094,12 @@ dependencies = [
]
[[package]]
+name = "id-arena"
+version = "2.3.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3d3067d79b975e8844ca9eb072e16b31c3c1c36928edf9c6789548c524d0d954"
+
+[[package]]
name = "ide"
version = "0.0.0"
dependencies = [
@@ -1109,7 +1178,7 @@ version = "0.0.0"
dependencies = [
"arrayvec",
"base-db",
- "bitflags 2.9.4",
+ "bitflags 2.12.1",
"cov-mark",
"crossbeam-channel",
"either",
@@ -1124,7 +1193,7 @@ dependencies = [
"parser",
"profile",
"rayon",
- "rustc-hash 2.1.1",
+ "rustc-hash 2.1.2",
"salsa",
"salsa-macros",
"smallvec",
@@ -1187,9 +1256,9 @@ dependencies = [
[[package]]
name = "idna_adapter"
-version = "1.2.1"
+version = "1.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3acae9609540aa318d1bc588455225fb2085b9ed0c4f6bd0d9d5bcd86f1a0344"
+checksum = "cb68373c0d6620ef8105e855e7745e18b0d00d3bdb07fb532e434244cdb9a714"
dependencies = [
"icu_normalizer",
"icu_properties",
@@ -1197,23 +1266,23 @@ dependencies = [
[[package]]
name = "indexmap"
-version = "2.11.4"
+version = "2.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4b0f83760fb341a774ed326568e19f5a863af4a952def8c39f9ab92fd95b88e5"
+checksum = "d466e9454f08e4a911e14806c24e16fba1b4c121d1ea474396f396069cf949d9"
dependencies = [
"equivalent",
- "hashbrown 0.16.0",
+ "hashbrown 0.17.1",
"serde",
"serde_core",
]
[[package]]
name = "inotify"
-version = "0.11.0"
+version = "0.11.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f37dccff2791ab604f9babef0ba14fbe0be30bd368dc541e2b08d07c8aa908f3"
+checksum = "533e68a5842e734946fe159fb03fc9bbbb254f590dd0d8ad321ae5ff7beca2c1"
dependencies = [
- "bitflags 2.9.4",
+ "bitflags 2.12.1",
"inotify-sys",
"libc",
]
@@ -1235,15 +1304,15 @@ dependencies = [
"dashmap",
"hashbrown 0.14.5",
"rayon",
- "rustc-hash 2.1.1",
+ "rustc-hash 2.1.2",
"triomphe",
]
[[package]]
name = "intrusive-collections"
-version = "0.9.7"
+version = "0.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "189d0897e4cbe8c75efedf3502c18c887b05046e59d28404d4d8e46cbc4d1e86"
+checksum = "80e165935eba36cb526af8389effd2005a741adcbb6ed32106cc68e3f7b92960"
dependencies = [
"memoffset",
]
@@ -1277,9 +1346,9 @@ dependencies = [
[[package]]
name = "itoa"
-version = "1.0.15"
+version = "1.0.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c"
+checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682"
[[package]]
name = "jod-thread"
@@ -1289,19 +1358,21 @@ checksum = "a037eddb7d28de1d0fc42411f501b53b75838d313908078d6698d064f3029b24"
[[package]]
name = "js-sys"
-version = "0.3.82"
+version = "0.3.99"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b011eec8cc36da2aab2d5cff675ec18454fad408585853910a202391cf9f8e65"
+checksum = "142bc4740e452c1e57ade0cbc129f139c9093e354346f0872ef985f4f5cf5f11"
dependencies = [
+ "cfg-if",
+ "futures-util",
"once_cell",
"wasm-bindgen",
]
[[package]]
name = "kqueue"
-version = "1.1.1"
+version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "eac30106d7dce88daf4a3fcb4879ea939476d5074a9b7ddd0fb97fa4bed5596a"
+checksum = "273c0752728918e0ac4976f2b275b6fefb9ecd400585dec929419f3844cd87b5"
dependencies = [
"kqueue-sys",
"libc",
@@ -1309,11 +1380,11 @@ dependencies = [
[[package]]
name = "kqueue-sys"
-version = "1.0.4"
+version = "1.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ed9625ffda8729b85e45cf04090035ac368927b8cebc34898e7c120f52e4838b"
+checksum = "07293a4e297ac234359b510362495713f75ea345d5307140414f20c69ffeb087"
dependencies = [
- "bitflags 1.3.2",
+ "bitflags 2.12.1",
"libc",
]
@@ -1334,10 +1405,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"
[[package]]
+name = "leb128fmt"
+version = "0.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "09edd9e8b54e49e587e4f6295a7d29c3ea94d469cb40ab8ca70b288248a81db2"
+
+[[package]]
name = "libc"
-version = "0.2.175"
+version = "0.2.186"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6a82ae493e598baaea5209805c49bbf2ea7de956d50d7da0da1164f9c6d28543"
+checksum = "68ab91017fe16c622486840e4c83c9a37afeff978bd239b5293d61ece587de66"
[[package]]
name = "libloading"
@@ -1346,26 +1423,24 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d7c4b02199fee7c5d21a5ae7d8cfa79a6ef5bb2fc834d6e9058e89c825efdc55"
dependencies = [
"cfg-if",
- "windows-link 0.2.0",
+ "windows-link",
]
[[package]]
name = "libmimalloc-sys"
-version = "0.1.44"
+version = "0.1.49"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "667f4fec20f29dfc6bc7357c582d91796c169ad7e2fce709468aefeb2c099870"
+checksum = "6a45a52f43e1c16f667ccfe4dd8c85b7f7c204fd5e3bf46c5b0db9a5c3c0b8e9"
dependencies = [
"cc",
- "libc",
]
[[package]]
name = "libredox"
-version = "0.1.10"
+version = "0.1.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "416f7e718bdb06000964960ffa43b4335ad4012ae8b99060261aa4a8088d5ccb"
+checksum = "f02ab6bace2054fb888a3c16f990117b579d14a3088e472d63c6011fa185c9d3"
dependencies = [
- "bitflags 2.9.4",
"libc",
]
@@ -1390,15 +1465,15 @@ dependencies = [
[[package]]
name = "linux-raw-sys"
-version = "0.11.0"
+version = "0.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "df1d3c3b53da64cf5760482273a98e575c651a67eec7f77df96b5b642de8f039"
+checksum = "32a66949e030da00e8c7d4434b251670a91556f4144941d37452769c25d58a53"
[[package]]
name = "litemap"
-version = "0.8.0"
+version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "241eaef5fd12c88705a01fc1066c48c4b36e0dd4377dcdc7ec3942cea7a69956"
+checksum = "92daf443525c4cce67b150400bc2316076100ce0b3686209eb8cf3c31612e6f0"
[[package]]
name = "load-cargo"
@@ -1421,19 +1496,18 @@ dependencies = [
[[package]]
name = "lock_api"
-version = "0.4.13"
+version = "0.4.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "96936507f153605bddfcda068dd804796c84324ed2510809e5b2a624c81da765"
+checksum = "224399e74b87b5f3557511d98dff8b14089b3dadafcab6bb93eab67d3aace965"
dependencies = [
- "autocfg",
"scopeguard",
]
[[package]]
name = "log"
-version = "0.4.28"
+version = "0.4.31"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "34080505efa8e45a4b816c349525ebe327ceaa8559756f0356cba97ef3bf7432"
+checksum = "113b30b4cd05f7c06868fdb2854f66a7b9fece9a48425351cd532e810d74024f"
[[package]]
name = "lsp-server"
@@ -1444,7 +1518,7 @@ dependencies = [
"ctrlc",
"log",
"lsp-types",
- "rustc-hash 2.1.1",
+ "rustc-hash 2.1.2",
"serde",
"serde_derive",
"serde_json",
@@ -1492,13 +1566,13 @@ name = "mbe"
version = "0.0.0"
dependencies = [
"arrayvec",
- "bitflags 2.9.4",
+ "bitflags 2.12.1",
"cov-mark",
"expect-test",
"intern",
"parser",
"ra-ap-rustc_lexer",
- "rustc-hash 2.1.1",
+ "rustc-hash 2.1.2",
"salsa",
"smallvec",
"span",
@@ -1511,15 +1585,15 @@ dependencies = [
[[package]]
name = "memchr"
-version = "2.7.6"
+version = "2.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f52b00d39961fc5b2736ea853c9cc86238e165017a493d1d5c8eac6bdc4cc273"
+checksum = "6b947ae49db0d222b1dbc6b113ce7248a3fc3a6ca21b696717bfc000ba4484d8"
[[package]]
name = "memmap2"
-version = "0.9.8"
+version = "0.9.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "843a98750cd611cc2965a8213b53b43e715f13c37a9e096c6408e69990961db7"
+checksum = "714098028fe011992e1c3962653c96b2d578c4b4bce9036e15ff220319b1e0e3"
dependencies = [
"libc",
]
@@ -1535,9 +1609,9 @@ dependencies = [
[[package]]
name = "mimalloc"
-version = "0.1.48"
+version = "0.1.52"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e1ee66a4b64c74f4ef288bcbb9192ad9c3feaad75193129ac8509af543894fd8"
+checksum = "2d4139bb28d14ad1facf21d5eb8825051b326e172d216b39f6d31df53cc97862"
dependencies = [
"libmimalloc-sys",
]
@@ -1549,6 +1623,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316"
dependencies = [
"adler2",
+ "simd-adler32",
]
[[package]]
@@ -1559,14 +1634,14 @@ checksum = "c505b3e17ed6b70a7ed2e67fbb2c560ee327353556120d6e72f5232b6880d536"
[[package]]
name = "mio"
-version = "1.1.0"
+version = "1.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "69d83b0086dc8ecf3ce9ae2874b2d1290252e2a30720bea58a5c6639b0092873"
+checksum = "02bd0af71c67b473010cbbc60715ee815645a4dc942899111f494b4b737d6fda"
dependencies = [
"libc",
"log",
"wasi",
- "windows-sys 0.61.0",
+ "windows-sys 0.61.2",
]
[[package]]
@@ -1575,16 +1650,16 @@ version = "0.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "536bfad37a309d62069485248eeaba1e8d9853aaf951caaeaed0585a95346f08"
dependencies = [
- "windows-sys 0.61.0",
+ "windows-sys 0.61.2",
]
[[package]]
name = "nix"
-version = "0.30.1"
+version = "0.31.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "74523f3a35e05aba87a1d978330aef40f67b0304ac79c1c00b294c9830543db6"
+checksum = "cf20d2fde8ff38632c426f1165ed7436270b44f199fc55284c38276f9db47c3d"
dependencies = [
- "bitflags 2.9.4",
+ "bitflags 2.12.1",
"cfg-if",
"cfg_aliases",
"libc",
@@ -1602,7 +1677,7 @@ version = "8.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4d3d07927151ff8575b7087f245456e549fea62edf0ec4e565a5ee50c8402bc3"
dependencies = [
- "bitflags 2.9.4",
+ "bitflags 2.12.1",
"fsevent-sys",
"inotify",
"kqueue",
@@ -1616,9 +1691,12 @@ dependencies = [
[[package]]
name = "notify-types"
-version = "2.0.0"
+version = "2.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5e0826a989adedc2a244799e823aece04662b66609d96af8dff7ac6df9a8925d"
+checksum = "42b8cfee0e339a0337359f3c88165702ac6e600dc01c0cc9579a92d62b08477a"
+dependencies = [
+ "bitflags 2.12.1",
+]
[[package]]
name = "nu-ansi-term"
@@ -1626,14 +1704,14 @@ version = "0.50.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5"
dependencies = [
- "windows-sys 0.61.0",
+ "windows-sys 0.61.2",
]
[[package]]
name = "num-conv"
-version = "0.2.0"
+version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "cf97ec579c3c42f953ef76dbf8d55ac91fb219dde70e49aa4a6b7d74e9919050"
+checksum = "521739c6d2bac4aa25192232afe6841231376b2b26d4d9fae5ecf8ca5772e441"
[[package]]
name = "num-traits"
@@ -1664,6 +1742,21 @@ dependencies = [
]
[[package]]
+name = "objc2"
+version = "0.6.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3a12a8ed07aefc768292f076dc3ac8c48f3781c8f2d5851dd3d98950e8c5a89f"
+dependencies = [
+ "objc2-encode",
+]
+
+[[package]]
+name = "objc2-encode"
+version = "4.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ef25abbcd74fb2609453eb695bd2f860d389e457f67dc17cafc8b8cbc89d0c33"
+
+[[package]]
name = "object"
version = "0.36.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1673,10 +1766,19 @@ dependencies = [
]
[[package]]
+name = "object"
+version = "0.37.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ff76201f031d8863c38aa7f905eca4f53abbfa15f609db4277d44cd8938f33fe"
+dependencies = [
+ "memchr",
+]
+
+[[package]]
name = "once_cell"
-version = "1.21.3"
+version = "1.21.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d"
+checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50"
[[package]]
name = "oorandom"
@@ -1692,9 +1794,9 @@ checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d"
[[package]]
name = "parking_lot"
-version = "0.12.4"
+version = "0.12.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "70d58bf43669b5795d1576d0641cfb6fbb2057bf629506267a92807158584a13"
+checksum = "93857453250e3077bd71ff98b6a65ea6621a19bb0f559a85248955ac12c45a1a"
dependencies = [
"lock_api",
"parking_lot_core",
@@ -1702,15 +1804,15 @@ dependencies = [
[[package]]
name = "parking_lot_core"
-version = "0.9.11"
+version = "0.9.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bc838d2a56b5b1a6c25f55575dfc605fabb63bb2365f6c2353ef9159aa69e4a5"
+checksum = "2621685985a2ebf1c516881c026032ac7deafcda1a2c9b7850dc81e3dfcb64c1"
dependencies = [
"cfg-if",
"libc",
"redox_syscall",
"smallvec",
- "windows-targets 0.52.6",
+ "windows-link",
]
[[package]]
@@ -1721,10 +1823,10 @@ dependencies = [
"edition",
"expect-test",
"ra-ap-rustc_lexer",
- "rustc-literal-escaper 0.0.4",
+ "rustc-literal-escaper",
"stdx",
"tracing",
- "winnow",
+ "winnow 0.7.15",
]
[[package]]
@@ -1767,9 +1869,9 @@ dependencies = [
[[package]]
name = "petgraph"
-version = "0.8.2"
+version = "0.8.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "54acf3a685220b533e437e264e4d932cfbdc4cc7ec0cd232ed73c08d03b8a7ca"
+checksum = "8701b58ea97060d5e5b155d383a69952a60943f0e6dfe30b04c287beb0b27455"
dependencies = [
"fixedbitset",
"hashbrown 0.15.5",
@@ -1778,9 +1880,9 @@ dependencies = [
[[package]]
name = "pin-project-lite"
-version = "0.2.16"
+version = "0.2.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b"
+checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd"
[[package]]
name = "plotters"
@@ -1812,9 +1914,9 @@ dependencies = [
[[package]]
name = "portable-atomic"
-version = "1.11.1"
+version = "1.13.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f84267b20a16ea918e43c6a88433c2d54fa145c92a811b5b047ccbe153674483"
+checksum = "c33a9471896f1c69cecef8d20cbe2f7accd12527ce60845ff44c153bb2a21b49"
[[package]]
name = "postcard"
@@ -1831,9 +1933,9 @@ dependencies = [
[[package]]
name = "potential_utf"
-version = "0.1.3"
+version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "84df19adbe5b5a0782edcab45899906947ab039ccf4573713735ee7de1e6b08a"
+checksum = "0103b1cef7ec0cf76490e969665504990193874ea05c85ff9bab8b911d0a0564"
dependencies = [
"zerovec",
]
@@ -1854,6 +1956,16 @@ dependencies = [
]
[[package]]
+name = "prettyplease"
+version = "0.2.37"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "479ca8adacdd7ce8f1fb39ce9ecccbfe93a3f1344b3d0d97f20bc0196208f62b"
+dependencies = [
+ "proc-macro2",
+ "syn",
+]
+
+[[package]]
name = "proc-macro-api"
version = "0.0.0"
dependencies = [
@@ -1863,7 +1975,7 @@ dependencies = [
"postcard",
"proc-macro-srv",
"rayon",
- "rustc-hash 2.1.1",
+ "rustc-hash 2.1.2",
"semver",
"serde",
"serde_derive",
@@ -1884,7 +1996,7 @@ dependencies = [
"libloading",
"line-index 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"memmap2",
- "object",
+ "object 0.36.7",
"paths",
"proc-macro-test",
"span",
@@ -1915,18 +2027,18 @@ dependencies = [
[[package]]
name = "proc-macro2"
-version = "1.0.101"
+version = "1.0.106"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "89ae43fd86e4158d6db51ad8e2b80f313af9cc74f5c0e03ccb87de09998732de"
+checksum = "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934"
dependencies = [
"unicode-ident",
]
[[package]]
name = "process-wrap"
-version = "8.2.1"
+version = "9.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a3ef4f2f0422f23a82ec9f628ea2acd12871c81a9362b02c43c1aa86acfc3ba1"
+checksum = "2e842efad9119158434d193c6682e2ebee4b44d6ad801d7b349623b3f57cdf55"
dependencies = [
"indexmap",
"nix",
@@ -1941,7 +2053,7 @@ dependencies = [
"libc",
"perf-event",
"tikv-jemalloc-ctl",
- "windows-sys 0.61.0",
+ "windows-sys 0.61.2",
]
[[package]]
@@ -1957,7 +2069,7 @@ dependencies = [
"itertools 0.14.0",
"la-arena 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
"paths",
- "rustc-hash 2.1.1",
+ "rustc-hash 2.1.2",
"semver",
"serde",
"serde_derive",
@@ -1973,13 +2085,13 @@ dependencies = [
[[package]]
name = "proptest"
-version = "1.9.0"
+version = "1.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bee689443a2bd0a16ab0348b52ee43e3b2d1b1f931c8aa5c9f8de4c86fbe8c40"
+checksum = "4b45fcc2344c680f5025fe57779faef368840d0bd1f42f216291f0dc4ace4744"
dependencies = [
"bit-set",
"bit-vec",
- "bitflags 2.9.4",
+ "bitflags 2.12.1",
"num-traits",
"rand",
"rand_chacha",
@@ -2016,7 +2128,7 @@ version = "0.9.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "57206b407293d2bcd3af849ce869d52068623f19e1b5ff8e8778e3309439682b"
dependencies = [
- "bitflags 2.9.4",
+ "bitflags 2.12.1",
"memchr",
"unicase",
]
@@ -2050,9 +2162,9 @@ checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0"
[[package]]
name = "quote"
-version = "1.0.40"
+version = "1.0.45"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d"
+checksum = "41f2619966050689382d2b44f664f4bc593e129785a36d6ee376ddf37259b924"
dependencies = [
"proc-macro2",
]
@@ -2064,12 +2176,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f"
[[package]]
+name = "r-efi"
+version = "6.0.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf"
+
+[[package]]
name = "ra-ap-rustc_abi"
version = "0.165.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2f25a779e21ca3bba6795193b16508c8ab159f96ee4b07349893fd272065b525"
dependencies = [
- "bitflags 2.9.4",
+ "bitflags 2.12.1",
"ra-ap-rustc_hashes",
"ra-ap-rustc_index",
"tracing",
@@ -2141,7 +2259,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4a737f844bdef8ac5ab54dadf2f34704b4d06beef9236d71080bb34db697220b"
dependencies = [
"ra-ap-rustc_lexer",
- "rustc-literal-escaper 0.0.7",
+ "rustc-literal-escaper",
]
[[package]]
@@ -2151,7 +2269,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6de3d4c7d6078cce3c40c55717b8b15002a80b9fa8849faea496a365324861b4"
dependencies = [
"ra-ap-rustc_index",
- "rustc-hash 2.1.1",
+ "rustc-hash 2.1.2",
"rustc_apfloat",
"smallvec",
"tracing",
@@ -2164,7 +2282,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8c5d9a4d3e7bee7313599bc6d794037247ac0165f03857379cf4fc3097199e05"
dependencies = [
"arrayvec",
- "bitflags 2.9.4",
+ "bitflags 2.12.1",
"derive-where",
"ena",
"indexmap",
@@ -2172,7 +2290,7 @@ dependencies = [
"ra-ap-rustc_ast_ir",
"ra-ap-rustc_index",
"ra-ap-rustc_type_ir_macros",
- "rustc-hash 2.1.1",
+ "rustc-hash 2.1.2",
"smallvec",
"thin-vec",
"tracing",
@@ -2192,9 +2310,9 @@ dependencies = [
[[package]]
name = "rand"
-version = "0.9.3"
+version = "0.9.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7ec095654a25171c2124e9e3393a930bddbffdc939556c914957a4c3e0a87166"
+checksum = "44c5af06bb1b7d3216d91932aed5265164bf384dc89cd6ba05cf59a35f5f76ea"
dependencies = [
"rand_chacha",
"rand_core",
@@ -2212,9 +2330,9 @@ dependencies = [
[[package]]
name = "rand_core"
-version = "0.9.3"
+version = "0.9.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38"
+checksum = "76afc826de14238e6e8c374ddcc1fa19e374fd8dd986b0d2af0d02377261d83c"
dependencies = [
"getrandom 0.3.4",
]
@@ -2230,9 +2348,9 @@ dependencies = [
[[package]]
name = "rayon"
-version = "1.11.0"
+version = "1.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "368f01d005bf8fd9b1206fb6fa653e6c4a81ceb1466406b81792d87c5677a58f"
+checksum = "fb39b166781f92d482534ef4b4b1b2568f42613b53e5b6c160e24cfbfa30926d"
dependencies = [
"either",
"rayon-core",
@@ -2250,11 +2368,11 @@ dependencies = [
[[package]]
name = "redox_syscall"
-version = "0.5.17"
+version = "0.5.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5407465600fb0548f1442edf71dd20683c6ed326200ace4b1ef0763521bb3b77"
+checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d"
dependencies = [
- "bitflags 2.9.4",
+ "bitflags 2.12.1",
]
[[package]]
@@ -2263,16 +2381,16 @@ version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a4e608c6638b9c18977b00b475ac1f28d14e84b27d8d42f70e0bf1e3dec127ac"
dependencies = [
- "getrandom 0.2.16",
+ "getrandom 0.2.17",
"libredox",
- "thiserror 2.0.16",
+ "thiserror 2.0.18",
]
[[package]]
name = "regex"
-version = "1.12.2"
+version = "1.12.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "843bc0191f75f3e22651ae5f1e72939ab2f72a4bc30fa80a066bd66edefc24d4"
+checksum = "e10754a14b9137dd7b1e3e5b0493cc9171fdd105e0ab477f51b72e7f3ac0e276"
dependencies = [
"aho-corasick",
"memchr",
@@ -2282,9 +2400,9 @@ dependencies = [
[[package]]
name = "regex-automata"
-version = "0.4.13"
+version = "0.4.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5276caf25ac86c8d810222b3dbb938e512c55c6831a10f3e6ed1c93b84041f1c"
+checksum = "6e1dd4122fc1595e8162618945476892eefca7b88c52820e74af6262213cae8f"
dependencies = [
"aho-corasick",
"memchr",
@@ -2293,9 +2411,9 @@ dependencies = [
[[package]]
name = "regex-syntax"
-version = "0.8.8"
+version = "0.8.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7a2d987857b319362043e95f5353c0535c1f58eec5336fdfcf626430af7def58"
+checksum = "dc897dd8d9e8bd1ed8cdad82b5966c3e0ecae09fb1907d58efaa013543185d0a"
[[package]]
name = "rowan"
@@ -2349,7 +2467,7 @@ dependencies = [
"project-model",
"ra-ap-rustc_type_ir",
"rayon",
- "rustc-hash 2.1.1",
+ "rustc-hash 2.1.2",
"scip",
"semver",
"serde",
@@ -2372,16 +2490,16 @@ dependencies = [
"vfs",
"vfs-notify",
"walkdir",
- "windows-sys 0.61.0",
+ "windows-sys 0.61.2",
"xflags",
"xshell",
]
[[package]]
name = "rustc-demangle"
-version = "0.1.26"
+version = "0.1.27"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "56f7d92ca342cea22a06f2121d944b4fd82af56988c270852495420f961d4ace"
+checksum = "b50b8869d9fc858ce7266cce0194bd74df58b9d0e3f6df3a9fc8eb470d95c09d"
[[package]]
name = "rustc-hash"
@@ -2391,15 +2509,9 @@ checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2"
[[package]]
name = "rustc-hash"
-version = "2.1.1"
+version = "2.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "357703d41365b4b27c590e3ed91eabb1b663f07c4c084095e60cbed4362dff0d"
-
-[[package]]
-name = "rustc-literal-escaper"
-version = "0.0.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ab03008eb631b703dd16978282ae36c73282e7922fe101a4bd072a40ecea7b8b"
+checksum = "94300abf3f1ae2e2b8ffb7b58043de3d399c73fa6f4b73826402a5c457614dbe"
[[package]]
name = "rustc-literal-escaper"
@@ -2419,7 +2531,7 @@ version = "0.2.3+llvm-462a31f5a5ab"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "486c2179b4796f65bfe2ee33679acf0927ac83ecf583ad6c91c3b4570911b9ad"
dependencies = [
- "bitflags 2.9.4",
+ "bitflags 2.12.1",
"smallvec",
]
@@ -2434,15 +2546,15 @@ dependencies = [
[[package]]
name = "rustix"
-version = "1.1.2"
+version = "1.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "cd15f8a2c5551a84d56efdc1cd049089e409ac19a3072d5037a17fd70719ff3e"
+checksum = "b6fe4565b9518b83ef4f91bb47ce29620ca828bd32cb7e408f0062e9930ba190"
dependencies = [
- "bitflags 2.9.4",
+ "bitflags 2.12.1",
"errno",
"libc",
"linux-raw-sys",
- "windows-sys 0.61.0",
+ "windows-sys 0.61.2",
]
[[package]]
@@ -2464,21 +2576,15 @@ dependencies = [
]
[[package]]
-name = "ryu"
-version = "1.0.20"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f"
-
-[[package]]
name = "salsa"
-version = "0.26.2"
+version = "0.27.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4612ff789805e65c87e9b38cb749a293212a615af065bed8a2001086801498c3"
+checksum = "adfc1e32b8d1a486e3a45a5480fb5dca7912f49262a8916a67378064da4fe1ab"
dependencies = [
"boxcar",
"crossbeam-queue",
"crossbeam-utils",
- "hashbrown 0.17.0",
+ "hashbrown 0.17.1",
"hashlink",
"indexmap",
"intrusive-collections",
@@ -2486,7 +2592,7 @@ dependencies = [
"parking_lot",
"portable-atomic",
"rayon",
- "rustc-hash 2.1.1",
+ "rustc-hash 2.1.2",
"salsa-macro-rules",
"salsa-macros",
"smallvec",
@@ -2497,15 +2603,15 @@ dependencies = [
[[package]]
name = "salsa-macro-rules"
-version = "0.26.2"
+version = "0.27.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "58e354cbac6939b9b09cd9c11fb419a53e64b4a0f755d929f56a09f4cc752e41"
+checksum = "67dad477a3e3a484a7c2311c1d25160fb270214981be24022de7de8a206a3300"
[[package]]
name = "salsa-macros"
-version = "0.26.2"
+version = "0.27.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3067861075c2b80608f84ad49fb88f2c7610b94cdf8b4201e79ddee87f8980c8"
+checksum = "943f70e101fb3bd599960e79e719e70d85142730e5b45f3269246086ed218562"
dependencies = [
"proc-macro2",
"quote",
@@ -2539,9 +2645,9 @@ checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49"
[[package]]
name = "semver"
-version = "1.0.27"
+version = "1.0.28"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d767eb0aabc880b29956c35734170f26ed551a859dbd361d140cdbeca61ab1e2"
+checksum = "8a7852d02fc848982e0c167ef163aaff9cd91dc640ba85e263cb1ce46fae51cd"
dependencies = [
"serde",
"serde_core",
@@ -2549,9 +2655,9 @@ dependencies = [
[[package]]
name = "serde"
-version = "1.0.226"
+version = "1.0.228"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0dca6411025b24b60bfa7ec1fe1f8e710ac09782dca409ee8237ba74b51295fd"
+checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e"
dependencies = [
"serde_core",
"serde_derive",
@@ -2559,18 +2665,18 @@ dependencies = [
[[package]]
name = "serde_core"
-version = "1.0.226"
+version = "1.0.228"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ba2ba63999edb9dac981fb34b3e5c0d111a69b0924e253ed29d83f7c99e966a4"
+checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad"
dependencies = [
"serde_derive",
]
[[package]]
name = "serde_derive"
-version = "1.0.226"
+version = "1.0.228"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8db53ae22f34573731bafa1db20f04027b2d25e02d8205921b569171699cdb33"
+checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79"
dependencies = [
"proc-macro2",
"quote",
@@ -2579,16 +2685,16 @@ dependencies = [
[[package]]
name = "serde_json"
-version = "1.0.145"
+version = "1.0.150"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "402a6f66d8c709116cf22f558eab210f5a50187f702eb4d7e5ef38d9a7f1c79c"
+checksum = "e8014e44b4736ed0538adeecded0fce2a272f22dc9578a7eb6b2d9993c74cfb9"
dependencies = [
"indexmap",
"itoa",
"memchr",
- "ryu",
"serde",
"serde_core",
+ "zmij",
]
[[package]]
@@ -2604,9 +2710,9 @@ dependencies = [
[[package]]
name = "serde_spanned"
-version = "1.0.3"
+version = "1.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e24345aa0fe688594e73770a5f6d1b216508b4f93484c0026d521acd30134392"
+checksum = "6662b5879511e06e8999a8a235d848113e942c9124f211511b16466ee2995f26"
dependencies = [
"serde_core",
]
@@ -2631,9 +2737,21 @@ dependencies = [
[[package]]
name = "shlex"
-version = "1.3.0"
+version = "2.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
+checksum = "f8fadd59c855ef2080decdef8ff161eb6661b86933c9d82e5ba29dc602a55aba"
+
+[[package]]
+name = "simd-adler32"
+version = "0.3.9"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "703d5c7ef118737c72f1af64ad2f6f8c5e1921f818cdcb97b8fe6fc69bf66214"
+
+[[package]]
+name = "slab"
+version = "0.4.12"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5"
[[package]]
name = "smallvec"
@@ -2643,35 +2761,35 @@ checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03"
[[package]]
name = "smol_str"
-version = "0.3.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9676b89cd56310a87b93dec47b11af744f34d5fc9f367b829474eec0a891350d"
+version = "0.3.6"
dependencies = [
+ "arbitrary",
"borsh",
+ "criterion",
+ "proptest",
+ "rand",
"serde",
+ "serde_core",
+ "serde_json",
]
[[package]]
name = "smol_str"
version = "0.3.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4aaa7368fcf4852a4c2dd92df0cace6a71f2091ca0a23391ce7f3a31833f1523"
dependencies = [
- "arbitrary",
"borsh",
- "criterion",
- "proptest",
- "rand",
- "serde",
"serde_core",
- "serde_json",
]
[[package]]
name = "span"
version = "0.0.0"
dependencies = [
- "hashbrown 0.14.5",
+ "hashbrown 0.17.1",
"la-arena 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
- "rustc-hash 2.1.1",
+ "rustc-hash 2.1.2",
"salsa",
"stdx",
"syntax",
@@ -2690,9 +2808,9 @@ dependencies = [
[[package]]
name = "stable_deref_trait"
-version = "1.2.0"
+version = "1.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3"
+checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596"
[[package]]
name = "static_assertions"
@@ -2712,14 +2830,14 @@ dependencies = [
"libc",
"miow",
"tracing",
- "windows-sys 0.61.0",
+ "windows-sys 0.61.2",
]
[[package]]
name = "syn"
-version = "2.0.106"
+version = "2.0.117"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ede7c438028d4436d71104916910f5bb611972c5cfd7f89b8300a8186e6fada6"
+checksum = "e665b8803e7b1d2a727f4023456bbbbe74da67099c585258af0ad9c5013b9b99"
dependencies = [
"proc-macro2",
"quote",
@@ -2747,11 +2865,11 @@ dependencies = [
"parser",
"rayon",
"rowan",
- "rustc-hash 2.1.1",
- "rustc-literal-escaper 0.0.4",
+ "rustc-hash 2.1.2",
+ "rustc-literal-escaper",
"rustc_apfloat",
"smallvec",
- "smol_str 0.3.2",
+ "smol_str 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"stdx",
"test-utils",
"tracing",
@@ -2765,7 +2883,7 @@ dependencies = [
"expect-test",
"intern",
"parser",
- "rustc-hash 2.1.1",
+ "rustc-hash 2.1.2",
"span",
"stdx",
"syntax",
@@ -2775,21 +2893,21 @@ dependencies = [
[[package]]
name = "temp-dir"
-version = "0.1.16"
+version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "83176759e9416cf81ee66cb6508dbfe9c96f20b8b56265a39917551c23c70964"
+checksum = "016ef9739649996fcc983b9c588fe3d557cf216d4d98503ce1b057ab5a66d689"
[[package]]
name = "tempfile"
-version = "3.23.0"
+version = "3.27.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2d31c77bdf42a745371d260a26ca7163f1e0924b64afa0b688e61b5a9fa02f16"
+checksum = "32497e9a4c7b38532efcdebeef879707aa9f794296a4f0244f6f69e9bc8574bd"
dependencies = [
"fastrand",
- "getrandom 0.3.4",
+ "getrandom 0.4.2",
"once_cell",
"rustix",
- "windows-sys 0.61.0",
+ "windows-sys 0.61.2",
]
[[package]]
@@ -2821,7 +2939,7 @@ dependencies = [
"dissimilar",
"paths",
"profile",
- "rustc-hash 2.1.1",
+ "rustc-hash 2.1.2",
"stdx",
"text-size 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
@@ -2843,9 +2961,9 @@ checksum = "f18aa187839b2bdb1ad2fa35ead8c4c2976b64e4363c386d45ac0f7ee85c9233"
[[package]]
name = "thin-vec"
-version = "0.2.16"
+version = "0.2.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "259cdf8ed4e4aca6f1e9d011e10bd53f524a2d0637d7b28450f6c64ac298c4c6"
+checksum = "b0f7e269b48f0a7dd0146680fa24b50cc67fc0373f086a5b2f99bd084639b482"
[[package]]
name = "thiserror"
@@ -2858,11 +2976,11 @@ dependencies = [
[[package]]
name = "thiserror"
-version = "2.0.16"
+version = "2.0.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3467d614147380f2e4e374161426ff399c91084acd2363eaf549172b3d5e60c0"
+checksum = "4288b5bcbc7920c07a1149a35cf9590a2aa808e0bc1eafaade0b80947865fbc4"
dependencies = [
- "thiserror-impl 2.0.16",
+ "thiserror-impl 2.0.18",
]
[[package]]
@@ -2878,9 +2996,9 @@ dependencies = [
[[package]]
name = "thiserror-impl"
-version = "2.0.16"
+version = "2.0.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6c5e1be1c48b9172ee610da68fd9cd2770e7a4056cb3fc98710ee6906f0c7960"
+checksum = "ebc4ee7f67670e9b64d05fa4253e753e016c6c95ff35b89b7941d6b856dec1d5"
dependencies = [
"proc-macro2",
"quote",
@@ -2968,9 +3086,9 @@ dependencies = [
[[package]]
name = "tinystr"
-version = "0.8.1"
+version = "0.8.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5d4f6d1145dcb577acf783d4e601bc1d76a13337bb54e6233add580b07344c8b"
+checksum = "c8323304221c2a851516f22236c5722a72eaa19749016521d6dff0824447d96d"
dependencies = [
"displaydoc",
"zerovec",
@@ -2988,9 +3106,9 @@ dependencies = [
[[package]]
name = "toml"
-version = "0.9.8"
+version = "1.1.2+spec-1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f0dc8b1fb61449e27716ec0e1bdf0f6b8f3e8f6b05391e8497b8b6d7804ea6d8"
+checksum = "81f3d15e84cbcd896376e6730314d59fb5a87f31e4b038454184435cd57defee"
dependencies = [
"indexmap",
"serde_core",
@@ -2998,32 +3116,32 @@ dependencies = [
"toml_datetime",
"toml_parser",
"toml_writer",
- "winnow",
+ "winnow 1.0.3",
]
[[package]]
name = "toml_datetime"
-version = "0.7.3"
+version = "1.1.1+spec-1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f2cdb639ebbc97961c51720f858597f7f24c4fc295327923af55b74c3c724533"
+checksum = "3165f65f62e28e0115a00b2ebdd37eb6f3b641855f9d636d3cd4103767159ad7"
dependencies = [
"serde_core",
]
[[package]]
name = "toml_parser"
-version = "1.0.4"
+version = "1.1.2+spec-1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c0cbe268d35bdb4bb5a56a2de88d0ad0eb70af5384a99d648cd4b3d04039800e"
+checksum = "a2abe9b86193656635d2411dc43050282ca48aa31c2451210f4202550afb7526"
dependencies = [
- "winnow",
+ "winnow 1.0.3",
]
[[package]]
name = "toml_writer"
-version = "1.0.4"
+version = "1.1.1+spec-1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "df8b2b54733674ad286d16267dcfc7a71ed5c776e4ac7aa3c3e2561f7c637bf2"
+checksum = "756daf9b1013ebe47a8776667b466417e2d4c5679d441c26230efd9ef78692db"
[[package]]
name = "toolchain"
@@ -3035,9 +3153,9 @@ dependencies = [
[[package]]
name = "tracing"
-version = "0.1.41"
+version = "0.1.44"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "784e0ac535deb450455cbfa28a6f0df145ea1bb7ae51b821cf5e7927fdcfbdd0"
+checksum = "63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100"
dependencies = [
"pin-project-lite",
"tracing-attributes",
@@ -3046,9 +3164,9 @@ dependencies = [
[[package]]
name = "tracing-attributes"
-version = "0.1.30"
+version = "0.1.31"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "81383ab64e72a7a8b8e13130c49e3dab29def6d0c7d76a03087b3cf71c5c6903"
+checksum = "7490cfa5ec963746568740651ac6781f701c9c5ea257c58e057f3ba8cf69e8da"
dependencies = [
"proc-macro2",
"quote",
@@ -3057,9 +3175,9 @@ dependencies = [
[[package]]
name = "tracing-core"
-version = "0.1.34"
+version = "0.1.36"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b9d12581f227e93f094d3af2ae690a574abb8a2b9b7a96e7cfe9647b2b617678"
+checksum = "db97caf9d906fbde555dd62fa95ddba9eecfd14cb388e4f491a66d74cd5fb79a"
dependencies = [
"once_cell",
"valuable",
@@ -3078,9 +3196,9 @@ dependencies = [
[[package]]
name = "tracing-subscriber"
-version = "0.3.20"
+version = "0.3.23"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2054a14f5307d601f88daf0553e1cbf472acc4f2c51afab632431cdcd72124d5"
+checksum = "cb7f578e5945fb242538965c2d0b04418d38ec25c79d160cd279bf0731c8d319"
dependencies = [
"sharded-slab",
"thread_local",
@@ -3091,9 +3209,9 @@ dependencies = [
[[package]]
name = "tracing-tree"
-version = "0.4.0"
+version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f459ca79f1b0d5f71c54ddfde6debfc59c8b6eeb46808ae492077f739dc7b49c"
+checksum = "ac87aa03b6a4d5a7e4810d1a80c19601dbe0f8a837e9177f23af721c7ba7beec"
dependencies = [
"nu-ansi-term",
"tracing-core",
@@ -3103,9 +3221,9 @@ dependencies = [
[[package]]
name = "triomphe"
-version = "0.1.14"
+version = "0.1.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ef8f7726da4807b58ea5c96fdc122f80702030edc33b35aff9190a51148ccc85"
+checksum = "dd69c5aa8f924c7519d6372789a74eac5b94fb0f8fcf0d4a97eb0bfc3e785f39"
[[package]]
name = "tt"
@@ -3115,7 +3233,7 @@ dependencies = [
"indexmap",
"intern",
"ra-ap-rustc_lexer",
- "rustc-hash 2.1.1",
+ "rustc-hash 2.1.2",
"span",
"stdx",
"text-size 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -3159,9 +3277,9 @@ dependencies = [
[[package]]
name = "unicase"
-version = "2.8.1"
+version = "2.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "75b844d17643ee918803943289730bec8aac480150456169e647ed0b576ba539"
+checksum = "dbc4bc3a9f746d862c45cb89d705aa10f187bb96c76001afab07a0d35ce60142"
[[package]]
name = "unicode-ident"
@@ -3176,15 +3294,22 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7df058c713841ad818f1dc5d3fd88063241cc61f49f5fbea4b951e8cf5a8d71d"
[[package]]
+name = "unicode-xid"
+version = "0.2.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853"
+
+[[package]]
name = "url"
-version = "2.5.7"
+version = "2.5.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "08bc136a29a3d1758e07a9cca267be308aeebf5cfd5a10f3f67ab2097683ef5b"
+checksum = "ff67a8a4397373c3ef660812acab3268222035010ab8680ec4215f38ba3d0eed"
dependencies = [
"form_urlencoded",
"idna",
"percent-encoding",
"serde",
+ "serde_derive",
]
[[package]]
@@ -3208,7 +3333,7 @@ dependencies = [
"indexmap",
"nohash-hasher",
"paths",
- "rustc-hash 2.1.1",
+ "rustc-hash 2.1.2",
"stdx",
"tracing",
]
@@ -3221,7 +3346,7 @@ dependencies = [
"notify",
"paths",
"rayon",
- "rustc-hash 2.1.1",
+ "rustc-hash 2.1.2",
"stdx",
"tracing",
"vfs",
@@ -3255,18 +3380,27 @@ checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b"
[[package]]
name = "wasip2"
-version = "1.0.1+wasi-0.2.4"
+version = "1.0.3+wasi-0.2.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0562428422c63773dad2c345a1882263bbf4d65cf3f42e90921f787ef5ad58e7"
+checksum = "20064672db26d7cdc89c7798c48a0fdfac8213434a1186e5ef29fd560ae223d6"
dependencies = [
- "wit-bindgen",
+ "wit-bindgen 0.57.1",
+]
+
+[[package]]
+name = "wasip3"
+version = "0.4.0+wasi-0.3.0-rc-2026-01-06"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5428f8bf88ea5ddc08faddef2ac4a67e390b88186c703ce6dbd955e1c145aca5"
+dependencies = [
+ "wit-bindgen 0.51.0",
]
[[package]]
name = "wasm-bindgen"
-version = "0.2.105"
+version = "0.2.122"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "da95793dfc411fbbd93f5be7715b0578ec61fe87cb1a42b12eb625caa5c5ea60"
+checksum = "3ed04576f974d2b2fba0f38c51dbc5518011e38c36bf1143164be765528fd409"
dependencies = [
"cfg-if",
"once_cell",
@@ -3277,9 +3411,9 @@ dependencies = [
[[package]]
name = "wasm-bindgen-macro"
-version = "0.2.105"
+version = "0.2.122"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "04264334509e04a7bf8690f2384ef5265f05143a4bff3889ab7a3269adab59c2"
+checksum = "916151b09da36bd82f6615cbf3a419e2f0ba23a03c6160e8e92eb6bd4aa1dec6"
dependencies = [
"quote",
"wasm-bindgen-macro-support",
@@ -3287,9 +3421,9 @@ dependencies = [
[[package]]
name = "wasm-bindgen-macro-support"
-version = "0.2.105"
+version = "0.2.122"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "420bc339d9f322e562942d52e115d57e950d12d88983a14c79b86859ee6c7ebc"
+checksum = "299047362ccbfce148b67ab7e73349f77748e00c8296f9542adfad2ad82c5c5e"
dependencies = [
"bumpalo",
"proc-macro2",
@@ -3300,18 +3434,52 @@ dependencies = [
[[package]]
name = "wasm-bindgen-shared"
-version = "0.2.105"
+version = "0.2.122"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "76f218a38c84bcb33c25ec7059b07847d465ce0e0a76b995e134a45adcb6af76"
+checksum = "9a929b2c61f11ba3e9bc35b50c1f25cb38e0e892c0c231ae2b8cf78d5dad4437"
dependencies = [
"unicode-ident",
]
[[package]]
+name = "wasm-encoder"
+version = "0.244.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "990065f2fe63003fe337b932cfb5e3b80e0b4d0f5ff650e6985b1048f62c8319"
+dependencies = [
+ "leb128fmt",
+ "wasmparser",
+]
+
+[[package]]
+name = "wasm-metadata"
+version = "0.244.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bb0e353e6a2fbdc176932bbaab493762eb1255a7900fe0fea1a2f96c296cc909"
+dependencies = [
+ "anyhow",
+ "indexmap",
+ "wasm-encoder",
+ "wasmparser",
+]
+
+[[package]]
+name = "wasmparser"
+version = "0.244.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "47b807c72e1bac69382b3a6fb3dbe8ea4c0ed87ff5629b8685ae6b9a611028fe"
+dependencies = [
+ "bitflags 2.12.1",
+ "hashbrown 0.15.5",
+ "indexmap",
+ "semver",
+]
+
+[[package]]
name = "web-sys"
-version = "0.3.82"
+version = "0.3.99"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3a1f95c0d03a47f4ae1f7a64643a6bb97465d9b740f0fa8f90ea33915c99a9a1"
+checksum = "6d621441cfc37b84979402712047321980c178f299193a3589d05b99e8763436"
dependencies = [
"js-sys",
"wasm-bindgen",
@@ -3323,60 +3491,59 @@ version = "0.1.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22"
dependencies = [
- "windows-sys 0.61.0",
+ "windows-sys 0.61.2",
]
[[package]]
name = "windows"
-version = "0.61.3"
+version = "0.62.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9babd3a767a4c1aef6900409f85f5d53ce2544ccdfaa86dad48c91782c6d6893"
+checksum = "527fadee13e0c05939a6a05d5bd6eec6cd2e3dbd648b9f8e447c6518133d8580"
dependencies = [
"windows-collections",
"windows-core",
"windows-future",
- "windows-link 0.1.3",
"windows-numerics",
]
[[package]]
name = "windows-collections"
-version = "0.2.0"
+version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3beeceb5e5cfd9eb1d76b381630e82c4241ccd0d27f1a39ed41b2760b255c5e8"
+checksum = "23b2d95af1a8a14a3c7367e1ed4fc9c20e0a26e79551b1454d72583c97cc6610"
dependencies = [
"windows-core",
]
[[package]]
name = "windows-core"
-version = "0.61.2"
+version = "0.62.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c0fdd3ddb90610c7638aa2b3a3ab2904fb9e5cdbecc643ddb3647212781c4ae3"
+checksum = "b8e83a14d34d0623b51dce9581199302a221863196a1dde71a7663a4c2be9deb"
dependencies = [
"windows-implement",
"windows-interface",
- "windows-link 0.1.3",
+ "windows-link",
"windows-result",
"windows-strings",
]
[[package]]
name = "windows-future"
-version = "0.2.1"
+version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fc6a41e98427b19fe4b73c550f060b59fa592d7d686537eebf9385621bfbad8e"
+checksum = "e1d6f90251fe18a279739e78025bd6ddc52a7e22f921070ccdc67dde84c605cb"
dependencies = [
"windows-core",
- "windows-link 0.1.3",
+ "windows-link",
"windows-threading",
]
[[package]]
name = "windows-implement"
-version = "0.60.0"
+version = "0.60.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a47fddd13af08290e67f4acabf4b459f647552718f683a7b415d290ac744a836"
+checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf"
dependencies = [
"proc-macro2",
"quote",
@@ -3385,9 +3552,9 @@ dependencies = [
[[package]]
name = "windows-interface"
-version = "0.59.1"
+version = "0.59.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bd9211b69f8dcdfa817bfd14bf1c97c9188afa36f4750130fcdf3f400eca9fa8"
+checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358"
dependencies = [
"proc-macro2",
"quote",
@@ -3396,42 +3563,36 @@ dependencies = [
[[package]]
name = "windows-link"
-version = "0.1.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5e6ad25900d524eaabdbbb96d20b4311e1e7ae1699af4fb28c17ae66c80d798a"
-
-[[package]]
-name = "windows-link"
-version = "0.2.0"
+version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "45e46c0661abb7180e7b9c281db115305d49ca1709ab8242adf09666d2173c65"
+checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5"
[[package]]
name = "windows-numerics"
-version = "0.2.0"
+version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9150af68066c4c5c07ddc0ce30421554771e528bde427614c61038bc2c92c2b1"
+checksum = "6e2e40844ac143cdb44aead537bbf727de9b044e107a0f1220392177d15b0f26"
dependencies = [
"windows-core",
- "windows-link 0.1.3",
+ "windows-link",
]
[[package]]
name = "windows-result"
-version = "0.3.4"
+version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "56f42bd332cc6c8eac5af113fc0c1fd6a8fd2aa08a0119358686e5160d0586c6"
+checksum = "7781fa89eaf60850ac3d2da7af8e5242a5ea78d1a11c49bf2910bb5a73853eb5"
dependencies = [
- "windows-link 0.1.3",
+ "windows-link",
]
[[package]]
name = "windows-strings"
-version = "0.4.2"
+version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "56e6c93f3a0c3b36176cb1327a4958a0353d5d166c2a35cb268ace15e91d3b57"
+checksum = "7837d08f69c77cf6b07689544538e017c1bfcf57e34b4c0ff58e6c2cd3b37091"
dependencies = [
- "windows-link 0.1.3",
+ "windows-link",
]
[[package]]
@@ -3440,167 +3601,197 @@ version = "0.60.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f2f500e4d28234f72040990ec9d39e3a6b950f9f22d3dba18416c35882612bcb"
dependencies = [
- "windows-targets 0.53.3",
+ "windows-targets",
]
[[package]]
name = "windows-sys"
-version = "0.61.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e201184e40b2ede64bc2ea34968b28e33622acdbbf37104f0e4a33f7abe657aa"
-dependencies = [
- "windows-link 0.2.0",
-]
-
-[[package]]
-name = "windows-targets"
-version = "0.52.6"
+version = "0.61.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973"
+checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc"
dependencies = [
- "windows_aarch64_gnullvm 0.52.6",
- "windows_aarch64_msvc 0.52.6",
- "windows_i686_gnu 0.52.6",
- "windows_i686_gnullvm 0.52.6",
- "windows_i686_msvc 0.52.6",
- "windows_x86_64_gnu 0.52.6",
- "windows_x86_64_gnullvm 0.52.6",
- "windows_x86_64_msvc 0.52.6",
+ "windows-link",
]
[[package]]
name = "windows-targets"
-version = "0.53.3"
+version = "0.53.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d5fe6031c4041849d7c496a8ded650796e7b6ecc19df1a431c1a363342e5dc91"
+checksum = "4945f9f551b88e0d65f3db0bc25c33b8acea4d9e41163edf90dcd0b19f9069f3"
dependencies = [
- "windows-link 0.1.3",
- "windows_aarch64_gnullvm 0.53.0",
- "windows_aarch64_msvc 0.53.0",
- "windows_i686_gnu 0.53.0",
- "windows_i686_gnullvm 0.53.0",
- "windows_i686_msvc 0.53.0",
- "windows_x86_64_gnu 0.53.0",
- "windows_x86_64_gnullvm 0.53.0",
- "windows_x86_64_msvc 0.53.0",
+ "windows-link",
+ "windows_aarch64_gnullvm",
+ "windows_aarch64_msvc",
+ "windows_i686_gnu",
+ "windows_i686_gnullvm",
+ "windows_i686_msvc",
+ "windows_x86_64_gnu",
+ "windows_x86_64_gnullvm",
+ "windows_x86_64_msvc",
]
[[package]]
name = "windows-threading"
-version = "0.1.0"
+version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b66463ad2e0ea3bbf808b7f1d371311c80e115c0b71d60efc142cafbcfb057a6"
+checksum = "3949bd5b99cafdf1c7ca86b43ca564028dfe27d66958f2470940f73d86d75b37"
dependencies = [
- "windows-link 0.1.3",
+ "windows-link",
]
[[package]]
name = "windows_aarch64_gnullvm"
-version = "0.52.6"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3"
-
-[[package]]
-name = "windows_aarch64_gnullvm"
-version = "0.53.0"
+version = "0.53.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "86b8d5f90ddd19cb4a147a5fa63ca848db3df085e25fee3cc10b39b6eebae764"
+checksum = "a9d8416fa8b42f5c947f8482c43e7d89e73a173cead56d044f6a56104a6d1b53"
[[package]]
name = "windows_aarch64_msvc"
-version = "0.52.6"
+version = "0.53.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469"
+checksum = "b9d782e804c2f632e395708e99a94275910eb9100b2114651e04744e9b125006"
[[package]]
-name = "windows_aarch64_msvc"
-version = "0.53.0"
+name = "windows_i686_gnu"
+version = "0.53.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c7651a1f62a11b8cbd5e0d42526e55f2c99886c77e007179efff86c2b137e66c"
+checksum = "960e6da069d81e09becb0ca57a65220ddff016ff2d6af6a223cf372a506593a3"
[[package]]
-name = "windows_i686_gnu"
-version = "0.52.6"
+name = "windows_i686_gnullvm"
+version = "0.53.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b"
+checksum = "fa7359d10048f68ab8b09fa71c3daccfb0e9b559aed648a8f95469c27057180c"
[[package]]
-name = "windows_i686_gnu"
-version = "0.53.0"
+name = "windows_i686_msvc"
+version = "0.53.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c1dc67659d35f387f5f6c479dc4e28f1d4bb90ddd1a5d3da2e5d97b42d6272c3"
+checksum = "1e7ac75179f18232fe9c285163565a57ef8d3c89254a30685b57d83a38d326c2"
[[package]]
-name = "windows_i686_gnullvm"
-version = "0.52.6"
+name = "windows_x86_64_gnu"
+version = "0.53.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66"
+checksum = "9c3842cdd74a865a8066ab39c8a7a473c0778a3f29370b5fd6b4b9aa7df4a499"
[[package]]
-name = "windows_i686_gnullvm"
-version = "0.53.0"
+name = "windows_x86_64_gnullvm"
+version = "0.53.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9ce6ccbdedbf6d6354471319e781c0dfef054c81fbc7cf83f338a4296c0cae11"
+checksum = "0ffa179e2d07eee8ad8f57493436566c7cc30ac536a3379fdf008f47f6bb7ae1"
[[package]]
-name = "windows_i686_msvc"
-version = "0.52.6"
+name = "windows_x86_64_msvc"
+version = "0.53.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66"
+checksum = "d6bbff5f0aada427a1e5a6da5f1f98158182f26556f345ac9e04d36d0ebed650"
[[package]]
-name = "windows_i686_msvc"
-version = "0.53.0"
+name = "winnow"
+version = "0.7.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "581fee95406bb13382d2f65cd4a908ca7b1e4c2f1917f143ba16efe98a589b5d"
+checksum = "df79d97927682d2fd8adb29682d1140b343be4ac0f08fd68b7765d9c059d3945"
[[package]]
-name = "windows_x86_64_gnu"
-version = "0.52.6"
+name = "winnow"
+version = "1.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78"
+checksum = "0592e1c9d151f854e6fd382574c3a0855250e1d9b2f99d9281c6e6391af352f1"
[[package]]
-name = "windows_x86_64_gnu"
-version = "0.53.0"
+name = "wit-bindgen"
+version = "0.51.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2e55b5ac9ea33f2fc1716d1742db15574fd6fc8dadc51caab1c16a3d3b4190ba"
+checksum = "d7249219f66ced02969388cf2bb044a09756a083d0fab1e566056b04d9fbcaa5"
+dependencies = [
+ "wit-bindgen-rust-macro",
+]
[[package]]
-name = "windows_x86_64_gnullvm"
-version = "0.52.6"
+name = "wit-bindgen"
+version = "0.57.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d"
+checksum = "1ebf944e87a7c253233ad6766e082e3cd714b5d03812acc24c318f549614536e"
[[package]]
-name = "windows_x86_64_gnullvm"
-version = "0.53.0"
+name = "wit-bindgen-core"
+version = "0.51.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0a6e035dd0599267ce1ee132e51c27dd29437f63325753051e71dd9e42406c57"
+checksum = "ea61de684c3ea68cb082b7a88508a8b27fcc8b797d738bfc99a82facf1d752dc"
+dependencies = [
+ "anyhow",
+ "heck",
+ "wit-parser",
+]
[[package]]
-name = "windows_x86_64_msvc"
-version = "0.52.6"
+name = "wit-bindgen-rust"
+version = "0.51.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
+checksum = "b7c566e0f4b284dd6561c786d9cb0142da491f46a9fbed79ea69cdad5db17f21"
+dependencies = [
+ "anyhow",
+ "heck",
+ "indexmap",
+ "prettyplease",
+ "syn",
+ "wasm-metadata",
+ "wit-bindgen-core",
+ "wit-component",
+]
[[package]]
-name = "windows_x86_64_msvc"
-version = "0.53.0"
+name = "wit-bindgen-rust-macro"
+version = "0.51.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "271414315aff87387382ec3d271b52d7ae78726f5d44ac98b4f4030c91880486"
+checksum = "0c0f9bfd77e6a48eccf51359e3ae77140a7f50b1e2ebfe62422d8afdaffab17a"
+dependencies = [
+ "anyhow",
+ "prettyplease",
+ "proc-macro2",
+ "quote",
+ "syn",
+ "wit-bindgen-core",
+ "wit-bindgen-rust",
+]
[[package]]
-name = "winnow"
-version = "0.7.13"
+name = "wit-component"
+version = "0.244.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "21a0236b59786fed61e2a80582dd500fe61f18b5dca67a4a067d0bc9039339cf"
+checksum = "9d66ea20e9553b30172b5e831994e35fbde2d165325bec84fc43dbf6f4eb9cb2"
+dependencies = [
+ "anyhow",
+ "bitflags 2.12.1",
+ "indexmap",
+ "log",
+ "serde",
+ "serde_derive",
+ "serde_json",
+ "wasm-encoder",
+ "wasm-metadata",
+ "wasmparser",
+ "wit-parser",
+]
[[package]]
-name = "wit-bindgen"
-version = "0.46.0"
+name = "wit-parser"
+version = "0.244.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f17a85883d4e6d00e8a97c586de764dabcc06133f7f1d55dce5cdc070ad7fe59"
+checksum = "ecc8ac4bc1dc3381b7f59c34f00b67e18f910c2c0f50015669dde7def656a736"
+dependencies = [
+ "anyhow",
+ "id-arena",
+ "indexmap",
+ "log",
+ "semver",
+ "serde",
+ "serde_derive",
+ "serde_json",
+ "unicode-xid",
+ "wasmparser",
+]
[[package]]
name = "write-json"
@@ -3610,9 +3801,9 @@ checksum = "23f6174b2566cc4a74f95e1367ec343e7fa80c93cc8087f5c4a3d6a1088b2118"
[[package]]
name = "writeable"
-version = "0.6.1"
+version = "0.6.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ea2f10b9bb0928dfb1b42b65e1f9e36f7f54dbdf08457afefb38afcdec4fa2bb"
+checksum = "1ffae5123b2d3fc086436f8834ae3ab053a283cfac8fe0a0b8eaae044768a4c4"
[[package]]
name = "xflags"
@@ -3666,11 +3857,10 @@ dependencies = [
[[package]]
name = "yoke"
-version = "0.8.0"
+version = "0.8.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5f41bb01b8226ef4bfd589436a297c53d118f65921786300e427be8d487695cc"
+checksum = "709fe23a0424b6a435d82152b1bd3fdfb0833487d5fa90d05d42762a9891fef5"
dependencies = [
- "serde",
"stable_deref_trait",
"yoke-derive",
"zerofrom",
@@ -3678,9 +3868,9 @@ dependencies = [
[[package]]
name = "yoke-derive"
-version = "0.8.0"
+version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "38da3c9736e16c5d3c8c597a9aaa5d1fa565d0532ae05e27c24aa62fb32c0ab6"
+checksum = "de844c262c8848816172cef550288e7dc6c7b7814b4ee56b3e1553f275f1858e"
dependencies = [
"proc-macro2",
"quote",
@@ -3690,18 +3880,18 @@ dependencies = [
[[package]]
name = "zerocopy"
-version = "0.8.27"
+version = "0.8.50"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0894878a5fa3edfd6da3f88c4805f4c8558e2b996227a3d864f47fe11e38282c"
+checksum = "3b065d4f0e55f82fae73202e189638116a87c55ab6b8e6c2721e13dd9d854ad1"
dependencies = [
"zerocopy-derive",
]
[[package]]
name = "zerocopy-derive"
-version = "0.8.27"
+version = "0.8.50"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "88d2b8d9c68ad2b9e4340d7832716a4d21a22a1154777ad56ea55c51a9cf3831"
+checksum = "0b631b19d36a892ab55420c92dbc83ccd79274f25be714855d3074aa71cab639"
dependencies = [
"proc-macro2",
"quote",
@@ -3710,18 +3900,18 @@ dependencies = [
[[package]]
name = "zerofrom"
-version = "0.1.6"
+version = "0.1.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "50cc42e0333e05660c3587f3bf9d0478688e15d870fab3346451ce7f8c9fbea5"
+checksum = "0ec05a11813ea801ff6d75110ad09cd0824ddba17dfe17128ea0d5f68e6c5272"
dependencies = [
"zerofrom-derive",
]
[[package]]
name = "zerofrom-derive"
-version = "0.1.6"
+version = "0.1.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d71e5d6e06ab090c67b5e44993ec16b72dcbaabc526db883a360057678b48502"
+checksum = "11532158c46691caf0f2593ea8358fed6bbf68a0315e80aae9bd41fbade684a1"
dependencies = [
"proc-macro2",
"quote",
@@ -3731,9 +3921,9 @@ dependencies = [
[[package]]
name = "zerotrie"
-version = "0.2.2"
+version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "36f0bbd478583f79edad978b407914f61b2972f5af6fa089686016be8f9af595"
+checksum = "0f9152d31db0792fa83f70fb2f83148effb5c1f5b8c7686c3459e361d9bc20bf"
dependencies = [
"displaydoc",
"yoke",
@@ -3742,9 +3932,9 @@ dependencies = [
[[package]]
name = "zerovec"
-version = "0.11.4"
+version = "0.11.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e7aa2bd55086f1ab526693ecbe444205da57e25f4489879da80635a46d90e73b"
+checksum = "90f911cbc359ab6af17377d242225f4d75119aec87ea711a880987b18cd7b239"
dependencies = [
"yoke",
"zerofrom",
@@ -3753,9 +3943,9 @@ dependencies = [
[[package]]
name = "zerovec-derive"
-version = "0.11.1"
+version = "0.11.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5b96237efa0c878c64bd89c436f661be4e46b2f3eff1ebb976f7ef2321d2f58f"
+checksum = "625dc425cab0dca6dc3c3319506e6593dcb08a9f387ea3b284dbd52a92c40555"
dependencies = [
"proc-macro2",
"quote",
@@ -3775,3 +3965,9 @@ dependencies = [
"memchr",
"time",
]
+
+[[package]]
+name = "zmij"
+version = "1.0.21"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b8848ee67ecc8aedbaf3e4122217aff892639231befc6a1b58d29fff4c2cabaa"
diff --git a/Cargo.toml b/Cargo.toml
index a08b2e412e..37e5dbb444 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -128,35 +128,35 @@ object = { version = "0.36.7", default-features = false, features = [
"pe",
] }
postcard = { version = "1.1.3", features = ["alloc"] }
-process-wrap = { version = "8.2.1", features = ["std"] }
+process-wrap = { version = "9.1.0", features = ["std"] }
pulldown-cmark-to-cmark = "10.0.4"
pulldown-cmark = { version = "0.9.6", default-features = false }
rayon = "1.10.0"
rowan = "=0.15.18"
# Ideally we'd not enable the macros feature but unfortunately the `tracked` attribute does not work
# on impls without it
-salsa = { version = "0.26.2", default-features = false, features = [
+salsa = { version = "0.27.0", default-features = false, features = [
"rayon",
"salsa_unstable",
"macros",
"inventory",
] }
-salsa-macros = "0.26.2"
+salsa-macros = "0.27.0"
semver = "1.0.26"
serde = { version = "1.0.219" }
serde_derive = { version = "1.0.219" }
serde_json = "1.0.140"
rustc-hash = "2.1.1"
-rustc-literal-escaper = "0.0.4"
+rustc-literal-escaper = "0.0.7"
smallvec = { version = "1.15.1", features = [
"const_new",
"union",
"const_generics",
] }
smol_str = "0.3.2"
-temp-dir = "0.1.16"
+temp-dir = "0.2.0"
text-size = "1.1.1"
-toml = "0.9.8"
+toml = "1.1.2"
tracing = { version = "0.1.41", default-features = false, features = ["std"] }
tracing-tree = "0.4.0"
tracing-subscriber = { version = "0.3.20", default-features = false, features = [
@@ -172,14 +172,13 @@ url = "2.5.4"
xshell = "0.2.7"
thin-vec = "0.2.16"
petgraph = { version = "0.8.2", default-features = false }
-
-# We need to freeze the version of the crate, as the raw-api feature is considered unstable
-dashmap = { version = "=6.1.0", features = ["raw-api", "inline"] }
-# We need to freeze the version of the crate, as it needs to match with dashmap
-hashbrown = { version = "0.14.*", features = [
+hashbrown = { version = "0.17.0", features = [
"inline-more",
], default-features = false }
+# We need to freeze the version of the crate, as the raw-api feature is considered unstable
+dashmap = { version = "=6.2.1", features = ["raw-api", "inline"] }
+
[workspace.lints.rust]
# remember to update RUSTFLAGS in ci.yml if you add something here
diff --git a/crates/base-db/src/lib.rs b/crates/base-db/src/lib.rs
index ff439119c9..a681ac72b7 100644
--- a/crates/base-db/src/lib.rs
+++ b/crates/base-db/src/lib.rs
@@ -170,16 +170,32 @@ impl Files {
};
}
- pub fn file_source_root(&self, id: vfs::FileId) -> FileSourceRootInput {
+ pub fn file_source_root(
+ &self,
+ db: &dyn SourceDatabase,
+ id: vfs::FileId,
+ ) -> FileSourceRootInput {
let file_source_root = match self.file_source_roots.get(&id) {
Some(file_source_root) => file_source_root,
None => panic!(
- "Unable to get `FileSourceRootInput` with `vfs::FileId` ({id:?}); this is a bug",
+ "Unable to get `FileSourceRootInput` with `vfs::FileId` ({id:?}, path: {}); this is a bug",
+ self.path_for_file(db, id)
+ .map_or_else(|| "<unknown>".to_owned(), |path| path.to_string()),
),
};
*file_source_root
}
+ fn path_for_file(&self, db: &dyn SourceDatabase, id: vfs::FileId) -> Option<vfs::VfsPath> {
+ for source_root in &*self.source_roots {
+ let source_root = *source_root.value();
+ if let Some(path) = source_root.source_root(db).path_for_file(&id) {
+ return Some(path.clone());
+ }
+ }
+ None
+ }
+
pub fn set_file_source_root_with_durability(
&self,
db: &mut dyn SourceDatabase,
diff --git a/crates/hir-def/src/expr_store.rs b/crates/hir-def/src/expr_store.rs
index 8768413ce5..6df95e1a78 100644
--- a/crates/hir-def/src/expr_store.rs
+++ b/crates/hir-def/src/expr_store.rs
@@ -795,6 +795,7 @@ impl ExpressionStore {
visitor.on_pat(target);
visitor.on_expr(value);
}
+ Expr::IncludeBytes => {}
}
}
diff --git a/crates/hir-def/src/expr_store/lower.rs b/crates/hir-def/src/expr_store/lower.rs
index 242a0b0b4f..3094e08a53 100644
--- a/crates/hir-def/src/expr_store/lower.rs
+++ b/crates/hir-def/src/expr_store/lower.rs
@@ -204,7 +204,7 @@ pub(crate) fn lower_type_ref(
(store, source_map, type_ref)
}
-pub(crate) fn lower_generic_params(
+pub fn lower_generic_params(
db: &dyn DefDatabase,
module: ModuleId,
def: GenericDefId,
@@ -1748,6 +1748,7 @@ impl<'db> ExprCollector<'db> {
self.alloc_expr(Expr::OffsetOf(OffsetOf { container, fields }), syntax_ptr)
}
ast::Expr::FormatArgsExpr(f) => self.collect_format_args(f, syntax_ptr),
+ ast::Expr::IncludeBytesExpr(_) => self.alloc_expr(Expr::IncludeBytes, syntax_ptr)
})
}
diff --git a/crates/hir-def/src/expr_store/pretty.rs b/crates/hir-def/src/expr_store/pretty.rs
index 293adfc9bd..25e5711d1e 100644
--- a/crates/hir-def/src/expr_store/pretty.rs
+++ b/crates/hir-def/src/expr_store/pretty.rs
@@ -14,7 +14,7 @@ use stdx::never;
use syntax::ast::{HasName, RangeOp};
use crate::{
- AdtId, DefWithBodyId, FunctionId, GenericDefId, StructId, TypeParamId, VariantId,
+ AdtId, DefWithBodyId, FunctionId, GenericDefId, MacroId, StructId, TypeParamId, VariantId,
attrs::AttrFlags,
expr_store::path::{GenericArg, GenericArgs},
hir::{
@@ -537,6 +537,7 @@ impl Printer<'_> {
Expr::Missing => w!(self, "�"),
Expr::Underscore => w!(self, "_"),
Expr::InlineAsm(_) => w!(self, "builtin#asm(_)"),
+ Expr::IncludeBytes => w!(self, "include_bytes!(_)"),
Expr::OffsetOf(offset_of) => {
w!(self, "builtin#offset_of(");
self.print_type_ref(offset_of.container);
@@ -1136,6 +1137,9 @@ impl Printer<'_> {
LangItemTarget::TraitId(it) => write_name!(it),
LangItemTarget::EnumVariantId(it) => write_name!(it),
LangItemTarget::ConstId(it) => write_name!(it),
+ LangItemTarget::MacroId(MacroId::Macro2Id(it)) => write_name!(it),
+ LangItemTarget::MacroId(MacroId::MacroRulesId(it)) => write_name!(it),
+ LangItemTarget::MacroId(MacroId::ProcMacroId(it)) => write_name!(it),
}
if let Some(s) = s {
diff --git a/crates/hir-def/src/hir.rs b/crates/hir-def/src/hir.rs
index 2f7724c72e..a800569044 100644
--- a/crates/hir-def/src/hir.rs
+++ b/crates/hir-def/src/hir.rs
@@ -323,6 +323,7 @@ pub enum Expr {
Underscore,
OffsetOf(OffsetOf),
InlineAsm(InlineAsm),
+ IncludeBytes,
}
impl Expr {
@@ -344,7 +345,8 @@ impl Expr {
| Expr::RecordLit { .. }
| Expr::Tuple { .. }
| Expr::OffsetOf(_)
- | Expr::Underscore => ExprPrecedence::Unambiguous,
+ | Expr::Underscore
+ | Expr::IncludeBytes => ExprPrecedence::Unambiguous,
Expr::Await { .. }
| Expr::Call { .. }
diff --git a/crates/hir-def/src/lang_item.rs b/crates/hir-def/src/lang_item.rs
index f9d5a843bd..04dfdb7d16 100644
--- a/crates/hir-def/src/lang_item.rs
+++ b/crates/hir-def/src/lang_item.rs
@@ -26,10 +26,11 @@ pub enum LangItemTarget {
TraitId(TraitId),
EnumVariantId(EnumVariantId),
ConstId(ConstId),
+ MacroId(MacroId),
}
impl_from!(
- EnumId, FunctionId, ImplId, StaticId, StructId, UnionId, TypeAliasId, TraitId, EnumVariantId, ConstId for LangItemTarget
+ EnumId, FunctionId, ImplId, StaticId, StructId, UnionId, TypeAliasId, TraitId, EnumVariantId, ConstId, MacroId for LangItemTarget
);
/// Salsa query. This will look for lang items in a specific crate.
@@ -276,7 +277,6 @@ impl LangItems {
(self.BitXorAssign, &mut self.BitXorAssign_bitxor_assign, sym::bitxor_assign),
(self.BitOrAssign, &mut self.BitOrAssign_bitor_assign, sym::bitor_assign),
(self.BitAndAssign, &mut self.BitAndAssign_bitand_assign, sym::bitand_assign),
- (self.Drop, &mut self.Drop_drop, sym::drop),
(self.Debug, &mut self.Debug_fmt, sym::fmt),
(self.Deref, &mut self.Deref_deref, sym::deref),
(self.DerefMut, &mut self.DerefMut_deref_mut, sym::deref_mut),
@@ -307,6 +307,13 @@ impl LangItems {
);
Some(())
})();
+ (|| {
+ methods(
+ self.Drop?,
+ &mut [(&mut self.Drop_drop, sym::drop), (&mut self.Drop_pin_drop, sym::pin_drop)],
+ );
+ Some(())
+ })();
}
}
@@ -397,11 +404,15 @@ macro_rules! language_item_table {
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
+ #[allow(non_camel_case_types)]
pub enum LangItemEnum {
$(
$(#[$attr])*
$lang_item,
)*
+ $( $non_lang_trait, )*
+ $( $non_lang_macro_field, )*
+ $( $resolve_manually, )*
}
impl LangItemEnum {
@@ -409,6 +420,9 @@ macro_rules! language_item_table {
pub fn from_lang_items(self, lang_items: &LangItems) -> Option<LangItemTarget> {
match self {
$( LangItemEnum::$lang_item => lang_items.$lang_item.map(Into::into), )*
+ $( LangItemEnum::$non_lang_trait => lang_items.$non_lang_trait.map(Into::into), )*
+ $( LangItemEnum::$non_lang_macro_field => lang_items.$non_lang_macro_field.map(Into::into), )*
+ $( LangItemEnum::$resolve_manually => lang_items.$resolve_manually.map(Into::into), )*
}
}
@@ -716,6 +730,7 @@ language_item_table! { LangItems =>
PartialOrd_ge, FunctionId;
PartialOrd_gt, FunctionId;
Drop_drop, FunctionId;
+ Drop_pin_drop, FunctionId;
Debug_fmt, FunctionId;
Deref_deref, FunctionId;
DerefMut_deref_mut, FunctionId;
diff --git a/crates/hir-def/src/lib.rs b/crates/hir-def/src/lib.rs
index a1bb82e7f2..2172e2412b 100644
--- a/crates/hir-def/src/lib.rs
+++ b/crates/hir-def/src/lib.rs
@@ -1017,6 +1017,14 @@ pub enum VariantId {
impl_from!(EnumVariantId, StructId, UnionId for VariantId);
impl VariantId {
+ pub fn from_non_enum(adt_id: AdtId) -> Option<Self> {
+ Some(match adt_id {
+ AdtId::StructId(struct_id) => struct_id.into(),
+ AdtId::UnionId(union_id) => union_id.into(),
+ AdtId::EnumId(_) => return None,
+ })
+ }
+
pub fn fields(self, db: &dyn DefDatabase) -> &VariantFields {
VariantFields::of(db, self)
}
diff --git a/crates/hir-def/src/resolver.rs b/crates/hir-def/src/resolver.rs
index 0062e6c170..c16ad9b4f2 100644
--- a/crates/hir-def/src/resolver.rs
+++ b/crates/hir-def/src/resolver.rs
@@ -195,7 +195,8 @@ impl<'db> Resolver<'db> {
LangItemTarget::FunctionId(_)
| LangItemTarget::ImplId(_)
| LangItemTarget::StaticId(_)
- | LangItemTarget::ConstId(_) => return None,
+ | LangItemTarget::ConstId(_)
+ | LangItemTarget::MacroId(_) => return None,
};
return Some((
type_ns,
@@ -343,7 +344,8 @@ impl<'db> Resolver<'db> {
| LangItemTarget::ImplId(_)
| LangItemTarget::TypeAliasId(_)
| LangItemTarget::TraitId(_)
- | LangItemTarget::EnumId(_) => return None,
+ | LangItemTarget::EnumId(_)
+ | LangItemTarget::MacroId(_) => return None,
}),
ResolvePathResultPrefixInfo::default(),
));
@@ -359,7 +361,8 @@ impl<'db> Resolver<'db> {
LangItemTarget::FunctionId(_)
| LangItemTarget::ImplId(_)
| LangItemTarget::StaticId(_)
- | LangItemTarget::ConstId(_) => return None,
+ | LangItemTarget::ConstId(_)
+ | LangItemTarget::MacroId(_) => return None,
};
// Remaining segments start from 0 because lang paths have no segments other than the remaining.
return Some((
diff --git a/crates/hir-def/src/test_db.rs b/crates/hir-def/src/test_db.rs
index 913b99223d..e3fd4560f0 100644
--- a/crates/hir-def/src/test_db.rs
+++ b/crates/hir-def/src/test_db.rs
@@ -122,7 +122,7 @@ impl SourceDatabase for TestDB {
}
fn file_source_root(&self, id: base_db::FileId) -> FileSourceRootInput {
- self.files.file_source_root(id)
+ self.files.file_source_root(self, id)
}
fn set_file_source_root_with_durability(
diff --git a/crates/hir-expand/src/builtin/fn_macro.rs b/crates/hir-expand/src/builtin/fn_macro.rs
index 9181ad88b6..e12cdef495 100644
--- a/crates/hir-expand/src/builtin/fn_macro.rs
+++ b/crates/hir-expand/src/builtin/fn_macro.rs
@@ -852,17 +852,9 @@ fn include_bytes_expand(
span: Span,
) -> ExpandResult<tt::TopSubtree> {
// FIXME: actually read the file here if the user asked for macro expansion
- let underscore = sym::underscore;
- let zero = tt::Literal {
- text_and_suffix: sym::_0_u8,
- span,
- kind: tt::LitKind::Integer,
- suffix_len: 3,
- };
- // We don't use a real length since we can't know the file length, so we use an underscore
- // to infer it.
+ let pound = mk_pound(span);
let res = quote! {span =>
- &[#zero; #underscore]
+ builtin #pound include_bytes
};
ExpandResult::ok(res)
}
diff --git a/crates/hir-expand/src/name.rs b/crates/hir-expand/src/name.rs
index 3ddc305f95..b511bc3c15 100644
--- a/crates/hir-expand/src/name.rs
+++ b/crates/hir-expand/src/name.rs
@@ -201,10 +201,15 @@ impl Name {
#[inline]
pub fn is_generated(&self) -> bool {
- self.as_str().starts_with("<ra@gennew>")
+ is_generated(self.as_str())
}
}
+#[inline]
+pub fn is_generated(name: &str) -> bool {
+ name.starts_with("<ra@gennew>")
+}
+
struct Display<'a> {
name: &'a Name,
edition: Edition,
diff --git a/crates/hir-ty/src/builtin_derive.rs b/crates/hir-ty/src/builtin_derive.rs
index 928e3da6e8..65a910555d 100644
--- a/crates/hir-ty/src/builtin_derive.rs
+++ b/crates/hir-ty/src/builtin_derive.rs
@@ -17,12 +17,11 @@ use rustc_type_ir::{
};
use crate::{
- GenericPredicates,
+ FieldType, GenericPredicates,
db::HirDatabase,
next_solver::{
AliasTy, Clause, Clauses, DbInterner, EarlyBinder, GenericArgs, ParamEnv,
- StoredEarlyBinder, StoredTy, TraitRef, Ty, TyKind, Unnormalized, fold::fold_tys,
- generics::Generics,
+ StoredEarlyBinder, TraitRef, Ty, TyKind, Unnormalized, fold::fold_tys, generics::Generics,
},
};
@@ -333,7 +332,7 @@ fn simple_trait_predicates<'db>(
fn extend_assoc_type_bounds<'db>(
interner: DbInterner<'db>,
assoc_type_bounds: &mut Vec<Clause<'db>>,
- fields: &ArenaMap<LocalFieldId, StoredEarlyBinder<StoredTy>>,
+ fields: &ArenaMap<LocalFieldId, FieldType>,
trait_id: TraitId,
trait_: BuiltinDeriveImplTrait,
) {
@@ -365,7 +364,7 @@ fn extend_assoc_type_bounds<'db>(
let mut visitor = ProjectionFinder { interner, assoc_type_bounds, trait_id, trait_ };
for (_, field) in fields.iter() {
- field.get().instantiate_identity().skip_norm_wip().visit_with(&mut visitor);
+ field.ty().instantiate_identity().skip_norm_wip().visit_with(&mut visitor);
}
}
diff --git a/crates/hir-ty/src/consteval.rs b/crates/hir-ty/src/consteval.rs
index 2c43feeb3b..d6580d3752 100644
--- a/crates/hir-ty/src/consteval.rs
+++ b/crates/hir-ty/src/consteval.rs
@@ -23,6 +23,7 @@ use crate::{
db::{AnonConstId, AnonConstLoc, GeneralConstId, HirDatabase},
display::DisplayTarget,
generics::Generics,
+ lower::LoweringMode,
mir::{MirEvalError, MirLowerError, pad16},
next_solver::{
Allocation, Const, ConstKind, Consts, DbInterner, DefaultAny, GenericArgs, ParamConst,
@@ -305,6 +306,7 @@ pub(crate) enum CreateConstError<'db> {
DoesNotResolve,
ConstHasGenerics,
UnderscoreExpr,
+ AnonConstInterningDisabled,
TypeMismatch {
#[expect(unused, reason = "will need this for diagnostics")]
actual: Ty<'db>,
@@ -355,6 +357,7 @@ pub(crate) fn create_anon_const<'a, 'db>(
expected_ty: Ty<'db>,
generics: &dyn Fn() -> &'a Generics<'db>,
create_var: Option<&mut dyn FnMut(Span) -> Const<'db>>,
+ lowering_mode: LoweringMode,
forbid_params_after: Option<u32>,
) -> Result<Const<'db>, CreateConstError<'db>> {
match &store[expr] {
@@ -374,6 +377,10 @@ pub(crate) fn create_anon_const<'a, 'db>(
konst
}
_ => {
+ let Some(token) = lowering_mode.allow_tracked_structs() else {
+ return Err(CreateConstError::AnonConstInterningDisabled);
+ };
+
let allow_using_generic_params = forbid_params_after.is_none();
let konst = AnonConstId::new(
interner.db,
@@ -383,6 +390,7 @@ pub(crate) fn create_anon_const<'a, 'db>(
ty: StoredEarlyBinder::bind(expected_ty.store()),
allow_using_generic_params,
},
+ token,
);
let args = if allow_using_generic_params {
GenericArgs::identity_for_item(interner, owner.generic_def(interner.db).into())
diff --git a/crates/hir-ty/src/db.rs b/crates/hir-ty/src/db.rs
index 511ab85610..baf8bbd56f 100644
--- a/crates/hir-ty/src/db.rs
+++ b/crates/hir-ty/src/db.rs
@@ -22,12 +22,12 @@ use stdx::impl_from;
use triomphe::Arc;
use crate::{
- GenericDefaultsRef, GenericPredicates, ImplTraitId, InferBodyId, TyDefId, TyLoweringResult,
- ValueTyDefId,
+ FieldType, GenericDefaultsRef, GenericPredicates, ImplTraitId, InferBodyId, TyDefId,
+ TyLoweringResult, ValueTyDefId,
consteval::ConstEvalError,
dyn_compatibility::DynCompatibilityViolation,
layout::{Layout, LayoutError},
- lower::{GenericDefaults, TypeAliasBounds},
+ lower::{GenericDefaults, TrackedStructToken, TypeAliasBounds},
mir::{BorrowckResult, MirBody, MirLowerError},
next_solver::{
Allocation, Clause, EarlyBinder, GenericArgs, ParamEnv, PolyFnSig, StoredClauses,
@@ -225,11 +225,11 @@ pub trait HirDatabase: DefDatabase + std::fmt::Debug {
fn field_types_with_diagnostics(
&self,
var: VariantId,
- ) -> &TyLoweringResult<ArenaMap<LocalFieldId, StoredEarlyBinder<StoredTy>>>;
+ ) -> &TyLoweringResult<ArenaMap<LocalFieldId, FieldType>>;
#[salsa::invoke(crate::lower::field_types_query)]
#[salsa::transparent]
- fn field_types(&self, var: VariantId) -> &ArenaMap<LocalFieldId, StoredEarlyBinder<StoredTy>>;
+ fn field_types(&self, var: VariantId) -> &ArenaMap<LocalFieldId, FieldType>;
#[salsa::invoke(crate::lower::callable_item_signature)]
#[salsa::transparent]
@@ -421,13 +421,20 @@ pub struct AnonConstLoc {
pub(crate) allow_using_generic_params: bool,
}
-#[salsa_macros::interned(debug, no_lifetime, revisions = usize::MAX)]
+#[salsa_macros::interned(debug, no_lifetime, revisions = usize::MAX, constructor = new_)]
#[derive(PartialOrd, Ord)]
pub struct AnonConstId {
#[returns(ref)]
pub loc: AnonConstLoc,
}
+impl AnonConstId {
+ pub(crate) fn new(db: &dyn DefDatabase, loc: AnonConstLoc, token: TrackedStructToken) -> Self {
+ _ = token;
+ AnonConstId::new_(db, loc)
+ }
+}
+
impl HasModule for AnonConstId {
fn module(&self, db: &dyn DefDatabase) -> ModuleId {
self.loc(db).owner.module(db)
diff --git a/crates/hir-ty/src/diagnostics/match_check/pat_analysis.rs b/crates/hir-ty/src/diagnostics/match_check/pat_analysis.rs
index 984ac1abfb..5994ca2f14 100644
--- a/crates/hir-ty/src/diagnostics/match_check/pat_analysis.rs
+++ b/crates/hir-ty/src/diagnostics/match_check/pat_analysis.rs
@@ -148,7 +148,7 @@ impl<'a, 'db> MatchCheckCtx<'a, 'db> {
let fields_len = variant.fields(self.db).fields().len() as u32;
(0..fields_len).map(|idx| LocalFieldId::from_raw(idx.into())).map(move |fid| {
- let ty = field_tys[fid].get().instantiate(self.infcx.interner, substs).skip_norm_wip();
+ let ty = field_tys[fid].ty().instantiate(self.infcx.interner, substs).skip_norm_wip();
let ty = self
.infcx
.at(&ObligationCause::dummy(), self.env)
diff --git a/crates/hir-ty/src/display.rs b/crates/hir-ty/src/display.rs
index 8edb178cd7..ab290aa57a 100644
--- a/crates/hir-ty/src/display.rs
+++ b/crates/hir-ty/src/display.rs
@@ -51,7 +51,7 @@ use span::Edition;
use stdx::never;
use crate::{
- CallableDefId, ImplTraitId, MemoryMap, ParamEnvAndCrate, consteval,
+ CallableDefId, FieldType, ImplTraitId, MemoryMap, ParamEnvAndCrate, consteval,
db::{GeneralConstId, HirDatabase},
generics::{ProvenanceSplit, generics},
layout::Layout,
@@ -60,8 +60,8 @@ use crate::{
next_solver::{
AliasTy, Allocation, Clause, ClauseKind, Const, ConstKind, DbInterner,
ExistentialPredicate, FnSig, GenericArg, GenericArgKind, GenericArgs, ParamEnv, PolyFnSig,
- Region, StoredEarlyBinder, StoredTy, Term, TermId, TermKind, TraitPredicate, TraitRef, Ty,
- TyKind, TypingMode, Unnormalized, ValTree,
+ Region, Term, TermId, TermKind, TraitPredicate, TraitRef, Ty, TyKind, TypingMode,
+ Unnormalized, ValTree,
abi::Safety,
infer::{DbInternerInferExt, traits::ObligationCause},
},
@@ -1198,7 +1198,7 @@ fn render_const_scalar_from_valtree_inner<'db>(
fn render_variant_after_name<'db>(
data: &VariantFields,
f: &mut HirFormatter<'_, 'db>,
- field_types: &'db ArenaMap<LocalFieldId, StoredEarlyBinder<StoredTy>>,
+ field_types: &'db ArenaMap<LocalFieldId, FieldType>,
param_env: ParamEnv<'db>,
layout: &Layout,
args: GenericArgs<'db>,
@@ -1210,7 +1210,7 @@ fn render_variant_after_name<'db>(
FieldsShape::Record | FieldsShape::Tuple => {
let render_field = |f: &mut HirFormatter<'_, 'db>, id: LocalFieldId| {
let offset = layout.fields.offset(u32::from(id.into_raw()) as usize).bytes_usize();
- let ty = field_types[id].get().instantiate(f.interner, args).skip_norm_wip();
+ let ty = field_types[id].ty().instantiate(f.interner, args).skip_norm_wip();
let Ok(layout) = f.db.layout_of_ty(ty.store(), param_env.store()) else {
return f.write_str("<layout-error>");
};
diff --git a/crates/hir-ty/src/drop.rs b/crates/hir-ty/src/drop.rs
index e1fbc85960..08860e1e45 100644
--- a/crates/hir-ty/src/drop.rs
+++ b/crates/hir-ty/src/drop.rs
@@ -83,10 +83,10 @@ fn has_drop_glue_impl<'db>(
}
db.field_types(id.into())
.iter()
- .map(|(_, field_ty)| {
+ .map(|(_, field)| {
has_drop_glue_impl(
infcx,
- field_ty.get().instantiate(infcx.interner, subst).skip_norm_wip(),
+ field.ty().instantiate(infcx.interner, subst).skip_norm_wip(),
env,
visited,
)
@@ -103,13 +103,10 @@ fn has_drop_glue_impl<'db>(
.map(|&(variant, _)| {
db.field_types(variant.into())
.iter()
- .map(|(_, field_ty)| {
+ .map(|(_, field)| {
has_drop_glue_impl(
infcx,
- field_ty
- .get()
- .instantiate(infcx.interner, subst)
- .skip_norm_wip(),
+ field.ty().instantiate(infcx.interner, subst).skip_norm_wip(),
env,
visited,
)
diff --git a/crates/hir-ty/src/infer.rs b/crates/hir-ty/src/infer.rs
index 2df2789a2e..616701f80c 100644
--- a/crates/hir-ty/src/infer.rs
+++ b/crates/hir-ty/src/infer.rs
@@ -91,7 +91,8 @@ use crate::{
unify::resolve_completely::WriteBackCtxt,
},
lower::{
- ImplTraitIdx, ImplTraitLoweringMode, LifetimeElisionKind, diagnostics::TyLoweringDiagnostic,
+ ImplTraitIdx, ImplTraitLoweringMode, LifetimeElisionKind, LoweringMode,
+ diagnostics::TyLoweringDiagnostic,
},
method_resolution::CandidateId,
next_solver::{
@@ -116,13 +117,14 @@ use cast::{CastCheck, CastError};
/// The entry point of type inference.
fn infer_query(db: &dyn HirDatabase, def: DefWithBodyId) -> InferenceResult {
- infer_query_with_inspect(db, def, None)
+ infer_query_with_inspect(db, def, None, LoweringMode::Analysis)
}
pub fn infer_query_with_inspect<'db>(
db: &'db dyn HirDatabase,
def: DefWithBodyId,
inspect: Option<ObligationInspector<'db>>,
+ lowering_mode: LoweringMode,
) -> InferenceResult {
let _p = tracing::info_span!("infer_query").entered();
let resolver = def.resolver(db);
@@ -135,6 +137,7 @@ pub fn infer_query_with_inspect<'db>(
&body.store,
resolver,
true,
+ lowering_mode,
);
if let Some(inspect) = inspect {
@@ -202,6 +205,7 @@ fn infer_anon_const_query(db: &dyn HirDatabase, def: AnonConstId) -> InferenceRe
store,
resolver,
loc.allow_using_generic_params,
+ LoweringMode::Analysis,
);
ctx.infer_expr(
@@ -1236,6 +1240,7 @@ pub(crate) struct InferenceContext<'body, 'db> {
pub(crate) store_owner: ExpressionStoreOwnerId,
pub(crate) generic_def: GenericDefId,
pub(crate) store: &'body ExpressionStore,
+ pub(crate) lowering_mode: LoweringMode,
/// Generally you should not resolve things via this resolver. Instead create a TyLoweringContext
/// and resolve the path via its methods. This will ensure proper error reporting.
pub(crate) resolver: Resolver<'db>,
@@ -1335,6 +1340,7 @@ impl<'body, 'db> InferenceContext<'body, 'db> {
store: &'body ExpressionStore,
resolver: Resolver<'db>,
allow_using_generic_params: bool,
+ lowering_mode: LoweringMode,
) -> Self {
let trait_env = db.trait_environment(generic_def);
let table = unify::InferenceTable::new(db, trait_env, resolver.krate(), store_owner);
@@ -1369,6 +1375,7 @@ impl<'body, 'db> InferenceContext<'body, 'db> {
vars_emitted_type_must_be_known_for: FxHashSet::default(),
deferred_call_resolutions: FxHashMap::default(),
defined_anon_consts: RefCell::new(ThinVec::new()),
+ lowering_mode,
}
}
@@ -1969,6 +1976,7 @@ impl<'body, 'db> InferenceContext<'body, 'db> {
expected_ty,
&|| self.generics(),
Some(&mut |span| self.table.next_const_var(span)),
+ self.lowering_mode,
(!(allow_using_generic_params && self.allow_using_generic_params)).then_some(0),
);
@@ -2046,7 +2054,7 @@ impl<'body, 'db> InferenceContext<'body, 'db> {
.field_types(struct_id.into())
.values()
.next_back()
- .map(|it| it.get())
+ .map(|it| it.ty())
{
Some(field) => {
ty = field.instantiate(self.interner(), substs).skip_norm_wip();
diff --git a/crates/hir-ty/src/infer/cast.rs b/crates/hir-ty/src/infer/cast.rs
index 93aed344d4..da996ccbea 100644
--- a/crates/hir-ty/src/infer/cast.rs
+++ b/crates/hir-ty/src/infer/cast.rs
@@ -541,7 +541,7 @@ fn pointer_kind<'db>(
let struct_data = id.fields(ctx.db);
if let Some((last_field, _)) = struct_data.fields().iter().last() {
let last_field_ty = ctx.db.field_types(id.into())[last_field]
- .get()
+ .ty()
.instantiate(ctx.interner(), subst)
.skip_norm_wip();
pointer_kind(expr, last_field_ty, ctx)
diff --git a/crates/hir-ty/src/infer/closure/analysis/expr_use_visitor.rs b/crates/hir-ty/src/infer/closure/analysis/expr_use_visitor.rs
index 2642844e38..34f9508e76 100644
--- a/crates/hir-ty/src/infer/closure/analysis/expr_use_visitor.rs
+++ b/crates/hir-ty/src/infer/closure/analysis/expr_use_visitor.rs
@@ -692,6 +692,8 @@ impl<'a, 'b, 'db, D: Delegate<'db>> ExprUseVisitor<'a, 'b, 'db, D> {
self.consume_expr(rhs)?;
}
}
+
+ Expr::IncludeBytes => {}
}
Ok(())
}
@@ -772,7 +774,7 @@ impl<'a, 'b, 'db, D: Delegate<'db>> ExprUseVisitor<'a, 'b, 'db, D> {
with_expr.into(),
with_place.clone(),
adt_field_types[f_index]
- .get()
+ .ty()
.instantiate(self.cx.interner(), args)
.skip_norm_wip(),
ProjectionKind::Field {
diff --git a/crates/hir-ty/src/infer/expr.rs b/crates/hir-ty/src/infer/expr.rs
index 75e6440334..5f752da3d0 100644
--- a/crates/hir-ty/src/infer/expr.rs
+++ b/crates/hir-ty/src/infer/expr.rs
@@ -269,7 +269,8 @@ impl<'db> InferenceContext<'_, 'db> {
| Expr::Box { .. }
| Expr::RecordLit { .. }
| Expr::Yeet { .. }
- | Expr::Missing => false,
+ | Expr::Missing
+ | Expr::IncludeBytes => false,
}
}
@@ -893,6 +894,11 @@ impl<'db> InferenceContext<'_, 'db> {
self.types.types.unit
}
}
+ Expr::IncludeBytes => {
+ let len = self.table.next_const_var(Span::Dummy);
+ let arr = Ty::new_array_with_const_len(self.interner(), self.types.types.u8, len);
+ Ty::new_ref(self.interner(), self.types.regions.statik, arr, Mutability::Not)
+ }
};
let ty = self.insert_type_vars_shallow(ty);
self.write_expr_ty(tgt_expr, ty);
@@ -1055,14 +1061,14 @@ impl<'db> InferenceContext<'_, 'db> {
});
}
- variant_field_tys[i].get().instantiate(interner, args).skip_norm_wip()
+ variant_field_tys[i].ty().instantiate(interner, args).skip_norm_wip()
} else {
if let Some(field_idx) = seen_fields.get(&name) {
self.push_diagnostic(InferenceDiagnostic::DuplicateField {
field: field.expr.into(),
variant,
});
- variant_field_tys[*field_idx].get().instantiate(interner, args).skip_norm_wip()
+ variant_field_tys[*field_idx].ty().instantiate(interner, args).skip_norm_wip()
} else {
self.push_diagnostic(InferenceDiagnostic::NoSuchField {
field: field.expr.into(),
@@ -1118,12 +1124,12 @@ impl<'db> InferenceContext<'_, 'db> {
// type we expect from the expectation value.
for (field_idx, field) in variant_fields.fields().iter() {
let fru_ty = variant_field_tys[field_idx]
- .get()
+ .ty()
.instantiate(interner, fresh_args)
.skip_norm_wip();
if remaining_fields.remove(&field.name).is_some() {
let target_ty = variant_field_tys[field_idx]
- .get()
+ .ty()
.instantiate(interner, args)
.skip_norm_wip();
let cause = ObligationCause::new(expr);
@@ -1678,7 +1684,7 @@ impl<'db> InferenceContext<'_, 'db> {
return None;
}
let ty = self.db.field_types(field_id.parent)[field_id.local_id]
- .get()
+ .ty()
.instantiate(interner, parameters)
.skip_norm_wip();
Some((Either::Left(field_id), ty))
@@ -1697,7 +1703,7 @@ impl<'db> InferenceContext<'_, 'db> {
let adjustments =
self.table.register_infer_ok(autoderef.adjust_steps_as_infer_ok());
let ty = self.db.field_types(field_id.parent)[field_id.local_id]
- .get()
+ .ty()
.instantiate(self.interner(), subst)
.skip_norm_wip();
let ty = self.process_remote_user_written_ty(ty);
diff --git a/crates/hir-ty/src/infer/mutability.rs b/crates/hir-ty/src/infer/mutability.rs
index 483f54a227..4fa1b71ad4 100644
--- a/crates/hir-ty/src/infer/mutability.rs
+++ b/crates/hir-ty/src/infer/mutability.rs
@@ -197,7 +197,8 @@ impl<'db> InferenceContext<'_, 'db> {
| Expr::Literal(_)
| Expr::Path(_)
| Expr::Continue { .. }
- | Expr::Underscore => (),
+ | Expr::Underscore
+ | Expr::IncludeBytes => (),
}
}
diff --git a/crates/hir-ty/src/infer/pat.rs b/crates/hir-ty/src/infer/pat.rs
index c36c29d6c7..915da943ca 100644
--- a/crates/hir-ty/src/infer/pat.rs
+++ b/crates/hir-ty/src/infer/pat.rs
@@ -1074,7 +1074,7 @@ impl<'a, 'db> InferenceContext<'a, 'db> {
for (i, &subpat) in subpats.iter().enumerate_and_adjust(variant_fields.len(), ddpos) {
let field_id = LocalFieldId::from_raw(la_arena::RawIdx::from_u32(i as u32));
let field_ty =
- variant_field_tys[field_id].get().instantiate(interner, args).skip_norm_wip();
+ variant_field_tys[field_id].ty().instantiate(interner, args).skip_norm_wip();
self.infer_pat(subpat, field_ty, pat_info);
}
if let Err(()) = had_err {
@@ -1093,7 +1093,7 @@ impl<'a, 'db> InferenceContext<'a, 'db> {
for (i, &pat) in subpats.iter().enumerate() {
let field_id = LocalFieldId::from_raw(la_arena::RawIdx::from_u32(i as u32));
let expected = match variant_field_tys.get(field_id) {
- Some(field_ty) => field_ty.get().instantiate(interner, args).skip_norm_wip(),
+ Some(field_ty) => field_ty.ty().instantiate(interner, args).skip_norm_wip(),
None => self.types.types.error,
};
self.infer_pat(pat, expected, pat_info);
@@ -1208,7 +1208,7 @@ impl<'a, 'db> InferenceContext<'a, 'db> {
});
}
- variant_field_tys[field_idx].get().instantiate(interner, args).skip_norm_wip()
+ variant_field_tys[field_idx].ty().instantiate(interner, args).skip_norm_wip()
}
None => {
inexistent_fields.push(field);
diff --git a/crates/hir-ty/src/inhabitedness.rs b/crates/hir-ty/src/inhabitedness.rs
index 26253fbabf..bca91d07a7 100644
--- a/crates/hir-ty/src/inhabitedness.rs
+++ b/crates/hir-ty/src/inhabitedness.rs
@@ -157,7 +157,7 @@ impl<'a, 'db> UninhabitedFrom<'a, 'db> {
};
for (fid, _) in fields.iter() {
- self.visit_field(field_vis.as_ref().map(|it| it[fid]), &field_tys[fid].get(), subst)?;
+ self.visit_field(field_vis.as_ref().map(|it| it[fid]), &field_tys[fid].ty(), subst)?;
}
CONTINUE_OPAQUELY_INHABITED
}
diff --git a/crates/hir-ty/src/layout.rs b/crates/hir-ty/src/layout.rs
index 2b0a93e61d..ed4775539a 100644
--- a/crates/hir-ty/src/layout.rs
+++ b/crates/hir-ty/src/layout.rs
@@ -148,7 +148,7 @@ fn layout_of_simd_ty<'db>(
let mut fields = fields.iter();
let Some(TyKind::Array(e_ty, e_len)) =
fields.next().filter(|_| fields.next().is_none()).map(|f| {
- (*f.1).get().instantiate(DbInterner::new_no_crate(db), args).skip_norm_wip().kind()
+ (*f.1).ty().instantiate(DbInterner::new_no_crate(db), args).skip_norm_wip().kind()
})
else {
return Err(LayoutError::InvalidSimdType);
@@ -418,17 +418,15 @@ pub fn layout_of_ty_query(
.iter()
.map(|pat| match pat.kind() {
PatternKind::Range { start, end } => Ok::<_, LayoutError>((
- extract_const_value(start)
- .unwrap()
+ extract_const_value(start)?
.try_to_bits(db, trait_env.as_ref())
.ok_or(LayoutError::Unknown)?,
- extract_const_value(end)
- .unwrap()
+ extract_const_value(end)?
.try_to_bits(db, trait_env.as_ref())
.ok_or(LayoutError::Unknown)?,
)),
PatternKind::NotNull | PatternKind::Or(_) => {
- unreachable!("mixed or patterns are not allowed")
+ Err(LayoutError::Unknown)
}
})
.collect();
@@ -567,7 +565,7 @@ fn field_ty<'a>(
fd: LocalFieldId,
args: GenericArgs<'a>,
) -> Ty<'a> {
- db.field_types(def)[fd].get().instantiate(DbInterner::new_no_crate(db), args).skip_norm_wip()
+ db.field_types(def)[fd].ty().instantiate(DbInterner::new_no_crate(db), args).skip_norm_wip()
}
fn scalar_unit(dl: &TargetDataLayout, value: Primitive) -> Scalar {
diff --git a/crates/hir-ty/src/layout/tests.rs b/crates/hir-ty/src/layout/tests.rs
index afbafb3fea..b9ee38c44f 100644
--- a/crates/hir-ty/src/layout/tests.rs
+++ b/crates/hir-ty/src/layout/tests.rs
@@ -535,13 +535,21 @@ fn non_zero_and_non_null() {
}
check_size_and_align(
r#"
-const END: usize = 10;
-struct Goal(core::pattern_type!(usize is 0..=END));
- "#,
+ const END: usize = 10;
+ struct Goal(core::pattern_type!(usize is 0..=END));
+ "#,
"//- minicore: pat\n",
8,
8,
);
+ check_size_and_align(
+ r#"
+pub struct Goal(core::pattern_type!(i32 is ..0 | 1..));
+ "#,
+ "//- minicore: pat\n",
+ 4,
+ 4,
+ );
}
#[test]
diff --git a/crates/hir-ty/src/lib.rs b/crates/hir-ty/src/lib.rs
index f612bdc266..cc48ba06db 100644
--- a/crates/hir-ty/src/lib.rs
+++ b/crates/hir-ty/src/lib.rs
@@ -110,9 +110,9 @@ pub use infer::{
infer_query_with_inspect,
};
pub use lower::{
- GenericDefaults, GenericDefaultsRef, GenericPredicates, ImplTraits, LifetimeElisionKind,
- TyDefId, TyLoweringContext, TyLoweringInferVarsCtx, TyLoweringResult, ValueTyDefId,
- diagnostics::*,
+ FieldType, GenericDefaults, GenericDefaultsRef, GenericPredicates, ImplTraits,
+ LifetimeElisionKind, LoweringMode, TyDefId, TyLoweringContext, TyLoweringInferVarsCtx,
+ TyLoweringResult, ValueTyDefId, diagnostics::*,
};
pub use next_solver::interner::{attach_db, attach_db_allow_change, with_attached_db};
pub use target_feature::TargetFeatures;
diff --git a/crates/hir-ty/src/lower.rs b/crates/hir-ty/src/lower.rs
index df83b2abb8..fae63ddc2d 100644
--- a/crates/hir-ty/src/lower.rs
+++ b/crates/hir-ty/src/lower.rs
@@ -55,7 +55,7 @@ use thin_vec::ThinVec;
use tracing::debug;
use crate::{
- ImplTraitId, Span, TyLoweringDiagnostic, TyLoweringDiagnosticKind,
+ ImplTraitId, Span, TyLoweringDiagnostic,
consteval::{create_anon_const, path_to_const},
db::{AnonConstId, GeneralConstId, HirDatabase, InternedOpaqueTyId},
generics::{Generics, SingleGenerics, generics},
@@ -64,9 +64,9 @@ use crate::{
AliasTy, Binder, BoundExistentialPredicates, Clause, ClauseKind, Clauses, Const, ConstKind,
DbInterner, DefaultAny, EarlyBinder, EarlyParamRegion, ErrorGuaranteed, FnSigKind,
FxIndexMap, GenericArg, GenericArgs, ParamConst, ParamEnv, PatList, Pattern, PolyFnSig,
- Predicate, Region, StoredClauses, StoredEarlyBinder, StoredGenericArg, StoredGenericArgs,
- StoredPolyFnSig, StoredTraitRef, StoredTy, TraitPredicate, TraitRef, Ty, Tys, Unnormalized,
- abi::Safety, util::BottomUpFolder,
+ Predicate, Region, StoredClauses, StoredConst, StoredEarlyBinder, StoredGenericArg,
+ StoredGenericArgs, StoredPolyFnSig, StoredTraitRef, StoredTy, TraitPredicate, TraitRef, Ty,
+ Tys, Unnormalized, abi::Safety, util::BottomUpFolder,
},
};
@@ -199,6 +199,33 @@ pub trait TyLoweringInferVarsCtx<'db> {
}
}
+#[derive(Debug, Clone, Copy, PartialEq, Eq)]
+pub enum LoweringMode {
+ Analysis,
+ Ide,
+}
+
+pub(crate) use self::tracked_struct_token::TrackedStructToken;
+mod tracked_struct_token {
+ use super::LoweringMode;
+
+ /// A token that is required to construct tracked structs.
+ /// This exists to prevent one from accidentally creating a tracked struct outside of a query which may happen for some codepaths.
+ pub(crate) struct TrackedStructToken {
+ // #[non_exhaustive] doesn't work for us here, we want it module focused.
+ _private: (),
+ }
+
+ impl LoweringMode {
+ pub(crate) fn allow_tracked_structs(self) -> Option<TrackedStructToken> {
+ match self {
+ LoweringMode::Analysis => Some(TrackedStructToken { _private: () }),
+ LoweringMode::Ide => None,
+ }
+ }
+ }
+}
+
pub struct TyLoweringContext<'db, 'a> {
pub db: &'db dyn HirDatabase,
pub(crate) interner: DbInterner<'db>,
@@ -211,6 +238,7 @@ pub struct TyLoweringContext<'db, 'a> {
generics: &'a OnceCell<Generics<'db>>,
in_binders: DebruijnIndex,
impl_trait_mode: ImplTraitLoweringState,
+ interning_mode: LoweringMode,
/// Tracks types with explicit `?Sized` bounds.
pub(crate) unsized_types: FxHashSet<Ty<'db>>,
pub(crate) diagnostics: ThinVec<TyLoweringDiagnostic>,
@@ -247,6 +275,7 @@ impl<'db, 'a> TyLoweringContext<'db, 'a> {
store,
in_binders,
impl_trait_mode,
+ interning_mode: LoweringMode::Analysis,
unsized_types: FxHashSet::default(),
diagnostics: ThinVec::new(),
lifetime_elision,
@@ -261,6 +290,11 @@ impl<'db, 'a> TyLoweringContext<'db, 'a> {
self.lifetime_elision = lifetime_elision;
}
+ pub(crate) fn with_interning_mode(mut self, interning_mode: LoweringMode) -> Self {
+ self.interning_mode = interning_mode;
+ self
+ }
+
pub(crate) fn with_debruijn<T>(
&mut self,
debruijn: DebruijnIndex,
@@ -302,8 +336,14 @@ impl<'db, 'a> TyLoweringContext<'db, 'a> {
self
}
- pub(crate) fn push_diagnostic(&mut self, type_ref: TypeRefId, kind: TyLoweringDiagnosticKind) {
- self.diagnostics.push(TyLoweringDiagnostic { source: type_ref, kind });
+ pub(crate) fn push_diagnostic(&mut self, diagnostic: TyLoweringDiagnostic) {
+ self.diagnostics.push(diagnostic);
+ }
+
+ fn push_infer_vars_not_allowed(&mut self, span: Span) {
+ if !span.is_dummy() {
+ self.push_diagnostic(TyLoweringDiagnostic::InferVarsNotAllowed { source: span });
+ }
}
#[track_caller]
@@ -315,7 +355,7 @@ impl<'db, 'a> TyLoweringContext<'db, 'a> {
match &mut self.infer_vars {
Some(infer_vars) => infer_vars.next_ty_var(span),
None => {
- // FIXME: Emit an error: no infer vars allowed here.
+ self.push_infer_vars_not_allowed(span);
self.types.types.error
}
}
@@ -325,7 +365,7 @@ impl<'db, 'a> TyLoweringContext<'db, 'a> {
match &mut self.infer_vars {
Some(infer_vars) => infer_vars.next_const_var(span),
None => {
- // FIXME: Emit an error: no infer vars allowed here.
+ self.push_infer_vars_not_allowed(span);
self.types.consts.error
}
}
@@ -335,7 +375,7 @@ impl<'db, 'a> TyLoweringContext<'db, 'a> {
match &mut self.infer_vars {
Some(infer_vars) => infer_vars.next_region_var(span),
None => {
- // FIXME: Emit an error: no infer vars allowed here.
+ self.push_infer_vars_not_allowed(span);
self.types.regions.error
}
}
@@ -384,6 +424,7 @@ impl<'db, 'a> TyLoweringContext<'db, 'a> {
const_type,
&|| self.generics.get_or_init(|| generics(self.db, self.generic_def)),
create_var,
+ self.interning_mode,
self.forbid_params_after,
);
@@ -634,7 +675,10 @@ impl<'db, 'a> TyLoweringContext<'db, 'a> {
data: Either::Left(PathDiagnosticCallbackData(type_ref)),
callback: |data, this, diag| {
let type_ref = data.as_ref().left().unwrap().0;
- this.push_diagnostic(type_ref, TyLoweringDiagnosticKind::PathDiagnostic(diag))
+ this.push_diagnostic(TyLoweringDiagnostic::PathDiagnostic {
+ source: type_ref,
+ diag,
+ })
},
}
}
@@ -1694,16 +1738,34 @@ fn const_param_types_with_diagnostics_cycle_result(
pub(crate) fn field_types_query(
db: &dyn HirDatabase,
variant_id: VariantId,
-) -> &ArenaMap<LocalFieldId, StoredEarlyBinder<StoredTy>> {
+) -> &ArenaMap<LocalFieldId, FieldType> {
&field_types_with_diagnostics(db, variant_id).value
}
+#[derive(Debug, Clone, PartialEq, Eq, Hash)]
+pub struct FieldType {
+ ty: StoredEarlyBinder<StoredTy>,
+ default: Option<StoredEarlyBinder<StoredConst>>,
+}
+
+impl FieldType {
+ #[inline]
+ pub fn ty<'db>(&self) -> EarlyBinder<'db, Ty<'db>> {
+ self.ty.get()
+ }
+
+ #[inline]
+ pub fn default<'db>(&self) -> Option<EarlyBinder<'db, Const<'db>>> {
+ self.default.as_ref().map(|default| default.get_with(|it| it.as_ref()))
+ }
+}
+
/// Build the type of all specific fields of a struct or enum variant.
#[salsa::tracked(returns(ref))]
pub(crate) fn field_types_with_diagnostics(
db: &dyn HirDatabase,
variant_id: VariantId,
-) -> TyLoweringResult<ArenaMap<LocalFieldId, StoredEarlyBinder<StoredTy>>> {
+) -> TyLoweringResult<ArenaMap<LocalFieldId, FieldType>> {
let var_data = variant_id.fields(db);
let fields = var_data.fields();
if fields.is_empty() {
@@ -1727,7 +1789,15 @@ pub(crate) fn field_types_with_diagnostics(
LifetimeElisionKind::AnonymousReportError,
);
for (field_id, field_data) in var_data.fields().iter() {
- res.insert(field_id, StoredEarlyBinder::bind(ctx.lower_ty(field_data.type_ref).store()));
+ let ty = ctx.lower_ty(field_data.type_ref);
+ let default = field_data.default_value.map(|default| ctx.lower_const(default, ty));
+ res.insert(
+ field_id,
+ FieldType {
+ ty: StoredEarlyBinder::bind(ty.store()),
+ default: default.map(|default| StoredEarlyBinder::bind(default.store())),
+ },
+ );
}
TyLoweringResult::from_ctx(res, ctx)
}
@@ -2628,7 +2698,7 @@ fn fn_sig_for_struct_constructor(
def: StructId,
) -> StoredEarlyBinder<StoredPolyFnSig> {
let field_tys = db.field_types(def.into());
- let params = field_tys.iter().map(|(_, ty)| ty.get().skip_binder());
+ let params = field_tys.iter().map(|(_, field)| field.ty().skip_binder());
let ret = type_for_adt(db, def.into()).skip_binder();
let inputs_and_output =
@@ -2644,7 +2714,7 @@ fn fn_sig_for_enum_variant_constructor(
def: EnumVariantId,
) -> StoredEarlyBinder<StoredPolyFnSig> {
let field_tys = db.field_types(def.into());
- let params = field_tys.iter().map(|(_, ty)| ty.get().skip_binder());
+ let params = field_tys.iter().map(|(_, field)| field.ty().skip_binder());
let parent = def.lookup(db).parent;
let ret = type_for_adt(db, parent.into()).skip_binder();
diff --git a/crates/hir-ty/src/lower/diagnostics.rs b/crates/hir-ty/src/lower/diagnostics.rs
index 2565fb46ce..35ee99cb95 100644
--- a/crates/hir-ty/src/lower/diagnostics.rs
+++ b/crates/hir-ty/src/lower/diagnostics.rs
@@ -1,17 +1,13 @@
//! This files contains the declaration of diagnostics kinds for ty and path lowering.
-use hir_def::type_ref::TypeRefId;
-use hir_def::{GenericDefId, GenericParamId};
+use hir_def::{GenericDefId, GenericParamId, type_ref::TypeRefId};
-#[derive(Debug, PartialEq, Eq, Clone)]
-pub struct TyLoweringDiagnostic {
- pub source: TypeRefId,
- pub kind: TyLoweringDiagnosticKind,
-}
+use crate::Span;
#[derive(Debug, PartialEq, Eq, Clone)]
-pub enum TyLoweringDiagnosticKind {
- PathDiagnostic(PathLoweringDiagnostic),
+pub enum TyLoweringDiagnostic {
+ PathDiagnostic { source: TypeRefId, diag: PathLoweringDiagnostic },
+ InferVarsNotAllowed { source: Span },
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
diff --git a/crates/hir-ty/src/mir.rs b/crates/hir-ty/src/mir.rs
index e82038907c..d004e3b5da 100644
--- a/crates/hir-ty/src/mir.rs
+++ b/crates/hir-ty/src/mir.rs
@@ -2,14 +2,13 @@
use std::{fmt::Display, iter};
-use base_db::Crate;
-use either::Either;
use hir_def::{
- FieldId, StaticId, TupleFieldId, UnionId, VariantId,
+ FieldId, LocalFieldId, StaticId, UnionId, VariantId,
hir::{BindingId, Expr, ExprId, Ordering, PatId},
};
use intern::{InternedSlice, InternedSliceRef, impl_slice_internable};
use la_arena::{Arena, ArenaMap, Idx, RawIdx};
+use macros::{TypeFoldable, TypeVisitable};
use rustc_ast_ir::Mutability;
use rustc_hash::FxHashMap;
use rustc_type_ir::{
@@ -17,13 +16,11 @@ use rustc_type_ir::{
inherent::{GenericArgs as _, IntoKind, Ty as _},
};
use smallvec::{SmallVec, smallvec};
-use stdx::{impl_from, never};
+use stdx::impl_from;
use crate::{
CallableDefId, InferBodyId, InferenceResult, MemoryMap,
- consteval::usize_const,
db::{HirDatabase, InternedClosureId},
- display::{DisplayTarget, HirDisplay},
infer::PointerCast,
next_solver::{
Allocation, AllocationData, DbInterner, ErrorGuaranteed, GenericArgs, ParamEnv,
@@ -52,8 +49,6 @@ pub use monomorphization::{
monomorphized_mir_body_for_closure_query, monomorphized_mir_body_query,
};
-use super::consteval::try_const_usize;
-
pub type BasicBlockId = Idx<BasicBlock>;
pub type LocalId = Idx<Local>;
@@ -61,7 +56,7 @@ fn return_slot() -> LocalId {
LocalId::from_raw(RawIdx::from(0))
}
-#[derive(Debug, Clone, PartialEq, Eq)]
+#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub struct Local {
pub ty: StoredTy,
}
@@ -150,116 +145,72 @@ impl<'db> Operand {
}
}
+/// The index of a field (whether of a struct/enum variant, tuple, or closure).
+/// For a struct/enum it converts from and to the LocalFieldId, for a tuple or closure it's simply the index.
+#[derive(Copy, Clone, PartialEq, Eq, Hash, salsa::Update, PartialOrd, Ord, Debug)]
+pub struct FieldIndex(pub u32);
+
+impl FieldIndex {
+ pub fn to_local_field_id(self) -> LocalFieldId {
+ LocalFieldId::from_raw(RawIdx::from_u32(self.0))
+ }
+}
+
+impl From<LocalFieldId> for FieldIndex {
+ fn from(value: LocalFieldId) -> Self {
+ FieldIndex(value.into_raw().into_u32())
+ }
+}
+
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub enum ProjectionElem<V: PartialEq> {
Deref,
- Field(Either<FieldId, TupleFieldId>),
- // FIXME: get rid of this, and use FieldId for tuples and closures
- ClosureField(usize),
+ /// A field (e.g., `f` in `_1.f`).
+ Field(FieldIndex),
+ /// Index into a slice/array.
Index(V),
- ConstantIndex { offset: u64, from_end: bool },
- Subslice { from: u64, to: u64 },
- //Downcast(Option<Symbol>, VariantIdx),
- OpaqueCast(std::convert::Infallible),
+ /// These indices are generated by slice patterns.
+ ConstantIndex {
+ offset: u64,
+ from_end: bool,
+ },
+ /// These indices are generated by slice patterns.
+ Subslice {
+ from: u64,
+ to: u64,
+ },
+ /// "Downcast" to a variant of an enum or a coroutine.
+ Downcast(VariantId),
}
impl<V: PartialEq> ProjectionElem<V> {
- pub fn projected_ty<'db>(
- &self,
- infcx: &InferCtxt<'db>,
- env: ParamEnv<'db>,
- mut base: Ty<'db>,
- krate: Crate,
- ) -> Ty<'db> {
- let interner = infcx.interner;
- let db = interner.db;
-
- // we only bail on mir building when there are type mismatches
- // but error types may pop up resulting in us still attempting to build the mir
- // so just propagate the error type
- if base.is_ty_error() {
- return Ty::new_error(interner, ErrorGuaranteed);
- }
-
- if matches!(base.kind(), TyKind::Alias(..)) {
- let mut ocx = ObligationCtxt::new(infcx);
- match ocx.structurally_normalize_ty(&ObligationCause::dummy(), env, base) {
- Ok(it) => base = it,
- Err(_) => return Ty::new_error(interner, ErrorGuaranteed),
+ pub fn map<V2: PartialEq>(self, v: impl FnOnce(V) -> V2) -> ProjectionElem<V2> {
+ match self {
+ ProjectionElem::Deref => ProjectionElem::Deref,
+ ProjectionElem::Field(field_index) => ProjectionElem::Field(field_index),
+ ProjectionElem::Index(idx) => ProjectionElem::Index(v(idx)),
+ ProjectionElem::ConstantIndex { offset, from_end } => {
+ ProjectionElem::ConstantIndex { offset, from_end }
}
+ ProjectionElem::Subslice { from, to } => ProjectionElem::Subslice { from, to },
+ ProjectionElem::Downcast(variant_id) => ProjectionElem::Downcast(variant_id),
}
+ }
- match self {
- ProjectionElem::Deref => match base.kind() {
- TyKind::RawPtr(inner, _) | TyKind::Ref(_, inner, _) => inner,
- TyKind::Adt(adt_def, subst) if adt_def.is_box() => subst.type_at(0),
- _ => {
- never!(
- "Overloaded deref on type {} is not a projection",
- base.display(db, DisplayTarget::from_crate(db, krate))
- );
- Ty::new_error(interner, ErrorGuaranteed)
- }
- },
- ProjectionElem::Field(Either::Left(f)) => match base.kind() {
- TyKind::Adt(_, subst) => db.field_types(f.parent)[f.local_id]
- .get()
- .instantiate(interner, subst)
- .skip_norm_wip(),
- ty => {
- never!("Only adt has field, found {:?}", ty);
- Ty::new_error(interner, ErrorGuaranteed)
- }
- },
- ProjectionElem::Field(Either::Right(f)) => match base.kind() {
- TyKind::Tuple(subst) => {
- subst.as_slice().get(f.index as usize).copied().unwrap_or_else(|| {
- never!("Out of bound tuple field");
- Ty::new_error(interner, ErrorGuaranteed)
- })
- }
- ty => {
- never!("Only tuple has tuple field: {:?}", ty);
- Ty::new_error(interner, ErrorGuaranteed)
- }
- },
- ProjectionElem::ClosureField(f) => match base.kind() {
- TyKind::Closure(_, args) => args.as_closure().tupled_upvars_ty().tuple_fields()[*f],
- _ => {
- never!("Only closure has closure field");
- Ty::new_error(interner, ErrorGuaranteed)
- }
- },
- ProjectionElem::ConstantIndex { .. } | ProjectionElem::Index(_) => match base.kind() {
- TyKind::Array(inner, _) | TyKind::Slice(inner) => inner,
- _ => {
- never!("Overloaded index is not a projection");
- Ty::new_error(interner, ErrorGuaranteed)
- }
- },
- &ProjectionElem::Subslice { from, to } => match base.kind() {
- TyKind::Array(inner, c) => {
- let next_c = usize_const(
- db,
- match try_const_usize(db, c) {
- None => None,
- Some(x) => x.checked_sub(u128::from(from + to)),
- },
- krate,
- );
- Ty::new_array_with_const_len(interner, inner, next_c)
- }
- TyKind::Slice(_) => base,
- _ => {
- never!("Subslice projection should only happen on slice and array");
- Ty::new_error(interner, ErrorGuaranteed)
- }
- },
- ProjectionElem::OpaqueCast(_) => {
- never!("We don't emit these yet");
- Ty::new_error(interner, ErrorGuaranteed)
+ pub fn try_map<V2: PartialEq>(
+ self,
+ v: impl FnOnce(V) -> Option<V2>,
+ ) -> Option<ProjectionElem<V2>> {
+ Some(match self {
+ ProjectionElem::Deref => ProjectionElem::Deref,
+ ProjectionElem::Field(field_index) => ProjectionElem::Field(field_index),
+ ProjectionElem::Index(idx) => ProjectionElem::Index(v(idx)?),
+ ProjectionElem::ConstantIndex { offset, from_end } => {
+ ProjectionElem::ConstantIndex { offset, from_end }
}
- }
+ ProjectionElem::Subslice { from, to } => ProjectionElem::Subslice { from, to },
+ ProjectionElem::Downcast(variant_id) => ProjectionElem::Downcast(variant_id),
+ })
}
}
@@ -367,6 +318,13 @@ impl<'db> PlaceRef<'db> {
pub fn store(&self) -> Place {
Place { local: self.local, projection: self.projection.store() }
}
+ pub fn ty(&self, body: &MirBody, infcx: &InferCtxt<'db>, env: ParamEnv<'db>) -> PlaceTy<'db> {
+ PlaceTy::from_ty(body.locals[self.local].ty.as_ref()).multi_projection_ty(
+ infcx,
+ env,
+ self.projection.as_slice(),
+ )
+ }
}
impl<'db> From<LocalId> for PlaceRef<'db> {
@@ -1243,3 +1201,157 @@ impl From<&ExprId> for MirSpan {
(*value).into()
}
}
+
+impl<'tcx> PlaceRef<'tcx> {
+ /// If this place represents a local variable like `_X` with no
+ /// projections, return `Some(_X)`.
+ #[inline]
+ pub fn as_local(&self) -> Option<LocalId> {
+ match *self {
+ PlaceRef { local, projection } if projection.as_slice().is_empty() => Some(local),
+ _ => None,
+ }
+ }
+}
+
+/// To determine the type of a place, we need to keep track of the variant that has been downcast to, in order to find the correct fields.
+/// This type does that.
+#[derive(Copy, Clone, Debug, TypeFoldable, TypeVisitable, Hash, PartialEq, Eq)]
+pub struct PlaceTy<'db> {
+ pub ty: Ty<'db>,
+ /// Downcast to a particular variant of an enum or a coroutine, if included.
+ #[type_foldable(identity)]
+ #[type_visitable(ignore)]
+ pub variant_id: Option<VariantId>,
+}
+
+impl<'db> PlaceTy<'db> {
+ #[inline]
+ pub fn from_ty(ty: Ty<'db>) -> PlaceTy<'db> {
+ PlaceTy { ty, variant_id: None }
+ }
+
+ pub fn multi_projection_ty(
+ self,
+ infcx: &InferCtxt<'db>,
+ env: ParamEnv<'db>,
+ elems: &[PlaceElem],
+ ) -> PlaceTy<'db> {
+ elems.iter().fold(self, |place_ty, elem| place_ty.projection_ty(infcx, elem, env))
+ }
+
+ fn field_ty(
+ infcx: &InferCtxt<'db>,
+ self_ty: Ty<'db>,
+ variant: Option<VariantId>,
+ f: FieldIndex,
+ ) -> Ty<'db> {
+ if let Some(variant_id) = variant {
+ match self_ty.kind() {
+ TyKind::Adt(adt_def, args) if adt_def.is_enum() => {
+ infcx.interner.db().field_types(variant_id)[f.to_local_field_id()]
+ .ty()
+ .instantiate(infcx.interner, args)
+ .skip_norm_wip()
+ }
+ // FIXME TyKind::Coroutine...
+ _ => panic!("can't downcast non-adt non-coroutine type: {self_ty:?}"),
+ }
+ } else {
+ match self_ty.kind() {
+ TyKind::Adt(adt_def, args) if !adt_def.is_enum() => {
+ let variant_id = VariantId::from_non_enum(adt_def.def_id()).unwrap();
+ infcx.interner.db().field_types(variant_id)[f.to_local_field_id()]
+ .ty()
+ .instantiate(infcx.interner, args)
+ .skip_norm_wip()
+ }
+ TyKind::Closure(_, args) => {
+ args.as_closure().tupled_upvars_ty().tuple_fields()[f.0 as usize]
+ }
+ // FIXME TyKind::Coroutine / TyKind::CoroutineClosure...
+ TyKind::Tuple(tys) => tys
+ .get(f.0 as usize)
+ .cloned()
+ .unwrap_or_else(|| panic!("field {f:?} out of range: {self_ty:?}")),
+ _ => panic!("can't project out of {self_ty:?}"),
+ }
+ }
+ }
+
+ /// Convenience wrapper around `projection_ty_core` for `PlaceElem`.
+ pub fn projection_ty<V: ::std::fmt::Debug + PartialEq>(
+ self,
+ infcx: &InferCtxt<'db>,
+ elem: &ProjectionElem<V>,
+ env: ParamEnv<'db>,
+ ) -> PlaceTy<'db> {
+ self.projection_ty_core(
+ infcx.interner,
+ elem,
+ |ty| {
+ if matches!(ty.kind(), TyKind::Alias(..)) {
+ let mut ocx = ObligationCtxt::new(infcx);
+ match ocx.structurally_normalize_ty(&ObligationCause::dummy(), env, ty) {
+ Ok(it) => it,
+ Err(_) => Ty::new_error(infcx.interner, ErrorGuaranteed),
+ }
+ } else {
+ ty
+ }
+ },
+ |self_ty, variant, field_id| Self::field_ty(infcx, self_ty, variant, field_id),
+ )
+ }
+
+ /// `place_ty.projection_ty_core(tcx, elem, |...| { ... })`
+ /// projects `place_ty` onto `elem`, returning the appropriate
+ /// `Ty` or downcast variant corresponding to that projection.
+ /// The `handle_field` callback must map a `FieldIndex` to its `Ty`
+ pub fn projection_ty_core<V: PartialEq + ::std::fmt::Debug>(
+ self,
+ tcx: DbInterner<'db>,
+ elem: &ProjectionElem<V>,
+ mut structurally_normalize: impl FnMut(Ty<'db>) -> Ty<'db>,
+ mut handle_field: impl FnMut(Ty<'db>, Option<VariantId>, FieldIndex /*, T*/) -> Ty<'db>,
+ ) -> PlaceTy<'db> {
+ // we only bail on mir building when there are type mismatches
+ // but error types may pop up resulting in us still attempting to build the mir
+ // so just propagate the error type
+ if self.ty.is_ty_error() {
+ return PlaceTy::from_ty(Ty::new_error(tcx, ErrorGuaranteed));
+ }
+ if self.variant_id.is_some() && !matches!(elem, ProjectionElem::Field(..)) {
+ panic!("cannot use non field projection on downcasted place")
+ }
+ match *elem {
+ ProjectionElem::Deref => {
+ let ty = structurally_normalize(self.ty).builtin_deref(true).unwrap_or_else(|| {
+ panic!("deref projection of non-dereferenceable ty {:?}", self)
+ });
+ PlaceTy::from_ty(ty)
+ }
+ ProjectionElem::Index(_) | ProjectionElem::ConstantIndex { .. } => {
+ PlaceTy::from_ty(structurally_normalize(self.ty).builtin_index().unwrap())
+ }
+ ProjectionElem::Subslice { from, to /*, from_end*/ } => {
+ PlaceTy::from_ty(match structurally_normalize(self.ty).kind() {
+ TyKind::Slice(..) => self.ty,
+ TyKind::Array(inner, _) /*if !from_end*/ => Ty::new_array_opt(tcx, inner, to.checked_sub(from).map(|x| x.into())),
+ // TyKind::Array(inner, size) if from_end => {
+ // let size = size
+ // .try_to_target_usize(tcx)
+ // .expect("expected subslice projection on fixed-size array");
+ // let len = size - from - to;
+ // Ty::new_array(tcx, *inner, len)
+ // }
+ _ => panic!("cannot subslice non-array type: `{:?}`", self),
+ })
+ }
+ ProjectionElem::Downcast(index) => PlaceTy { ty: self.ty, variant_id: Some(index) },
+ ProjectionElem::Field(f) => {
+ PlaceTy::from_ty(handle_field(structurally_normalize(self.ty), self.variant_id, f))
+ }
+ }
+ }
+}
diff --git a/crates/hir-ty/src/mir/borrowck.rs b/crates/hir-ty/src/mir/borrowck.rs
index ff963fc121..c5367f630e 100644
--- a/crates/hir-ty/src/mir/borrowck.rs
+++ b/crates/hir-ty/src/mir/borrowck.rs
@@ -16,9 +16,9 @@ use crate::{
closure_analysis::ProjectionKind as HirProjectionKind,
db::{HirDatabase, InternedClosureId},
display::DisplayTarget,
- mir::OperandKind,
+ mir::{OperandKind, PlaceTy},
next_solver::{
- DbInterner, ParamEnv, StoredTy, Ty, TypingMode,
+ DbInterner, ParamEnv, StoredTy, TypingMode,
infer::{DbInternerInferExt, InferCtxt},
},
};
@@ -197,19 +197,19 @@ fn moved_out_of_ref<'db>(
let mut result = vec![];
let mut for_operand = |op: &Operand, span: MirSpan| match &op.kind {
OperandKind::Copy(p) | OperandKind::Move(p) => {
- let mut ty: Ty<'db> = body.locals[p.local].ty.as_ref();
+ let mut ty = PlaceTy::from_ty(body.locals[p.local].ty.as_ref());
let mut is_dereference_of_ref = false;
for proj in p.projection.lookup() {
- if *proj == ProjectionElem::Deref && ty.as_reference().is_some() {
+ if *proj == ProjectionElem::Deref && ty.ty.as_reference().is_some() {
is_dereference_of_ref = true;
}
- ty = proj.projected_ty(infcx, env, ty, body.owner.module(db).krate(db));
+ ty = ty.projection_ty(infcx, proj, env);
}
if is_dereference_of_ref
- && !infcx.type_is_copy_modulo_regions(env, ty)
- && !ty.references_non_lt_error()
+ && !infcx.type_is_copy_modulo_regions(env, ty.ty)
+ && !ty.ty.references_non_lt_error()
{
- result.push(MovedOutOfRef { span: op.span.unwrap_or(span), ty: ty.store() });
+ result.push(MovedOutOfRef { span: op.span.unwrap_or(span), ty: ty.ty.store() });
}
}
OperandKind::Constant { .. } | OperandKind::Static(_) | OperandKind::Allocation { .. } => {}
@@ -292,10 +292,7 @@ fn partially_moved<'db>(
let mut result = vec![];
let mut for_operand = |op: &Operand, span: MirSpan| match &op.kind {
OperandKind::Copy(p) | OperandKind::Move(p) => {
- let mut ty: Ty<'db> = body.locals[p.local].ty.as_ref();
- for proj in p.projection.lookup() {
- ty = proj.projected_ty(infcx, env, ty, body.owner.module(db).krate(db));
- }
+ let ty = p.as_ref().ty(body, infcx, env).ty;
if !infcx.type_is_copy_modulo_regions(env, ty) && !ty.references_non_lt_error() {
result.push(PartiallyMoved { span, ty: ty.store(), local: p.local });
}
@@ -427,23 +424,21 @@ fn place_case<'db>(
body: &MirBody,
lvalue: &Place,
) -> ProjectionCase {
- let db = infcx.interner.db;
let mut is_part_of = false;
- let mut ty = body.locals[lvalue.local].ty.as_ref();
+ let mut ty = PlaceTy::from_ty(body.locals[lvalue.local].ty.as_ref());
for proj in lvalue.projection.lookup().iter() {
match proj {
- ProjectionElem::Deref if ty.as_adt().is_none() => return ProjectionCase::Indirect, // It's indirect in case of reference and raw
+ ProjectionElem::Deref if ty.ty.as_adt().is_none() => return ProjectionCase::Indirect, // It's indirect in case of reference and raw
ProjectionElem::Deref // It's direct in case of `Box<T>`
| ProjectionElem::ConstantIndex { .. }
| ProjectionElem::Subslice { .. }
| ProjectionElem::Field(_)
- | ProjectionElem::ClosureField(_)
| ProjectionElem::Index(_) => {
is_part_of = true;
}
- ProjectionElem::OpaqueCast(_) => (),
+ ProjectionElem::Downcast(_) => (),
}
- ty = proj.projected_ty(infcx, env, ty, body.owner.module(db).krate(db));
+ ty = ty.projection_ty(infcx, proj, env);
}
if is_part_of { ProjectionCase::DirectPart } else { ProjectionCase::Direct }
}
diff --git a/crates/hir-ty/src/mir/eval.rs b/crates/hir-ty/src/mir/eval.rs
index 78b70edeee..eb0e4c6020 100644
--- a/crates/hir-ty/src/mir/eval.rs
+++ b/crates/hir-ty/src/mir/eval.rs
@@ -56,8 +56,8 @@ use crate::{
use super::{
AggregateKind, BasicBlockId, BinOp, CastKind, LocalId, MirBody, MirLowerError, MirSpan,
- Operand, OperandKind, Place, PlaceElem, PlaceRef, ProjectionElem, Rvalue, StatementKind,
- TerminatorKind, UnOp, return_slot,
+ Operand, OperandKind, Place, PlaceElem, PlaceRef, PlaceTy, ProjectionElem, Rvalue,
+ StatementKind, TerminatorKind, UnOp, return_slot,
};
mod shim;
@@ -187,7 +187,7 @@ pub struct Evaluator<'a, 'db> {
stdout: Vec<u8>,
stderr: Vec<u8>,
layout_cache: RefCell<FxHashMap<Ty<'db>, Arc<Layout>>>,
- projected_ty_cache: RefCell<FxHashMap<(Ty<'db>, PlaceElem), Ty<'db>>>,
+ projected_ty_cache: RefCell<FxHashMap<(PlaceTy<'db>, PlaceElem), PlaceTy<'db>>>,
not_special_fn_cache: RefCell<FxHashSet<FunctionId>>,
mir_or_dyn_index_cache: RefCell<FxHashMap<(FunctionId, GenericArgs<'db>), MirOrDynIndex<'a>>>,
/// Constantly dropping and creating `Locals` is very costly. We store
@@ -738,13 +738,13 @@ impl<'a, 'db: 'a> Evaluator<'a, 'db> {
self.cached_ptr_size
}
- fn projected_ty(&self, ty: Ty<'db>, proj: PlaceElem) -> Ty<'db> {
+ fn projected_ty(&self, ty: PlaceTy<'db>, proj: PlaceElem) -> PlaceTy<'db> {
let pair = (ty, proj);
if let Some(r) = self.projected_ty_cache.borrow().get(&pair) {
return *r;
}
let (ty, proj) = pair;
- let r = proj.projected_ty(&self.infcx, self.param_env.param_env, ty, self.crate_id);
+ let r = ty.projection_ty(&self.infcx, &proj, self.param_env.param_env);
self.projected_ty_cache.borrow_mut().insert((ty, proj), r);
r
}
@@ -755,14 +755,14 @@ impl<'a, 'db: 'a> Evaluator<'a, 'db> {
locals: &'b Locals<'a>,
) -> Result<'db, (Address, Ty<'db>, Option<IntervalOrOwned>)> {
let mut addr = locals.ptr[p.local].addr;
- let mut ty: Ty<'db> = locals.body.locals[p.local].ty.as_ref();
+ let mut ty = PlaceTy::from_ty(locals.body.locals[p.local].ty.as_ref());
let mut metadata: Option<IntervalOrOwned> = None; // locals are always sized
for proj in p.projection.lookup() {
let prev_ty = ty;
ty = self.projected_ty(ty, *proj);
match proj {
ProjectionElem::Deref => {
- metadata = if self.size_align_of(ty, locals)?.is_none() {
+ metadata = if self.size_align_of(ty.ty, locals)?.is_none() {
Some(
Interval { addr: addr.offset(self.ptr_size()), size: self.ptr_size() }
.into(),
@@ -780,12 +780,12 @@ impl<'a, 'db: 'a> Evaluator<'a, 'db> {
);
metadata = None; // Result of index is always sized
let ty_size =
- self.size_of_sized(ty, locals, "array inner type should be sized")?;
+ self.size_of_sized(ty.ty, locals, "array inner type should be sized")?;
addr = addr.offset(ty_size * offset);
}
&ProjectionElem::ConstantIndex { from_end, offset } => {
let offset = if from_end {
- let len = match prev_ty.kind() {
+ let len = match prev_ty.ty.kind() {
TyKind::Array(_, c) => match try_const_usize(self.db, c) {
Some(it) => it as u64,
None => {
@@ -804,11 +804,11 @@ impl<'a, 'db: 'a> Evaluator<'a, 'db> {
};
metadata = None; // Result of index is always sized
let ty_size =
- self.size_of_sized(ty, locals, "array inner type should be sized")?;
+ self.size_of_sized(ty.ty, locals, "array inner type should be sized")?;
addr = addr.offset(ty_size * offset);
}
&ProjectionElem::Subslice { from, to } => {
- let inner_ty = match ty.kind() {
+ let inner_ty = match ty.ty.kind() {
TyKind::Array(inner, _) | TyKind::Slice(inner) => inner,
_ => Ty::new_error(self.interner(), ErrorGuaranteed),
};
@@ -825,25 +825,13 @@ impl<'a, 'db: 'a> Evaluator<'a, 'db> {
self.size_of_sized(inner_ty, locals, "array inner type should be sized")?;
addr = addr.offset(ty_size * (from as usize));
}
- &ProjectionElem::ClosureField(f) => {
- let layout = self.layout(prev_ty)?;
- let offset = layout.fields.offset(f).bytes_usize();
- addr = addr.offset(offset);
- metadata = None;
- }
- ProjectionElem::Field(Either::Right(f)) => {
- let layout = self.layout(prev_ty)?;
- let offset = layout.fields.offset(f.index as usize).bytes_usize();
- addr = addr.offset(offset);
- metadata = None; // tuple field is always sized FIXME: This is wrong, the tail can be unsized
- }
- ProjectionElem::Field(Either::Left(f)) => {
- let layout = self.layout(prev_ty)?;
+ ProjectionElem::Field(f) => {
+ let layout = self.layout(prev_ty.ty)?;
let variant_layout = match &layout.variants {
Variants::Single { .. } | Variants::Empty => &layout,
Variants::Multiple { variants, .. } => {
- &variants[match f.parent {
- hir_def::VariantId::EnumVariantId(it) => {
+ &variants[match prev_ty.variant_id {
+ Some(hir_def::VariantId::EnumVariantId(it)) => {
RustcEnumVariantIdx(it.index(self.db))
}
_ => {
@@ -854,20 +842,19 @@ impl<'a, 'db: 'a> Evaluator<'a, 'db> {
}]
}
};
- let offset = variant_layout
- .fields
- .offset(u32::from(f.local_id.into_raw()) as usize)
- .bytes_usize();
+ let offset = variant_layout.fields.offset(f.0 as usize).bytes_usize();
addr = addr.offset(offset);
// Unsized field metadata is equal to the metadata of the struct
- if self.size_align_of(ty, locals)?.is_some() {
+ if self.size_align_of(ty.ty, locals)?.is_some() {
metadata = None;
}
}
- ProjectionElem::OpaqueCast(_) => not_supported!("opaque cast"),
+ ProjectionElem::Downcast(_) => {
+ // no runtime effect
+ }
}
}
- Ok((addr, ty, metadata))
+ Ok((addr, ty.ty, metadata))
}
fn layout(&self, ty: Ty<'db>) -> Result<'db, Arc<Layout>> {
@@ -1713,7 +1700,7 @@ impl<'a, 'db: 'a> Evaluator<'a, 'db> {
if let Some(ty) = field_types
.iter()
.last()
- .map(|it| it.1.get().instantiate(self.interner(), subst))
+ .map(|it| it.1.ty().instantiate(self.interner(), subst))
{
return self.coerce_unsized_look_through_fields(ty.skip_norm_wip(), goal);
}
@@ -1794,11 +1781,11 @@ impl<'a, 'db: 'a> Evaluator<'a, 'db> {
not_supported!("unsizing struct without field");
};
let target_last_field = self.db.field_types(id.into())[last_field]
- .get()
+ .ty()
.instantiate(self.interner(), target_subst)
.skip_norm_wip();
let current_last_field = self.db.field_types(id.into())[last_field]
- .get()
+ .ty()
.instantiate(self.interner(), current_subst)
.skip_norm_wip();
return self.unsizing_ptr_from_addr(
@@ -2440,7 +2427,7 @@ impl<'a, 'db: 'a> Evaluator<'a, 'db> {
.offset(u32::from(f.into_raw()) as usize)
.bytes_usize();
let ty = field_types[f]
- .get()
+ .ty()
.instantiate(this.interner(), subst)
.skip_norm_wip();
let size = this.layout(ty)?.size.bytes_usize();
@@ -2469,7 +2456,7 @@ impl<'a, 'db: 'a> Evaluator<'a, 'db> {
let offset =
l.fields.offset(u32::from(f.into_raw()) as usize).bytes_usize();
let ty = field_types[f]
- .get()
+ .ty()
.instantiate(this.interner(), subst)
.skip_norm_wip();
let size = this.layout(ty)?.size.bytes_usize();
@@ -2555,9 +2542,9 @@ impl<'a, 'db: 'a> Evaluator<'a, 'db> {
}
TyKind::Adt(id, args) => match id.def_id() {
AdtId::StructId(s) => {
- for (i, (_, ty)) in self.db.field_types(s.into()).iter().enumerate() {
+ for (i, (_, field)) in self.db.field_types(s.into()).iter().enumerate() {
let offset = layout.fields.offset(i).bytes_usize();
- let ty = ty.get().instantiate(self.interner(), args).skip_norm_wip();
+ let ty = field.ty().instantiate(self.interner(), args).skip_norm_wip();
self.patch_addresses(
patch_map,
ty_of_bytes,
@@ -2576,9 +2563,9 @@ impl<'a, 'db: 'a> Evaluator<'a, 'db> {
self.read_memory(addr, layout.size.bytes_usize())?,
e,
) {
- for (i, (_, ty)) in self.db.field_types(ev.into()).iter().enumerate() {
+ for (i, (_, field)) in self.db.field_types(ev.into()).iter().enumerate() {
let offset = layout.fields.offset(i).bytes_usize();
- let ty = ty.get().instantiate(self.interner(), args).skip_norm_wip();
+ let ty = field.ty().instantiate(self.interner(), args).skip_norm_wip();
self.patch_addresses(
patch_map,
ty_of_bytes,
@@ -3093,7 +3080,7 @@ impl<'a, 'db: 'a> Evaluator<'a, 'db> {
.bytes_usize();
let addr = addr.offset(offset);
let ty = field_types[field]
- .get()
+ .ty()
.instantiate(self.interner(), subst)
.skip_norm_wip();
self.run_drop_glue_deep(ty, locals, addr, &[], span)?;
diff --git a/crates/hir-ty/src/mir/eval/shim.rs b/crates/hir-ty/src/mir/eval/shim.rs
index b4a5aa8a87..b59d6c1cfb 100644
--- a/crates/hir-ty/src/mir/eval/shim.rs
+++ b/crates/hir-ty/src/mir/eval/shim.rs
@@ -1369,7 +1369,7 @@ impl<'a, 'db: 'a> Evaluator<'a, 'db> {
.next_back()
.unwrap()
.1
- .get()
+ .ty()
.instantiate(self.interner(), subst)
.skip_norm_wip();
let sized_part_size =
diff --git a/crates/hir-ty/src/mir/eval/shim/simd.rs b/crates/hir-ty/src/mir/eval/shim/simd.rs
index 074c5a9c77..a9d0bee623 100644
--- a/crates/hir-ty/src/mir/eval/shim/simd.rs
+++ b/crates/hir-ty/src/mir/eval/shim/simd.rs
@@ -20,7 +20,7 @@ impl<'a, 'db: 'a> Evaluator<'a, 'db> {
not_supported!("simd type with no field");
};
let field_ty = self.db.field_types(id.into())[first_field]
- .get()
+ .ty()
.instantiate(self.interner(), subst)
.skip_norm_wip();
return Ok((fields.len(), field_ty));
diff --git a/crates/hir-ty/src/mir/lower.rs b/crates/hir-ty/src/mir/lower.rs
index 4e52c1f7c3..4359a1acb5 100644
--- a/crates/hir-ty/src/mir/lower.rs
+++ b/crates/hir-ty/src/mir/lower.rs
@@ -5,11 +5,11 @@ use std::{fmt::Write, iter, mem};
use base_db::Crate;
use hir_def::{
AdtId, DefWithBodyId, EnumVariantId, ExpressionStoreOwnerId, GenericParamId, HasModule,
- ItemContainerId, LocalFieldId, Lookup, TraitId, TupleId,
+ ItemContainerId, LocalFieldId, Lookup, TraitId,
expr_store::{Body, ExpressionStore, HygieneId, path::Path},
hir::{
ArithOp, Array, BinaryOp, BindingAnnotation, BindingId, ClosureKind, ExprId, ExprOrPatId,
- LabelId, Literal, MatchArm, Pat, PatId, RecordFieldPat, RecordLitField, RecordSpread,
+ LabelId, Literal, MatchArm, Pat, PatId, RecordLitField, RecordSpread,
generics::GenericParams,
},
item_tree::FieldsShape,
@@ -19,7 +19,7 @@ use hir_def::{
};
use hir_expand::name::Name;
use itertools::{EitherOrBoth, Itertools};
-use la_arena::ArenaMap;
+use la_arena::{ArenaMap, RawIdx};
use rustc_apfloat::Float;
use rustc_hash::FxHashMap;
use rustc_type_ir::inherent::{Const as _, GenericArgs as _, IntoKind, Ty as _};
@@ -43,11 +43,11 @@ use crate::{
layout::LayoutError,
method_resolution::CandidateId,
mir::{
- AggregateKind, Arena, BasicBlock, BasicBlockId, BinOp, BorrowKind, CastKind, Either, Expr,
- FieldId, GenericArgs, Idx, InferenceResult, Local, LocalId, MemoryMap, MirBody, MirSpan,
- Mutability, Operand, Place, PlaceElem, PointerCast, Projection, ProjectionElem, RawIdx,
- Rvalue, Statement, StatementKind, SwitchTargets, Terminator, TerminatorKind, TupleFieldId,
- Ty, UnOp, VariantId, return_slot,
+ AggregateKind, Arena, BasicBlock, BasicBlockId, BinOp, BorrowKind, CastKind, Expr,
+ FieldIndex, GenericArgs, Idx, InferenceResult, Local, LocalId, MemoryMap, MirBody, MirSpan,
+ Mutability, Operand, Place, PlaceElem, PointerCast, Projection, ProjectionElem, Rvalue,
+ Statement, StatementKind, SwitchTargets, Terminator, TerminatorKind, Ty, UnOp, VariantId,
+ return_slot,
},
next_solver::{
Const, DbInterner, ParamConst, ParamEnv, Region, StoredGenericArgs, StoredTy, TyKind,
@@ -919,20 +919,15 @@ impl<'a, 'db> MirLowerCtx<'a, 'db> {
let rvalue = Rvalue::Aggregate(
AggregateKind::Adt(variant_id, subst.store()),
match spread_place {
- Some(sp) => operands
+ Some(sp) if let VariantId::StructId(_) = variant_id => operands
.into_iter()
.enumerate()
.map(|(i, it)| match it {
Some(it) => it,
None => {
- let p = sp.project(ProjectionElem::Field(
- Either::Left(FieldId {
- parent: variant_id,
- local_id: LocalFieldId::from_raw(RawIdx::from(
- i as u32,
- )),
- }),
- ));
+ let p = sp.project(ProjectionElem::Field(FieldIndex(
+ i as u32,
+ )));
Operand {
kind: OperandKind::Copy(p.store()),
span: None,
@@ -940,6 +935,11 @@ impl<'a, 'db> MirLowerCtx<'a, 'db> {
}
})
.collect(),
+ Some(_) => {
+ return Err(MirLowerError::TypeError(
+ "functional record update syntax requires a struct",
+ ));
+ }
None => operands.into_iter().collect::<Option<_>>().ok_or(
MirLowerError::TypeError("missing field in record literal"),
)?,
@@ -948,16 +948,13 @@ impl<'a, 'db> MirLowerCtx<'a, 'db> {
self.push_assignment(current, place, rvalue, expr_id.into());
Ok(Some(current))
}
- VariantId::UnionId(union_id) => {
+ VariantId::UnionId(_union_id) => {
let [RecordLitField { name, expr }] = fields.as_ref() else {
not_supported!("Union record literal with more than one field");
};
let local_id =
variant_fields.field(name).ok_or(MirLowerError::UnresolvedField)?;
- let place = place.project(PlaceElem::Field(Either::Left(FieldId {
- parent: union_id.into(),
- local_id,
- })));
+ let place = place.project(PlaceElem::Field(local_id.into()));
self.lower_expr_to_place(*expr, place, current)
}
}
@@ -1397,6 +1394,7 @@ impl<'a, 'db> MirLowerCtx<'a, 'db> {
Ok(Some(current))
}
Expr::Underscore => Ok(Some(current)),
+ Expr::IncludeBytes => not_supported!("include_bytes!()"),
}
}
@@ -1410,13 +1408,13 @@ impl<'a, 'db> MirLowerCtx<'a, 'db> {
let index =
name.as_tuple_index().ok_or(MirLowerError::TypeError("named field on tuple"))?
as u32;
- *place = place.project(ProjectionElem::Field(Either::Right(TupleFieldId {
- tuple: TupleId(!0), // dummy as its unused
- index,
- })))
+ *place = place.project(ProjectionElem::Field(FieldIndex(index)))
} else {
- let field =
- self.infer.field_resolution(expr_id).ok_or(MirLowerError::UnresolvedField)?;
+ let field = self
+ .infer
+ .field_resolution(expr_id)
+ .ok_or(MirLowerError::UnresolvedField)?
+ .either(|f| f.local_id.into(), |t| FieldIndex(t.index));
*place = place.project(ProjectionElem::Field(field));
}
} else {
@@ -2086,35 +2084,18 @@ impl<'a, 'db> MirLowerCtx<'a, 'db> {
}
fn convert_closure_capture_projections(
- db: &dyn HirDatabase,
+ _db: &dyn HirDatabase,
place: &HirPlace,
) -> impl Iterator<Item = PlaceElem> {
place.projections.iter().enumerate().map(|(i, proj)| match proj.kind {
HirProjectionKind::Deref => ProjectionElem::Deref,
- HirProjectionKind::Field { field_idx, variant_idx } => {
+ HirProjectionKind::Field { field_idx, variant_idx: _ } => {
let ty = place.ty_before_projection(i);
match ty.kind() {
- TyKind::Tuple(_) => {
- ProjectionElem::Field(Either::Right(TupleFieldId {
- tuple: TupleId(!0), // Dummy as it's unused
- index: field_idx,
- }))
- }
- TyKind::Adt(adt_def, _) => {
+ TyKind::Tuple(_) => ProjectionElem::Field(FieldIndex(field_idx)),
+ TyKind::Adt(_, _) => {
let local_field_id = LocalFieldId::from_raw(RawIdx::from_u32(field_idx));
- let field = match adt_def.def_id() {
- AdtId::StructId(id) => {
- FieldId { parent: id.into(), local_id: local_field_id }
- }
- AdtId::UnionId(id) => {
- FieldId { parent: id.into(), local_id: local_field_id }
- }
- AdtId::EnumId(id) => {
- let variant = id.enum_variants(db).variants[variant_idx as usize].0;
- FieldId { parent: variant.into(), local_id: local_field_id }
- }
- };
- ProjectionElem::Field(Either::Left(field))
+ ProjectionElem::Field(local_field_id.into())
}
_ => panic!("unexpected type"),
}
@@ -2207,7 +2188,7 @@ pub fn mir_body_for_closure_query<'db>(
if is_by_ref_closure {
projections.push(ProjectionElem::Deref);
}
- projections.push(ProjectionElem::ClosureField(capture_idx));
+ projections.push(ProjectionElem::Field(FieldIndex(capture_idx as u32)));
let capture_param_place = Place {
local: closure_local,
projection: Projection::new_from_slice(&projections).store(),
@@ -2239,7 +2220,6 @@ pub fn mir_body_for_closure_query<'db>(
let current = ctx.pop_drop_scope_assert_finished(current, root.into())?;
ctx.set_terminator(current, TerminatorKind::Return, (*root).into());
}
-
let mut err = None;
ctx.result.walk_places(|mir_place| {
let mir_projections = mir_place.projection.lookup();
diff --git a/crates/hir-ty/src/mir/lower/pattern_matching.rs b/crates/hir-ty/src/mir/lower/pattern_matching.rs
index c306b6ca15..f273a823ba 100644
--- a/crates/hir-ty/src/mir/lower/pattern_matching.rs
+++ b/crates/hir-ty/src/mir/lower/pattern_matching.rs
@@ -1,17 +1,19 @@
//! MIR lowering for patterns
-use hir_def::{hir::ExprId, signatures::VariantFields};
+use hir_def::{
+ hir::{ExprId, RecordFieldPat},
+ signatures::VariantFields,
+};
use rustc_type_ir::inherent::{IntoKind, Ty as _};
use crate::{
BindingMode, ByRef,
mir::{
- LocalId, MutBorrowKind, Operand, OperandKind, PlaceRef, Projection,
+ FieldIndex, LocalId, MutBorrowKind, Operand, OperandKind, PlaceRef, Projection,
lower::{
- BasicBlockId, BinOp, BindingId, BorrowKind, Either, Expr, FieldId, Idx, MemoryMap,
- MirLowerCtx, MirLowerError, MirSpan, Pat, PatId, PlaceElem, ProjectionElem,
- RecordFieldPat, ResolveValueResult, Result, Rvalue, SwitchTargets, TerminatorKind,
- TupleFieldId, TupleId, Ty, TyKind, ValueNs, VariantId,
+ BasicBlockId, BinOp, BindingId, BorrowKind, Expr, Idx, MemoryMap, MirLowerCtx,
+ MirLowerError, MirSpan, Pat, PatId, PlaceElem, ProjectionElem, ResolveValueResult,
+ Result, Rvalue, SwitchTargets, TerminatorKind, Ty, TyKind, ValueNs, VariantId,
},
},
};
@@ -148,12 +150,7 @@ impl<'db> MirLowerCtx<'_, 'db> {
current_else,
args,
*ellipsis,
- (0..subst.len()).map(|i| {
- PlaceElem::Field(Either::Right(TupleFieldId {
- tuple: TupleId(!0), // Dummy as it is unused
- index: i as u32,
- }))
- }),
+ (0..subst.len()).map(|i| PlaceElem::Field(FieldIndex(i as u32))),
&cond_place,
mode,
)?
@@ -662,6 +659,11 @@ impl<'db> MirLowerCtx<'_, 'db> {
cond_place: &PlaceRef<'db>,
mode: MatchingMode,
) -> Result<'db, (BasicBlockId, Option<BasicBlockId>)> {
+ let downcast_place = if matches!(v, VariantId::EnumVariantId(_)) {
+ cond_place.project(ProjectionElem::Downcast(v))
+ } else {
+ *cond_place
+ };
Ok(match shape {
AdtPatternShape::Record { args } => {
let it = args
@@ -669,28 +671,26 @@ impl<'db> MirLowerCtx<'_, 'db> {
.map(|x| {
let field_id =
variant_data.field(&x.name).ok_or(MirLowerError::UnresolvedField)?;
- Ok((
- PlaceElem::Field(Either::Left(FieldId {
- parent: v,
- local_id: field_id,
- })),
- x.pat,
- ))
+ Ok((PlaceElem::Field(field_id.into()), x.pat))
})
.collect::<Result<'db, Vec<_>>>()?;
- self.pattern_match_adt(current, current_else, it.into_iter(), cond_place, mode)?
+ self.pattern_match_adt(
+ current,
+ current_else,
+ it.into_iter(),
+ &downcast_place,
+ mode,
+ )?
}
AdtPatternShape::Tuple { args, ellipsis } => {
- let fields = variant_data.fields().iter().map(|(x, _)| {
- PlaceElem::Field(Either::Left(FieldId { parent: v, local_id: x }))
- });
+ let fields = variant_data.fields().iter().map(|(x, _)| PlaceElem::Field(x.into()));
self.pattern_match_tuple_like(
current,
current_else,
args,
ellipsis,
fields,
- cond_place,
+ &downcast_place,
mode,
)?
}
diff --git a/crates/hir-ty/src/mir/pretty.rs b/crates/hir-ty/src/mir/pretty.rs
index 9054987066..3e41454424 100644
--- a/crates/hir-ty/src/mir/pretty.rs
+++ b/crates/hir-ty/src/mir/pretty.rs
@@ -5,20 +5,22 @@ use std::{
mem,
};
-use either::Either;
use hir_def::{
+ HasModule, VariantId,
expr_store::ExpressionStore,
hir::BindingId,
signatures::{ConstSignature, EnumSignature, FunctionSignature, StaticSignature},
};
use hir_expand::{Lookup, name::Name};
use la_arena::ArenaMap;
+use rustc_type_ir::inherent::IntoKind;
use crate::{
InferBodyId,
db::{HirDatabase, InternedClosureId},
display::{ClosureStyle, DisplayTarget, HirDisplay},
- mir::{PlaceElem, ProjectionElem, StatementKind, TerminatorKind},
+ mir::{PlaceElem, PlaceTy, ProjectionElem, StatementKind, TerminatorKind},
+ next_solver::{DbInterner, TyKind, infer::DbInternerInferExt},
};
use super::{
@@ -330,34 +332,57 @@ impl<'a, 'db> MirPrettyCtx<'a, 'db> {
f(this, local, head);
w!(this, ")");
}
- ProjectionElem::Field(Either::Left(field)) => {
- let variant_fields = field.parent.fields(this.db);
- let name = &variant_fields.fields()[field.local_id].name;
- match field.parent {
- hir_def::VariantId::EnumVariantId(e) => {
- w!(this, "(");
- f(this, local, head);
- let loc = e.lookup(this.db);
- w!(
- this,
- " as {}).{}",
- loc.name.display(this.db, this.display_target.edition),
- name.display(this.db, this.display_target.edition)
- );
- }
- hir_def::VariantId::StructId(_) | hir_def::VariantId::UnionId(_) => {
- f(this, local, head);
- w!(this, ".{}", name.display(this.db, this.display_target.edition));
- }
+ ProjectionElem::Downcast(variant_id) => match variant_id {
+ hir_def::VariantId::EnumVariantId(e) => {
+ w!(this, "(");
+ f(this, local, head);
+ let loc = e.lookup(this.db);
+ w!(this, " as {})", loc.name.display(this.db, this.display_target.edition),);
}
- }
- ProjectionElem::Field(Either::Right(field)) => {
- f(this, local, head);
- w!(this, ".{}", field.index);
- }
- ProjectionElem::ClosureField(it) => {
+ _ => {
+ f(this, local, head);
+ w!(this, ".{:?}", last);
+ }
+ },
+ ProjectionElem::Field(field) => {
f(this, local, head);
- w!(this, ".{}", it);
+
+ // we need to get the base type to decide how to display the field / get the field name
+ let infcx = DbInterner::new_with(this.db, this.body.owner.krate(this.db))
+ .infer_ctxt()
+ .build(rustc_type_ir::TypingMode::PostAnalysis);
+ let env = this.db.trait_environment(this.body.owner.generic_def(this.db));
+ let place_ty = PlaceTy::from_ty(this.body.locals[local].ty.as_ref())
+ .multi_projection_ty(&infcx, env, projections);
+ if let Some(variant_id) = place_ty.variant_id {
+ let variant_fields = variant_id.fields(this.db);
+ w!(
+ this,
+ ".{}",
+ variant_fields.fields()[field.to_local_field_id()]
+ .name
+ .display(this.db, this.display_target.edition)
+ );
+ } else {
+ match place_ty.ty.kind() {
+ TyKind::Adt(adt_def, _) if !adt_def.is_enum() => {
+ let variant_id =
+ VariantId::from_non_enum(adt_def.def_id()).unwrap();
+ let fields = variant_id.fields(this.db);
+ w!(
+ this,
+ ".{}",
+ fields.fields()[field.to_local_field_id()]
+ .name
+ .display(this.db, this.display_target.edition)
+ );
+ }
+ TyKind::Tuple(_) | TyKind::Closure(..) => w!(this, ".{}", field.0),
+ _ => {
+ w!(this, ".{:?}", last);
+ }
+ }
+ };
}
ProjectionElem::Index(l) => {
f(this, local, head);
diff --git a/crates/hir-ty/src/next_solver/interner.rs b/crates/hir-ty/src/next_solver/interner.rs
index 172b1a245f..b466fe0f18 100644
--- a/crates/hir-ty/src/next_solver/interner.rs
+++ b/crates/hir-ty/src/next_solver/interner.rs
@@ -589,7 +589,7 @@ impl<'db> inherent::AdtDef<DbInterner<'db>> for AdtDef {
let id: VariantId = struct_id.into();
let field_types = interner.db().field_types(id);
- field_types.iter().last().map(|f| f.1.get())
+ field_types.iter().last().map(|f| f.1.ty())
}
fn all_field_tys(
@@ -599,7 +599,7 @@ impl<'db> inherent::AdtDef<DbInterner<'db>> for AdtDef {
let db = interner.db();
// FIXME: this is disabled just to match the behavior with chalk right now
let _field_tys = |id: VariantId| {
- db.field_types(id).iter().map(|(_, ty)| ty.get().skip_binder()).collect::<Vec<_>>()
+ db.field_types(id).iter().map(|(_, ty)| ty.ty().skip_binder()).collect::<Vec<_>>()
};
let field_tys = |_id: VariantId| vec![];
let tys: Vec<_> = match self.def_id() {
@@ -1882,7 +1882,7 @@ impl<'db> Interner for DbInterner<'db> {
let field_types = self.db().field_types(variant);
let mut unsizing_params = DenseBitSet::new_empty(num_params);
- let ty = field_types[tail_field.0].get();
+ let ty = field_types[tail_field.0].ty();
for arg in ty.instantiate_identity().skip_norm_wip().walk() {
if let Some(i) = maybe_unsizing_param_idx(arg) {
unsizing_params.insert(i);
@@ -1892,7 +1892,7 @@ impl<'db> Interner for DbInterner<'db> {
// Ensure none of the other fields mention the parameters used
// in unsizing.
for field in prefix_fields {
- for arg in field_types[field.0].get().instantiate_identity().skip_norm_wip().walk() {
+ for arg in field_types[field.0].ty().instantiate_identity().skip_norm_wip().walk() {
if let Some(i) = maybe_unsizing_param_idx(arg) {
unsizing_params.remove(i);
}
diff --git a/crates/hir-ty/src/next_solver/ty.rs b/crates/hir-ty/src/next_solver/ty.rs
index c43e04b9d0..fe31d44207 100644
--- a/crates/hir-ty/src/next_solver/ty.rs
+++ b/crates/hir-ty/src/next_solver/ty.rs
@@ -196,6 +196,16 @@ impl<'db> Ty<'db> {
)
}
+ pub fn new_array_opt(interner: DbInterner<'db>, ty: Ty<'db>, n: Option<u128>) -> Ty<'db> {
+ Ty::new(
+ interner,
+ TyKind::Array(
+ ty,
+ crate::consteval::usize_const(interner.db, n, interner.expect_crate()),
+ ),
+ )
+ }
+
fn new_generic_adt(interner: DbInterner<'db>, adt_id: AdtId, ty_param: Ty<'db>) -> Ty<'db> {
let args = GenericArgs::fill_with_defaults(
interner,
diff --git a/crates/hir-ty/src/representability.rs b/crates/hir-ty/src/representability.rs
index 0ea8003e55..828af20b7b 100644
--- a/crates/hir-ty/src/representability.rs
+++ b/crates/hir-ty/src/representability.rs
@@ -47,7 +47,7 @@ pub(crate) fn representability_cycle(
fn variant_representability(db: &dyn HirDatabase, id: VariantId) -> Representability {
for ty in db.field_types(id).values() {
- rtry!(representability_ty(db, ty.get().instantiate_identity().skip_norm_wip()));
+ rtry!(representability_ty(db, ty.ty().instantiate_identity().skip_norm_wip()));
}
Representability::Representable
}
@@ -96,7 +96,7 @@ fn params_in_repr(db: &dyn HirDatabase, def_id: AdtId) -> Box<[bool]> {
for field in db.field_types(variant).values() {
params_in_repr_ty(
db,
- field.get().instantiate_identity().skip_norm_wip(),
+ field.ty().instantiate_identity().skip_norm_wip(),
&mut params_in_repr,
);
}
diff --git a/crates/hir-ty/src/test_db.rs b/crates/hir-ty/src/test_db.rs
index 653fbe34f1..3dee592dbc 100644
--- a/crates/hir-ty/src/test_db.rs
+++ b/crates/hir-ty/src/test_db.rs
@@ -112,7 +112,7 @@ impl SourceDatabase for TestDB {
}
fn file_source_root(&self, id: base_db::FileId) -> FileSourceRootInput {
- self.files.file_source_root(id)
+ self.files.file_source_root(self, id)
}
fn set_file_source_root_with_durability(
diff --git a/crates/hir-ty/src/traits.rs b/crates/hir-ty/src/traits.rs
index f6b5adfb6f..4c76ae901d 100644
--- a/crates/hir-ty/src/traits.rs
+++ b/crates/hir-ty/src/traits.rs
@@ -1,12 +1,15 @@
//! Trait solving using next trait solver.
-use std::hash::Hash;
+use std::{cell::OnceCell, hash::Hash};
use base_db::Crate;
use hir_def::{
- AdtId, AssocItemId, HasModule, ImplId, Lookup, TraitId,
+ AdtId, AssocItemId, ExpressionStoreOwnerId, GenericDefId, HasModule, ImplId, Lookup, TraitId,
+ expr_store::ExpressionStore,
+ hir::generics::WherePredicate,
lang_item::LangItems,
nameres::DefMap,
+ resolver::Resolver,
signatures::{
ConstFlags, ConstSignature, EnumFlags, EnumSignature, FnFlags, FunctionSignature,
StructFlags, StructSignature, TraitFlags, TraitSignature, TypeAliasFlags,
@@ -16,17 +19,20 @@ use hir_def::{
use hir_expand::name::Name;
use intern::sym;
use rustc_type_ir::{
- TypingMode,
+ TypeVisitableExt, TypingMode,
inherent::{BoundExistentialPredicates, IntoKind},
};
use crate::{
- Span,
+ LifetimeElisionKind, Span, TyLoweringContext,
db::HirDatabase,
+ generics::Generics,
+ lower::LoweringMode,
next_solver::{
DbInterner, GenericArgs, ParamEnv, StoredClauses, Ty, TyKind,
infer::{
DbInternerInferExt, InferCtxt,
+ select::EvaluationResult,
traits::{Obligation, ObligationCause},
},
obligation_ctxt::ObligationCtxt,
@@ -153,6 +159,90 @@ pub fn implements_trait_unique_with_infcx<'db>(
infcx.predicate_must_hold_modulo_regions(&obligation)
}
+#[derive(Debug, Clone, Copy, PartialEq, Eq)]
+pub enum WherePredicateEvaluation {
+ Holds,
+ NotProven,
+ HasErrors,
+ NoObligations,
+}
+
+/// This should not be used in `hir-ty`, only in `hir`.
+/// This is exposed to allow the IDE to evaluate arbitrary predicates.
+pub fn where_predicate_must_hold<'db>(
+ db: &'db dyn HirDatabase,
+ resolver: &Resolver<'db>,
+ store: &ExpressionStore,
+ def: ExpressionStoreOwnerId,
+ generic_def: GenericDefId,
+ env: ParamEnvAndCrate<'db>,
+ predicate: &WherePredicate,
+) -> WherePredicateEvaluation {
+ let interner = DbInterner::new_with(db, env.krate);
+ let infcx = interner.infer_ctxt().build(TypingMode::PostAnalysis);
+ let generics = OnceCell::<Generics<'db>>::new();
+ let mut ctx = TyLoweringContext::new(
+ db,
+ resolver,
+ store,
+ def,
+ generic_def,
+ &generics,
+ LifetimeElisionKind::Infer,
+ )
+ .with_interning_mode(LoweringMode::Ide);
+ let clauses =
+ ctx.lower_where_predicate(predicate, false).map(|(clause, _)| clause).collect::<Vec<_>>();
+
+ if !ctx.diagnostics.is_empty()
+ || clauses.iter().any(|clause| clause.as_predicate().references_error())
+ {
+ return WherePredicateEvaluation::HasErrors;
+ }
+
+ if clauses.is_empty() {
+ return if ctx.unsized_types.is_empty() {
+ WherePredicateEvaluation::HasErrors
+ } else {
+ WherePredicateEvaluation::NoObligations
+ };
+ }
+
+ let result = infcx.probe(|snapshot| {
+ let mut ocx = ObligationCtxt::new(&infcx);
+ for clause in clauses {
+ let obligation = Obligation::new(
+ interner,
+ ObligationCause::dummy(),
+ env.param_env,
+ clause.as_predicate(),
+ );
+ ocx.register_obligation(obligation);
+ }
+
+ let mut result = EvaluationResult::EvaluatedToOk;
+ for error in ocx.evaluate_obligations_error_on_ambiguity() {
+ if error.is_true_error() {
+ return EvaluationResult::EvaluatedToErr;
+ }
+ result = result.max(EvaluationResult::EvaluatedToAmbig);
+ }
+ if infcx.opaque_types_added_in_snapshot(snapshot) {
+ result.max(EvaluationResult::EvaluatedToOkModuloOpaqueTypes)
+ } else if infcx.region_constraints_added_in_snapshot(snapshot) {
+ result.max(EvaluationResult::EvaluatedToOkModuloRegions)
+ } else {
+ result
+ }
+ });
+
+ if result.must_apply_modulo_regions() {
+ WherePredicateEvaluation::Holds
+ } else {
+ WherePredicateEvaluation::NotProven
+ }
+}
+
pub fn is_inherent_impl_coherent(db: &dyn HirDatabase, def_map: &DefMap, impl_id: ImplId) -> bool {
let self_ty = db.impl_self_ty(impl_id).instantiate_identity().skip_norm_wip();
let self_ty = self_ty.kind();
diff --git a/crates/hir-ty/src/variance.rs b/crates/hir-ty/src/variance.rs
index 49dacc16eb..0a95416e42 100644
--- a/crates/hir-ty/src/variance.rs
+++ b/crates/hir-ty/src/variance.rs
@@ -126,7 +126,7 @@ impl<'db> Context<'db> {
let mut add_constraints_from_variant = |variant| {
for (_, field) in db.field_types(variant).iter() {
self.add_constraints_from_ty(
- field.get().instantiate_identity().skip_norm_wip(),
+ field.ty().instantiate_identity().skip_norm_wip(),
Variance::Covariant,
);
}
diff --git a/crates/hir/src/diagnostics.rs b/crates/hir/src/diagnostics.rs
index f3188c9aad..ed073cb437 100644
--- a/crates/hir/src/diagnostics.rs
+++ b/crates/hir/src/diagnostics.rs
@@ -11,12 +11,13 @@ use hir_def::{
ExprOrPatPtr, ExpressionStoreSourceMap, hir_assoc_type_binding_to_ast,
hir_generic_arg_to_ast, hir_segment_to_ast_segment,
},
- hir::ExprOrPatId,
+ hir::{ExprId, ExprOrPatId, PatId},
+ type_ref::TypeRefId,
};
use hir_expand::{HirFileId, InFile, mod_path::ModPath, name::Name};
use hir_ty::{
CastError, ExplicitDropMethodUseKind, InferenceDiagnostic, InferenceTyDiagnosticSource,
- PathGenericsSource, PathLoweringDiagnostic, TyLoweringDiagnostic, TyLoweringDiagnosticKind,
+ PathGenericsSource, PathLoweringDiagnostic, TyLoweringDiagnostic,
db::HirDatabase,
diagnostics::{BodyValidationDiagnostic, UnsafetyReason},
display::{DisplayTarget, HirDisplay},
@@ -118,6 +119,7 @@ diagnostics![AnyDiagnostic<'db> ->
IncorrectCase,
IncorrectGenericsLen,
IncorrectGenericsOrder,
+ InferVarsNotAllowed,
InvalidCast<'db>,
InvalidDeriveTarget,
InvalidLhsOfAssignment,
@@ -565,6 +567,11 @@ pub struct BadRtn {
}
#[derive(Debug)]
+pub struct InferVarsNotAllowed {
+ pub node: InFile<SyntaxNodePtr>,
+}
+
+#[derive(Debug)]
pub struct IncorrectGenericsLen {
/// Points at the name if there are no generics.
pub generics_or_segment: InFile<AstPtr<Either<ast::GenericArgList, ast::NameRef>>>,
@@ -799,41 +806,14 @@ impl<'db> AnyDiagnostic<'db> {
sig_map: &hir_def::expr_store::ExpressionStoreSourceMap,
type_owner: TypeOwnerId,
) -> Option<AnyDiagnostic<'db>> {
- let expr_syntax = |expr| {
- source_map
- .expr_syntax(expr)
- .inspect_err(|_| stdx::never!("inference diagnostic in desugared expr"))
- .ok()
- };
- let pat_syntax = |pat| {
- source_map
- .pat_syntax(pat)
- .inspect_err(|_| stdx::never!("inference diagnostic in desugared pattern"))
- .ok()
- };
- let type_syntax = |pat| {
- source_map
- .type_syntax(pat)
- .inspect_err(|_| stdx::never!("inference diagnostic in desugared type"))
- .ok()
- };
+ let expr_syntax = |expr| Self::expr_syntax(expr, source_map);
+ let pat_syntax = |pat| Self::pat_syntax(pat, source_map);
let expr_or_pat_syntax = |id| match id {
ExprOrPatId::ExprId(expr) => expr_syntax(expr),
ExprOrPatId::PatId(pat) => pat_syntax(pat),
};
let new_ty = |ty| Type { owner: type_owner, ty: EarlyBinder::bind(ty) };
- let span_syntax = |span| match span {
- hir_ty::Span::ExprId(idx) => expr_syntax(idx).map(|it| it.upcast()),
- hir_ty::Span::PatId(idx) => pat_syntax(idx).map(|it| it.upcast()),
- hir_ty::Span::TypeRefId(idx) => type_syntax(idx).map(|it| it.upcast()),
- hir_ty::Span::BindingId(idx) => {
- pat_syntax(source_map.patterns_for_binding(idx)[0]).map(|it| it.upcast())
- }
- hir_ty::Span::Dummy => {
- never!("should never create a diagnostic for dummy spans");
- None
- }
- };
+ let span_syntax = |span| Self::span_syntax(span, source_map);
Some(match d {
&InferenceDiagnostic::NoSuchField { field: expr, private, variant } => {
let expr_or_pat = match expr {
@@ -1238,21 +1218,73 @@ impl<'db> AnyDiagnostic<'db> {
})
}
+ fn expr_syntax(
+ expr: ExprId,
+ source_map: &ExpressionStoreSourceMap,
+ ) -> Option<InFile<ExprOrPatPtr>> {
+ source_map
+ .expr_syntax(expr)
+ .inspect_err(|_| stdx::never!("inference diagnostic in desugared expr"))
+ .ok()
+ }
+
+ fn pat_syntax(
+ pat: PatId,
+ source_map: &ExpressionStoreSourceMap,
+ ) -> Option<InFile<ExprOrPatPtr>> {
+ source_map
+ .pat_syntax(pat)
+ .inspect_err(|_| stdx::never!("inference diagnostic in desugared pattern"))
+ .ok()
+ }
+
+ fn type_syntax(
+ type_ref: TypeRefId,
+ source_map: &ExpressionStoreSourceMap,
+ ) -> Option<InFile<AstPtr<ast::Type>>> {
+ source_map
+ .type_syntax(type_ref)
+ .inspect_err(|_| stdx::never!("inference diagnostic in desugared type"))
+ .ok()
+ }
+
+ fn span_syntax(
+ span: hir_ty::Span,
+ source_map: &ExpressionStoreSourceMap,
+ ) -> Option<InFile<AstPtr<SpanAst>>> {
+ Some(match span {
+ hir_ty::Span::ExprId(idx) => Self::expr_syntax(idx, source_map)?.map(|it| it.upcast()),
+ hir_ty::Span::PatId(idx) => Self::pat_syntax(idx, source_map)?.map(|it| it.upcast()),
+ hir_ty::Span::TypeRefId(idx) => {
+ Self::type_syntax(idx, source_map)?.map(|it| it.upcast())
+ }
+ hir_ty::Span::BindingId(idx) => {
+ let &pat = source_map.patterns_for_binding(idx).first()?;
+ Self::pat_syntax(pat, source_map)?.map(|it| it.upcast())
+ }
+ hir_ty::Span::Dummy => {
+ never!("should never create a diagnostic for dummy spans");
+ return None;
+ }
+ })
+ }
+
pub(crate) fn ty_diagnostic(
diag: &TyLoweringDiagnostic,
source_map: &ExpressionStoreSourceMap,
db: &'db dyn HirDatabase,
) -> Option<AnyDiagnostic<'db>> {
- let Ok(source) = source_map.type_syntax(diag.source) else {
- stdx::never!("error on synthetic type syntax");
- return None;
- };
- let syntax = || source.value.to_node(&db.parse_or_expand(source.file_id));
- Some(match &diag.kind {
- TyLoweringDiagnosticKind::PathDiagnostic(diag) => {
- let ast::Type::PathType(syntax) = syntax() else { return None };
+ Some(match diag {
+ TyLoweringDiagnostic::PathDiagnostic { source, diag } => {
+ let source = Self::type_syntax(*source, source_map)?;
+ let syntax = source.value.to_node(&db.parse_or_expand(source.file_id));
+ let ast::Type::PathType(syntax) = syntax else { return None };
Self::path_diagnostic(diag, source.with_value(syntax.path()?))?
}
+ TyLoweringDiagnostic::InferVarsNotAllowed { source } => {
+ let source = Self::span_syntax(*source, source_map)?;
+ InferVarsNotAllowed { node: source.map(Into::into) }.into()
+ }
})
}
}
diff --git a/crates/hir/src/lib.rs b/crates/hir/src/lib.rs
index d187763151..f676a700cc 100644
--- a/crates/hir/src/lib.rs
+++ b/crates/hir/src/lib.rs
@@ -117,6 +117,38 @@ use triomphe::Arc;
use crate::db::{DefDatabase, HirDatabase};
+#[derive(Debug, Clone, Copy, PartialEq, Eq)]
+pub enum PredicateEvaluationStatus {
+ Holds,
+ NotProven,
+ Invalid,
+ Unsupported,
+}
+
+#[derive(Debug, Clone, PartialEq, Eq)]
+pub struct PredicateEvaluationResult {
+ pub status: PredicateEvaluationStatus,
+ pub message: String,
+}
+
+impl PredicateEvaluationResult {
+ pub fn holds(message: impl Into<String>) -> Self {
+ Self { status: PredicateEvaluationStatus::Holds, message: message.into() }
+ }
+
+ pub fn not_proven(message: impl Into<String>) -> Self {
+ Self { status: PredicateEvaluationStatus::NotProven, message: message.into() }
+ }
+
+ pub fn invalid(message: impl Into<String>) -> Self {
+ Self { status: PredicateEvaluationStatus::Invalid, message: message.into() }
+ }
+
+ pub fn unsupported(message: impl Into<String>) -> Self {
+ Self { status: PredicateEvaluationStatus::Unsupported, message: message.into() }
+ }
+}
+
pub use crate::{
attrs::{AttrsWithOwner, HasAttrs, resolve_doc_path_on},
diagnostics::*,
@@ -164,7 +196,7 @@ pub use {
},
inert_attr_macro::AttributeTemplate,
mod_path::{ModPath, PathKind, tool_path},
- name::Name,
+ name::{self, Name},
prettify_macro_expansion,
proc_macro::{ProcMacros, ProcMacrosBuilder},
tt,
@@ -1406,7 +1438,7 @@ impl Field {
/// context of the field definition.
pub fn ty<'db>(&self, db: &'db dyn HirDatabase) -> Type<'db> {
let var_id = self.parent.into();
- let ty = db.field_types(var_id)[self.id].get().instantiate_identity().skip_norm_wip();
+ let ty = db.field_types(var_id)[self.id].ty().instantiate_identity().skip_norm_wip();
Type::new(var_id.adt_id(db).into(), ty)
}
@@ -2283,6 +2315,14 @@ impl fmt::Debug for Function {
}
impl Function {
+ pub fn lang(db: &dyn HirDatabase, krate: Crate, lang_item: LangItem) -> Option<Function> {
+ let lang_items = hir_def::lang_item::lang_items(db, krate.id);
+ match lang_item.from_lang_items(lang_items)? {
+ LangItemTarget::FunctionId(it) => Some(it.into()),
+ _ => None,
+ }
+ }
+
pub fn module(self, db: &dyn HirDatabase) -> Module {
match self.id {
AnyFunctionId::FunctionId(id) => id.module(db).into(),
@@ -5549,7 +5589,7 @@ impl<'db> Type<'db> {
.iter()
.map(|(idx, _)| {
field_types[idx]
- .get()
+ .ty()
.instantiate(self.interner, args)
.skip_norm_wip()
})
@@ -5970,9 +6010,9 @@ impl<'db> Type<'db> {
db.field_types(variant_id)
.iter()
- .map(|(local_id, ty)| {
+ .map(|(local_id, field)| {
let def = Field { parent: variant_id.into(), id: local_id };
- let ty = ty.get().instantiate(interner, substs).skip_norm_wip();
+ let ty = field.ty().instantiate(interner, substs).skip_norm_wip();
(def, self.derived(ty))
})
.collect()
@@ -7446,7 +7486,7 @@ pub fn struct_tail_raw<'db>(
let last_field = db.field_types(def_id.into()).iter().next_back();
match last_field {
Some((_, field)) => {
- ty = normalize(field.get().instantiate(interner, args).skip_norm_wip())
+ ty = normalize(field.ty().instantiate(interner, args).skip_norm_wip())
}
None => break,
}
diff --git a/crates/hir/src/semantics.rs b/crates/hir/src/semantics.rs
index f633bb063f..dd4cc7b0df 100644
--- a/crates/hir/src/semantics.rs
+++ b/crates/hir/src/semantics.rs
@@ -32,7 +32,7 @@ use hir_expand::{
name::AsName,
};
use hir_ty::{
- InferBodyId, InferenceResult,
+ InferBodyId, InferenceResult, LoweringMode,
db::AnonConstId,
diagnostics::unsafe_operations,
infer_query_with_inspect,
@@ -2564,6 +2564,20 @@ impl<'db> SemanticsImpl<'db> {
Some(locals)
}
+ pub fn evaluate_where_clause_at(
+ &self,
+ node: &SyntaxNode,
+ offset: TextSize,
+ where_clause: ast::WhereClause,
+ ) -> crate::PredicateEvaluationResult {
+ let Some(analyzer) = self.analyze_with_offset_no_infer(node, offset) else {
+ return crate::PredicateEvaluationResult::unsupported(
+ "predicate evaluation is only supported in files that belong to a crate",
+ );
+ };
+ analyzer.evaluate_where_clause(self.db, where_clause)
+ }
+
pub fn get_failed_obligations(&self, token: SyntaxToken) -> Option<String> {
let node = token.parent()?;
let node = self.find_file(&node);
@@ -2587,6 +2601,7 @@ impl<'db> SemanticsImpl<'db> {
RESULT.with(|ctx| ctx.borrow_mut().push(data));
}
}),
+ LoweringMode::Ide,
);
let data: Vec<ProofTreeData> =
RESULT.with(|data| data.borrow_mut().drain(..).collect());
diff --git a/crates/hir/src/source_analyzer.rs b/crates/hir/src/source_analyzer.rs
index 1f9520d780..687f130af4 100644
--- a/crates/hir/src/source_analyzer.rs
+++ b/crates/hir/src/source_analyzer.rs
@@ -13,10 +13,10 @@ use std::{
use either::Either;
use hir_def::{
AdtId, AssocItemId, CallableDefId, ConstId, DefWithBodyId, ExpressionStoreOwnerId, FieldId,
- FunctionId, GenericDefId, LocalFieldId, ModuleDefId, StructId, VariantId,
+ FunctionId, GenericDefId, HasModule, LocalFieldId, ModuleDefId, StructId, VariantId,
expr_store::{
Body, BodySourceMap, ExpressionStore, ExpressionStoreSourceMap, HygieneId,
- lower::ExprCollector,
+ lower::{ExprCollector, lower_generic_params},
path::Path,
scope::{ExprScopes, ScopeId},
},
@@ -44,7 +44,7 @@ use hir_ty::{
AliasTy, DbInterner, DefaultAny, EarlyBinder, ErrorGuaranteed, GenericArgs, ParamEnv,
Region, Ty, TyKind, TypingMode, infer::DbInternerInferExt,
},
- traits::structurally_normalize_ty,
+ traits::{WherePredicateEvaluation, structurally_normalize_ty, where_predicate_must_hold},
};
use intern::sym;
use itertools::Itertools;
@@ -63,7 +63,8 @@ use syntax::{
use crate::{
Adt, AnyFunctionId, AssocItem, BindingMode, BuiltinAttr, BuiltinType, Callable, Const,
DeriveHelper, EnumVariant, Field, Function, GenericSubstitution, Local, Macro, ModuleDef,
- SemanticsImpl, Static, Struct, ToolModule, Trait, TupleField, Type, TypeAlias, TypeOwnerId,
+ PredicateEvaluationResult, SemanticsImpl, Static, Struct, ToolModule, Trait, TupleField, Type,
+ TypeAlias, TypeOwnerId,
db::HirDatabase,
semantics::{PathResolution, PathResolutionPerNs},
};
@@ -364,6 +365,52 @@ impl<'db> SourceAnalyzer<'db> {
))
}
+ pub(crate) fn evaluate_where_clause(
+ &self,
+ db: &'db dyn HirDatabase,
+ where_clause: ast::WhereClause,
+ ) -> PredicateEvaluationResult {
+ let Some(owner) = self.owner() else {
+ // FIXME
+ return PredicateEvaluationResult::unsupported(
+ "predicate evaluation is only supported inside an item",
+ );
+ };
+ let generic_def = owner.generic_def(db);
+ let module = generic_def.module(db);
+ let (store, params, _) =
+ lower_generic_params(db, module, generic_def, self.file_id, None, Some(where_clause));
+ let predicates = params.where_predicates();
+ if predicates.is_empty() {
+ return PredicateEvaluationResult::holds("predicate does not impose any obligations");
+ }
+
+ let env = self.trait_environment(db);
+ for predicate in predicates {
+ match where_predicate_must_hold(
+ db,
+ &self.resolver,
+ &store,
+ owner,
+ generic_def,
+ env,
+ predicate,
+ ) {
+ WherePredicateEvaluation::Holds | WherePredicateEvaluation::NoObligations => {}
+ WherePredicateEvaluation::HasErrors => {
+ return PredicateEvaluationResult::invalid(
+ "predicate contains unresolved names or invalid type syntax",
+ );
+ }
+ WherePredicateEvaluation::NotProven => {
+ return PredicateEvaluationResult::not_proven("predicate is not known to hold");
+ }
+ }
+ }
+
+ PredicateEvaluationResult::holds("predicate holds")
+ }
+
pub(crate) fn expr_id(&self, expr: ast::Expr) -> Option<ExprOrPatId> {
let src = InFile { file_id: self.file_id, value: expr };
self.store_sm()?.node_expr(src.as_ref())
@@ -927,7 +974,7 @@ impl<'db> SourceAnalyzer<'db> {
let variant_data = variant.fields(db);
let field = FieldId { parent: variant, local_id: variant_data.field(&local_name)? };
let field_ty = (*db.field_types(variant).get(field.local_id)?)
- .get()
+ .ty()
.instantiate(interner, subst)
.skip_norm_wip();
Some((
@@ -952,7 +999,7 @@ impl<'db> SourceAnalyzer<'db> {
let field = FieldId { parent: variant, local_id: variant_data.field(&field_name)? };
let (adt, subst) = self.infer()?.pat_ty(pat_id.as_pat()?).as_adt()?;
let field_ty = (*db.field_types(variant).get(field.local_id)?)
- .get()
+ .ty()
.instantiate(interner, subst)
.skip_norm_wip();
Some((
@@ -975,9 +1022,9 @@ impl<'db> SourceAnalyzer<'db> {
Some(
db.field_types(variant_id)
.iter()
- .map(|(local_id, ty)| {
+ .map(|(local_id, field)| {
let def = Field { parent: variant_id.into(), id: local_id };
- let ty = ty.get().instantiate(interner, substs).skip_norm_wip();
+ let ty = field.ty().instantiate(interner, substs).skip_norm_wip();
(def, self.ty(ty))
})
.collect(),
@@ -1051,7 +1098,7 @@ impl<'db> SourceAnalyzer<'db> {
let field = fields.field(&field_name.as_name())?;
let field_types = db.field_types(variant);
*container = Either::Right(
- field_types[field].get().instantiate(interner, subst).skip_norm_wip(),
+ field_types[field].ty().instantiate(interner, subst).skip_norm_wip(),
);
let generic_def = match variant {
VariantId::EnumVariantId(it) => it.loc(db).parent.into(),
@@ -1530,7 +1577,7 @@ impl<'db> SourceAnalyzer<'db> {
.into_iter()
.map(|local_id| {
let field = FieldId { parent: variant, local_id };
- let ty = field_types[local_id].get().instantiate(interner, substs).skip_norm_wip();
+ let ty = field_types[local_id].ty().instantiate(interner, substs).skip_norm_wip();
(field.into(), self.ty(ty))
})
.collect()
diff --git a/crates/ide-assists/src/handlers/add_missing_impl_members.rs b/crates/ide-assists/src/handlers/add_missing_impl_members.rs
index efbe3817e1..1e8fb51a3e 100644
--- a/crates/ide-assists/src/handlers/add_missing_impl_members.rs
+++ b/crates/ide-assists/src/handlers/add_missing_impl_members.rs
@@ -2641,4 +2641,67 @@ impl Trait for Struct {
"#,
);
}
+
+ #[test]
+ fn drop_pin_drop() {
+ check_assist_not_applicable(
+ add_missing_impl_members,
+ r#"
+//- minicore: drop, pin
+struct Foo;
+impl Drop for Foo {$0
+ fn drop(&mut self) {}
+}
+ "#,
+ );
+ check_assist_not_applicable(
+ add_missing_impl_members,
+ r#"
+//- minicore: drop, pin
+struct Foo;
+impl Drop for Foo {$0
+ fn pin_drop(self: core::pin::Pin<&mut Self>) {}
+}
+ "#,
+ );
+
+ check_assist_not_applicable(
+ add_missing_default_members,
+ r#"
+//- minicore: drop, pin
+struct Foo;
+impl Drop for Foo {$0
+ fn drop(&mut self) {}
+}
+ "#,
+ );
+ check_assist_not_applicable(
+ add_missing_default_members,
+ r#"
+//- minicore: drop, pin
+struct Foo;
+impl Drop for Foo {$0
+ fn pin_drop(self: core::pin::Pin<&mut Self>) {}
+}
+ "#,
+ );
+
+ check_assist(
+ add_missing_impl_members,
+ r#"
+//- minicore: drop, pin
+struct Foo;
+impl Drop for Foo {$0
+}
+ "#,
+ r#"
+struct Foo;
+impl Drop for Foo {
+ fn drop(&mut self) {
+ ${0:todo!()}
+ }
+}
+ "#,
+ );
+ }
}
diff --git a/crates/ide-assists/src/handlers/extract_function.rs b/crates/ide-assists/src/handlers/extract_function.rs
index 67bb7fc03e..f8572dcd3a 100644
--- a/crates/ide-assists/src/handlers/extract_function.rs
+++ b/crates/ide-assists/src/handlers/extract_function.rs
@@ -1197,7 +1197,7 @@ fn reference_is_exclusive(reference: &FileReference, ctx: &AssistContext<'_, '_>
expr_require_exclusive_access(ctx, &path).unwrap_or(false)
}
-/// checks if this expr requires `&mut` access, recurses on field access
+/// checks if this expr requires `&mut` access, recurses on field/index access
fn expr_require_exclusive_access(ctx: &AssistContext<'_, '_>, expr: &ast::Expr) -> Option<bool> {
let parent = expr.syntax().parent()?;
@@ -1220,10 +1220,17 @@ fn expr_require_exclusive_access(ctx: &AssistContext<'_, '_>, expr: &ast::Expr)
return Some(matches!(access, hir::Access::Exclusive));
}
- if let Some(field) = ast::FieldExpr::cast(parent) {
+ if let Some(field) = ast::FieldExpr::cast(parent.clone()) {
return expr_require_exclusive_access(ctx, &field.into());
}
+ // `container[i].mut_method()` needs `&mut container` but WRITE is not set (no direct assignment).
+ if let Some(index_expr) = ast::IndexExpr::cast(parent)
+ && index_expr.base().is_some_and(|base| base.syntax() == expr.syntax())
+ {
+ return expr_require_exclusive_access(ctx, &index_expr.into());
+ }
+
Some(false)
}
@@ -3251,6 +3258,54 @@ fn $0fun_name(arr: &mut [i32; 1]) {
}
#[test]
+ fn mut_index_element_method_call() {
+ check_assist(
+ extract_function,
+ r#"
+//- minicore: index
+use core::ops::{Index, IndexMut};
+struct Container([S; 2]);
+struct S;
+impl S { fn mutate(&mut self) {} }
+impl Index<usize> for Container {
+ type Output = S;
+ fn index(&self, i: usize) -> &S { &self.0[i] }
+}
+impl IndexMut<usize> for Container {
+ fn index_mut(&mut self, i: usize) -> &mut S { &mut self.0[i] }
+}
+fn foo() {
+ let mut c = Container([S, S]);
+ $0c[0].mutate();$0
+ let _ = c;
+}
+"#,
+ r#"
+use core::ops::{Index, IndexMut};
+struct Container([S; 2]);
+struct S;
+impl S { fn mutate(&mut self) {} }
+impl Index<usize> for Container {
+ type Output = S;
+ fn index(&self, i: usize) -> &S { &self.0[i] }
+}
+impl IndexMut<usize> for Container {
+ fn index_mut(&mut self, i: usize) -> &mut S { &mut self.0[i] }
+}
+fn foo() {
+ let mut c = Container([S, S]);
+ fun_name(&mut c);
+ let _ = c;
+}
+
+fn $0fun_name(c: &mut Container) {
+ c[0].mutate();
+}
+"#,
+ );
+ }
+
+ #[test]
fn mut_field_from_outer_scope() {
check_assist(
extract_function,
diff --git a/crates/ide-assists/src/handlers/generate_trait_from_impl.rs b/crates/ide-assists/src/handlers/generate_trait_from_impl.rs
index 2493ba6632..12afd9ae6a 100644
--- a/crates/ide-assists/src/handlers/generate_trait_from_impl.rs
+++ b/crates/ide-assists/src/handlers/generate_trait_from_impl.rs
@@ -1,5 +1,5 @@
use crate::assist_context::{AssistContext, Assists};
-use ide_db::assists::AssistId;
+use ide_db::{assists::AssistId, defs::Definition, search::SearchScope};
use syntax::{
AstNode, AstToken, SyntaxKind, T,
ast::{
@@ -114,10 +114,11 @@ pub(crate) fn generate_trait_from_impl(
let editor = builder.make_editor(impl_ast.syntax());
let make = editor.make();
+ let params = used_params(&impl_ast, make, ctx);
let trait_ast = make.trait_(
false,
&trait_name(&impl_assoc_items, make).text(),
- impl_ast.generic_param_list(),
+ params.clone(),
impl_ast.where_clause(),
trait_items,
);
@@ -133,7 +134,7 @@ pub(crate) fn generate_trait_from_impl(
make.whitespace(" ").into(),
];
- if let Some(params) = impl_ast.generic_param_list() {
+ if let Some(params) = params {
let gen_args = &params.to_generic_args(make);
elements.insert(1, gen_args.syntax().clone().into());
}
@@ -167,6 +168,35 @@ pub(crate) fn generate_trait_from_impl(
Some(())
}
+fn used_params(
+ impl_ast: &ast::Impl,
+ make: &SyntaxFactory,
+ ctx: &AssistContext<'_, '_>,
+) -> Option<ast::GenericParamList> {
+ let impl_only_ranges = impl_ast
+ .assoc_item_list()
+ .into_iter()
+ .flat_map(|list| list.assoc_items())
+ .filter_map(|item| match item {
+ ast::AssocItem::Fn(f) => Some(f.body()?.syntax().text_range()),
+ _ => None,
+ })
+ .chain(impl_ast.self_ty().map(|it| it.syntax().text_range()))
+ .collect::<Vec<_>>();
+ let used_in_impl = |param: &ast::GenericParam| {
+ let Some(def) = ctx.sema.to_def(param) else { return true };
+ Definition::GenericParam(def)
+ .usages(&ctx.sema)
+ .in_scope(&SearchScope::single_file(ctx.file_id()))
+ .all()
+ .file_ranges()
+ .any(|it| !impl_only_ranges.iter().any(|range| range.contains_range(it.range)))
+ };
+ let params = impl_ast.generic_param_list()?;
+ let mut params = params.generic_params().filter(used_in_impl).peekable();
+ params.peek().is_some().then(|| make.generic_param_list(params))
+}
+
fn trait_name(items: &ast::AssocItemList, make: &SyntaxFactory) -> ast::Name {
let mut fn_names = items
.assoc_items()
@@ -392,6 +422,87 @@ impl<const N: usize> NewTrait<N> for Foo<N> {
}
#[test]
+ fn test_impl_with_generics_only_used_in_trait() {
+ check_assist_no_snippet_cap(
+ generate_trait_from_impl,
+ r#"
+struct Foo<T, const N: usize>([T; N]);
+
+impl<T, const N: usize> F$0oo<T, N> {
+ fn spec_len(&self) -> usize {
+ N
+ }
+}
+ "#,
+ r#"
+struct Foo<T, const N: usize>([T; N]);
+
+trait SpecLen {
+ fn spec_len(&self) -> usize;
+}
+
+impl<T, const N: usize> SpecLen for Foo<T, N> {
+ fn spec_len(&self) -> usize {
+ N
+ }
+}
+ "#,
+ );
+
+ check_assist_no_snippet_cap(
+ generate_trait_from_impl,
+ r#"
+struct Foo<T, const N: usize>([T; N]);
+
+impl<T, const N: usize> F$0oo<T, N> {
+ fn spec_len(&self, other: [T; N]) -> usize {
+ 0
+ }
+}
+ "#,
+ r#"
+struct Foo<T, const N: usize>([T; N]);
+
+trait SpecLen<T, const N: usize> {
+ fn spec_len(&self, other: [T; N]) -> usize;
+}
+
+impl<T, const N: usize> SpecLen<T, N> for Foo<T, N> {
+ fn spec_len(&self, other: [T; N]) -> usize {
+ 0
+ }
+}
+ "#,
+ );
+
+ check_assist_no_snippet_cap(
+ generate_trait_from_impl,
+ r#"
+struct Foo<T, const N: usize>([T; N]);
+
+impl<T, const N: usize> F$0oo<T, N> where T: Copy {
+ fn spec_len(&self) -> usize {
+ 0
+ }
+}
+ "#,
+ r#"
+struct Foo<T, const N: usize>([T; N]);
+
+trait SpecLen<T> where T: Copy {
+ fn spec_len(&self) -> usize;
+}
+
+impl<T, const N: usize> SpecLen<T> for Foo<T, N> where T: Copy {
+ fn spec_len(&self) -> usize {
+ 0
+ }
+}
+ "#,
+ );
+ }
+
+ #[test]
fn test_trait_items_should_not_have_vis() {
check_assist_no_snippet_cap(
generate_trait_from_impl,
diff --git a/crates/ide-db/src/generated/lints.rs b/crates/ide-db/src/generated/lints.rs
index 683adff615..3e78ae0998 100644
--- a/crates/ide-db/src/generated/lints.rs
+++ b/crates/ide-db/src/generated/lints.rs
@@ -4487,20 +4487,6 @@ The tracking issue for this feature is: [#128044]
deny_since: None,
},
Lint {
- label: "cfg_emscripten_wasm_eh",
- description: r##"# `cfg_emscripten_wasm_eh`
-
-Allows access to the emscripten_wasm_eh config, used by panic_unwind and unwind
-
-This feature has no tracking issue, and is therefore likely internal to the compiler, not being intended for general use.
-
-------------------------
-"##,
- default_severity: Severity::Allow,
- warn_since: None,
- deny_since: None,
- },
- Lint {
label: "cfg_eval",
description: r##"# `cfg_eval`
@@ -9034,6 +9020,22 @@ The tracking issue for this feature is: [#135513]
deny_since: None,
},
Lint {
+ label: "gpu_offload",
+ description: r##"# `gpu_offload`
+
+
+
+The tracking issue for this feature is: [#131513]
+
+[#131513]: https://github.com/rust-lang/rust/issues/131513
+
+------------------------
+"##,
+ default_severity: Severity::Allow,
+ warn_since: None,
+ deny_since: None,
+ },
+ Lint {
label: "guard_patterns",
description: r##"# `guard_patterns`
@@ -9998,8 +10000,7 @@ Some features provided by lang items:
failure mechanisms of the compiler. This is often mapped to GCC's personality
function (see the [`std` implementation][personality] for more information),
but programs which don't trigger a panic can be assured that this function is
- never called. Additionally, a `eh_catch_typeinfo` static is needed for certain
- targets which implement Rust panics on top of C++ exceptions.
+ never called.
- the traits in `core::marker` used to indicate types of
various kinds; e.g. lang items `sized`, `sync` and `copy`.
- memory allocation, see below.
@@ -16441,6 +16442,22 @@ The tracking issue for this feature is: [#76923]
deny_since: None,
},
Lint {
+ label: "unnamed_enum_variants",
+ description: r##"# `unnamed_enum_variants`
+
+Allows using `_ = <range-or-int>` enum variants.
+
+The tracking issue for this feature is: [#156628]
+
+[#156628]: https://github.com/rust-lang/rust/issues/156628
+
+------------------------
+"##,
+ default_severity: Severity::Allow,
+ warn_since: None,
+ deny_since: None,
+ },
+ Lint {
label: "unqualified_local_imports",
description: r##"# `unqualified_local_imports`
diff --git a/crates/ide-db/src/lib.rs b/crates/ide-db/src/lib.rs
index 2b1525e2b2..87cbc7c533 100644
--- a/crates/ide-db/src/lib.rs
+++ b/crates/ide-db/src/lib.rs
@@ -160,7 +160,7 @@ impl SourceDatabase for RootDatabase {
}
fn file_source_root(&self, id: vfs::FileId) -> FileSourceRootInput {
- self.files.file_source_root(id)
+ self.files.file_source_root(self, id)
}
fn set_file_source_root_with_durability(
diff --git a/crates/ide-db/src/syntax_helpers/node_ext.rs b/crates/ide-db/src/syntax_helpers/node_ext.rs
index e30b21c139..15ecabc33c 100644
--- a/crates/ide-db/src/syntax_helpers/node_ext.rs
+++ b/crates/ide-db/src/syntax_helpers/node_ext.rs
@@ -364,7 +364,8 @@ pub fn for_each_tail_expr(expr: &ast::Expr, cb: &mut dyn FnMut(&ast::Expr)) {
| ast::Expr::YeetExpr(_)
| ast::Expr::OffsetOfExpr(_)
| ast::Expr::FormatArgsExpr(_)
- | ast::Expr::AsmExpr(_) => cb(expr),
+ | ast::Expr::AsmExpr(_)
+ | ast::Expr::IncludeBytesExpr(_) => cb(expr),
}
}
diff --git a/crates/ide-db/src/traits.rs b/crates/ide-db/src/traits.rs
index d38d9b6708..994427ac76 100644
--- a/crates/ide-db/src/traits.rs
+++ b/crates/ide-db/src/traits.rs
@@ -1,7 +1,7 @@
//! Functionality for obtaining data related to traits from the DB.
use crate::{RootDatabase, defs::Definition};
-use hir::{AsAssocItem, Semantics, db::HirDatabase};
+use hir::{AsAssocItem, HasCrate, Semantics, db::HirDatabase, sym};
use rustc_hash::FxHashSet;
use syntax::{AstNode, ast};
@@ -51,19 +51,38 @@ pub fn get_missing_assoc_items(
}
}
- imp.trait_(sema.db).map_or(vec![], |target_trait| {
- target_trait
- .items(sema.db)
- .into_iter()
- .filter(|i| match i {
- hir::AssocItem::Function(f) => !impl_fns_consts.contains(&f.name(sema.db)),
- hir::AssocItem::TypeAlias(t) => !impl_type.contains(&t.name(sema.db)),
- hir::AssocItem::Const(c) => {
- c.name(sema.db).map(|n| !impl_fns_consts.contains(&n)).unwrap_or_default()
- }
- })
- .collect()
- })
+ let Some(target_trait) = imp.trait_(sema.db) else { return Vec::new() };
+
+ // `Drop` has two methods, `drop()` and `pin_drop()`, and you can only implement one of them, so
+ // we consider `pin_drop()` to not exist, unless you already implement it.
+ let drop_trait = hir::Trait::lang(sema.db, imp.krate(sema.db), hir::LangItem::Drop);
+ if let Some(drop_trait) = drop_trait
+ && target_trait == drop_trait
+ {
+ return if impl_fns_consts.is_empty() {
+ // No method implemented, return `drop()`.
+ let drop_drop = drop_trait.function(sema.db, sym::drop);
+ match drop_drop {
+ Some(drop_drop) => vec![hir::AssocItem::Function(drop_drop)],
+ None => Vec::new(),
+ }
+ } else {
+ // Some method is already implemented, leave it.
+ Vec::new()
+ };
+ }
+
+ target_trait
+ .items(sema.db)
+ .into_iter()
+ .filter(|i| match i {
+ hir::AssocItem::Function(f) => !impl_fns_consts.contains(&f.name(sema.db)),
+ hir::AssocItem::TypeAlias(t) => !impl_type.contains(&t.name(sema.db)),
+ hir::AssocItem::Const(c) => {
+ c.name(sema.db).map(|n| !impl_fns_consts.contains(&n)).unwrap_or_default()
+ }
+ })
+ .collect()
}
/// Converts associated trait impl items to their trait definition counterpart
diff --git a/crates/ide-diagnostics/src/handlers/infer_vars_not_allowed.rs b/crates/ide-diagnostics/src/handlers/infer_vars_not_allowed.rs
new file mode 100644
index 0000000000..cf369a1aa0
--- /dev/null
+++ b/crates/ide-diagnostics/src/handlers/infer_vars_not_allowed.rs
@@ -0,0 +1,49 @@
+use crate::{Diagnostic, DiagnosticCode, DiagnosticsContext};
+
+// Diagnostic: infer-vars-not-allowed
+//
+// This diagnostic is triggered when `_` is used where type
+// inference is not allowed.
+pub(crate) fn infer_vars_not_allowed(
+ ctx: &DiagnosticsContext<'_, '_>,
+ d: &hir::InferVarsNotAllowed,
+) -> Diagnostic {
+ Diagnostic::new_with_syntax_node_ptr(
+ ctx,
+ DiagnosticCode::RustcHardError("E0121"),
+ "the type placeholder `_` is not allowed within types on item signatures",
+ d.node,
+ )
+}
+#[cfg(test)]
+mod tests {
+ use crate::tests::check_diagnostics;
+ #[test]
+ fn type_alias() {
+ check_diagnostics(
+ r#"
+type Foo = _;
+ // ^ error: the type placeholder `_` is not allowed within types on item signatures
+ "#,
+ );
+ }
+ #[test]
+ fn const_item() {
+ check_diagnostics(
+ r#"
+const X: _ = 0;
+ // ^ error: the type placeholder `_` is not allowed within types on item signatures
+ "#,
+ );
+ }
+
+ #[test]
+ fn static_item() {
+ check_diagnostics(
+ r#"
+static Y: _ = 0;
+ // ^ error: the type placeholder `_` is not allowed within types on item signatures
+ "#,
+ );
+ }
+}
diff --git a/crates/ide-diagnostics/src/handlers/type_must_be_known.rs b/crates/ide-diagnostics/src/handlers/type_must_be_known.rs
index a03352fe31..ae4e6c6b22 100644
--- a/crates/ide-diagnostics/src/handlers/type_must_be_known.rs
+++ b/crates/ide-diagnostics/src/handlers/type_must_be_known.rs
@@ -159,4 +159,17 @@ fn bar() {
"#,
);
}
+
+ #[test]
+ fn include_bytes() {
+ check_diagnostics(
+ r#"
+//- minicore: include_bytes
+
+fn foo() {
+ include_bytes!("./foo.txt");
+}
+ "#,
+ );
+ }
}
diff --git a/crates/ide-diagnostics/src/lib.rs b/crates/ide-diagnostics/src/lib.rs
index aec68b55c7..ea0d2d954e 100644
--- a/crates/ide-diagnostics/src/lib.rs
+++ b/crates/ide-diagnostics/src/lib.rs
@@ -50,6 +50,7 @@ mod handlers {
pub(crate) mod incorrect_case;
pub(crate) mod incorrect_generics_len;
pub(crate) mod incorrect_generics_order;
+ pub(crate) mod infer_vars_not_allowed;
pub(crate) mod invalid_cast;
pub(crate) mod invalid_derive_target;
pub(crate) mod invalid_lhs_of_assignment;
@@ -440,6 +441,7 @@ pub fn semantic_diagnostics(
AnyDiagnostic::CannotImplicitlyDerefTraitObject(d) => handlers::cannot_implicitly_deref_trait_object::cannot_implicitly_deref_trait_object(&ctx, &d),
AnyDiagnostic::CannotIndexInto(d) => handlers::cannot_index_into::cannot_index_into(&ctx, &d),
AnyDiagnostic::CastToUnsized(d) => handlers::invalid_cast::cast_to_unsized(&ctx, &d),
+ AnyDiagnostic::InferVarsNotAllowed(d) => handlers::infer_vars_not_allowed::infer_vars_not_allowed(&ctx, &d),
AnyDiagnostic::ArrayPatternWithoutFixedLength(d) => {
handlers::array_pattern_without_fixed_length::array_pattern_without_fixed_length(
&ctx, &d,
diff --git a/crates/ide/src/folding_ranges.rs b/crates/ide/src/folding_ranges.rs
index 965190b27d..ae006d152a 100644
--- a/crates/ide/src/folding_ranges.rs
+++ b/crates/ide/src/folding_ranges.rs
@@ -13,7 +13,7 @@ use std::hash::Hash;
const REGION_START: &str = "// region:";
const REGION_END: &str = "// endregion";
-#[derive(Debug, PartialEq, Eq)]
+#[derive(Copy, Clone, Debug, PartialEq, Eq)]
pub enum FoldKind {
Comment,
Imports,
@@ -32,8 +32,8 @@ pub enum FoldKind {
TypeAliases,
ExternCrates,
// endregion: item runs
- Stmt(ast::Stmt),
- TailExpr(ast::Expr),
+ Stmt,
+ TailExpr,
}
#[derive(Debug)]
@@ -68,7 +68,7 @@ pub(crate) fn folding_ranges(file: &SourceFile, add_collapsed_text: bool) -> Vec
for element in file.syntax().descendants_with_tokens() {
// Fold items that span multiple lines
- if let Some(kind) = fold_kind(element.clone()) {
+ if let Some((kind, collapsed_text)) = fold_kind(element.clone(), add_collapsed_text) {
let is_multiline = match &element {
NodeOrToken::Node(node) => node.text().contains_char('\n'),
NodeOrToken::Token(token) => token.text().contains('\n'),
@@ -100,7 +100,6 @@ pub(crate) fn folding_ranges(file: &SourceFile, add_collapsed_text: bool) -> Vec
}
}
- let collapsed_text = if add_collapsed_text { collapsed_text(&kind) } else { None };
let fold = Fold::new(element.text_range(), kind).with_text(collapsed_text);
res.push(fold);
continue;
@@ -183,55 +182,10 @@ pub(crate) fn folding_ranges(file: &SourceFile, add_collapsed_text: bool) -> Vec
res
}
-fn collapsed_text(kind: &FoldKind) -> Option<String> {
- match kind {
- FoldKind::TailExpr(expr) => collapse_expr(expr.clone()),
- FoldKind::Stmt(stmt) => {
- match stmt {
- ast::Stmt::ExprStmt(expr_stmt) => {
- expr_stmt.expr().and_then(collapse_expr).map(|text| format!("{text};"))
- }
- ast::Stmt::LetStmt(let_stmt) => 'blk: {
- if let_stmt.let_else().is_some() {
- break 'blk None;
- }
-
- let Some(expr) = let_stmt.initializer() else {
- break 'blk None;
- };
-
- // If the `let` statement spans multiple lines, we do not collapse it.
- // We use the `eq_token` to check whether the `let` statement is a single line,
- // as the formatter may place the initializer on a new line for better readability.
- //
- // Example:
- // ```rust
- // let complex_pat =
- // complex_expr;
- // ```
- //
- // In this case, we should generate the collapsed text.
- let Some(eq_token) = let_stmt.eq_token() else {
- break 'blk None;
- };
- let eq_token_offset =
- eq_token.text_range().end() - let_stmt.syntax().text_range().start();
- let text_until_eq_token = let_stmt.syntax().text().slice(..eq_token_offset);
- if text_until_eq_token.contains_char('\n') {
- break 'blk None;
- }
-
- collapse_expr(expr).map(|text| format!("{text_until_eq_token} {text};"))
- }
- // handling `items` in external matches.
- ast::Stmt::Item(_) => None,
- }
- }
- _ => None,
- }
-}
-
-fn fold_kind(element: SyntaxElement) -> Option<FoldKind> {
+fn fold_kind(
+ element: SyntaxElement,
+ add_collapsed_text: bool,
+) -> Option<(FoldKind, Option<String>)> {
// handle tail_expr
if let Some(node) = element.as_node()
// tail_expr -> stmt_list -> block
@@ -239,7 +193,10 @@ fn fold_kind(element: SyntaxElement) -> Option<FoldKind> {
&& let Some(tail_expr) = block.tail_expr()
&& tail_expr.syntax() == node
{
- return Some(FoldKind::TailExpr(tail_expr));
+ return Some((
+ FoldKind::TailExpr,
+ add_collapsed_text.then(|| collapse_expr(tail_expr)).flatten(),
+ ));
}
match element.kind() {
@@ -260,14 +217,63 @@ fn fold_kind(element: SyntaxElement) -> Option<FoldKind> {
| MATCH_ARM_LIST
| VARIANT_LIST
| TOKEN_TREE => Some(FoldKind::Block),
- EXPR_STMT | LET_STMT => Some(FoldKind::Stmt(ast::Stmt::cast(element.as_node()?.clone())?)),
+ EXPR_STMT | LET_STMT => {
+ return Some((
+ FoldKind::Stmt,
+ add_collapsed_text
+ .then(|| collapsed_stmt(ast::Stmt::cast(element.as_node()?.clone())?))
+ .flatten(),
+ ));
+ }
_ => None,
}
+ .zip(Some(None))
}
-const COLLAPSE_EXPR_MAX_LEN: usize = 100;
+fn collapsed_stmt(stmt: ast::Stmt) -> Option<String> {
+ match stmt {
+ ast::Stmt::ExprStmt(expr_stmt) => {
+ expr_stmt.expr().and_then(collapse_expr).map(|text| format!("{text};"))
+ }
+ ast::Stmt::LetStmt(let_stmt) => 'blk: {
+ if let_stmt.let_else().is_some() {
+ break 'blk None;
+ }
+
+ let Some(expr) = let_stmt.initializer() else {
+ break 'blk None;
+ };
+
+ // If the `let` statement spans multiple lines, we do not collapse it.
+ // We use the `eq_token` to check whether the `let` statement is a single line,
+ // as the formatter may place the initializer on a new line for better readability.
+ //
+ // Example:
+ // ```rust
+ // let complex_pat =
+ // complex_expr;
+ // ```
+ //
+ // In this case, we should generate the collapsed text.
+ let Some(eq_token) = let_stmt.eq_token() else {
+ break 'blk None;
+ };
+ let eq_token_offset =
+ eq_token.text_range().end() - let_stmt.syntax().text_range().start();
+ let text_until_eq_token = let_stmt.syntax().text().slice(..eq_token_offset);
+ if text_until_eq_token.contains_char('\n') {
+ break 'blk None;
+ }
+
+ collapse_expr(expr).map(|text| format!("{text_until_eq_token} {text};"))
+ }
+ // handling `items` in external matches.
+ ast::Stmt::Item(_) => None,
+ }
+}
fn collapse_expr(expr: ast::Expr) -> Option<String> {
+ const COLLAPSE_EXPR_MAX_LEN: usize = 100;
let mut text = String::with_capacity(COLLAPSE_EXPR_MAX_LEN * 2);
let mut preorder = expr.syntax().preorder_with_tokens();
@@ -435,7 +441,7 @@ fn contiguous_range_for_comment(
}
fn fold_range_for_multiline_match_arm(match_arm: ast::MatchArm) -> Option<TextRange> {
- if fold_kind(match_arm.expr()?.syntax().syntax_element()).is_some() {
+ if fold_kind(match_arm.expr()?.syntax().syntax_element(), false).is_some() {
None
} else if match_arm.expr()?.syntax().text().contains_char('\n') {
Some(match_arm.expr()?.syntax().text_range())
@@ -507,8 +513,8 @@ mod tests {
FoldKind::MatchArm => "matcharm",
FoldKind::Function => "function",
FoldKind::ExternCrates => "externcrates",
- FoldKind::Stmt(_) => "stmt",
- FoldKind::TailExpr(_) => "tailexpr",
+ FoldKind::Stmt => "stmt",
+ FoldKind::TailExpr => "tailexpr",
};
assert_eq!(kind, &attr.unwrap());
if enable_collapsed_text {
diff --git a/crates/ide/src/goto_definition.rs b/crates/ide/src/goto_definition.rs
index 4890badcbf..991a0b6bee 100644
--- a/crates/ide/src/goto_definition.rs
+++ b/crates/ide/src/goto_definition.rs
@@ -4180,4 +4180,21 @@ fn main() {
"#,
);
}
+
+ #[test]
+ fn ide_features_work_in_field_default() {
+ check(
+ r#"
+struct S;
+impl S {
+ fn foo(&self) {}
+ // ^^^
+}
+
+struct Struct {
+ field: () = S.foo$0(),
+}
+ "#,
+ );
+ }
}
diff --git a/crates/ide/src/inlay_hints/implicit_drop.rs b/crates/ide/src/inlay_hints/implicit_drop.rs
index f6b13cbe0b..9387573cf7 100644
--- a/crates/ide/src/inlay_hints/implicit_drop.rs
+++ b/crates/ide/src/inlay_hints/implicit_drop.rs
@@ -9,6 +9,7 @@ use hir::{
DefWithBody,
db::HirDatabase as _,
mir::{MirSpan, TerminatorKind},
+ name,
};
use ide_db::{FileRange, famous_defs::FamousDefs};
@@ -95,7 +96,7 @@ pub(super) fn hints(
};
let binding = &hir[binding_idx];
let name = binding.name.display_no_db(display_target.edition).to_smolstr();
- if name.starts_with("<ra@") {
+ if name::is_generated(&name) {
continue; // Ignore desugared variables
}
let mut label = InlayHintLabel::simple(
diff --git a/crates/ide/src/inlay_hints/param_name.rs b/crates/ide/src/inlay_hints/param_name.rs
index c780ce5864..f1689e5f9d 100644
--- a/crates/ide/src/inlay_hints/param_name.rs
+++ b/crates/ide/src/inlay_hints/param_name.rs
@@ -7,7 +7,7 @@
use std::iter::zip;
use either::Either;
-use hir::{EditionedFileId, Semantics};
+use hir::{EditionedFileId, Semantics, name};
use ide_db::{RootDatabase, famous_defs::FamousDefs};
use stdx::to_lower_snake_case;
@@ -197,13 +197,14 @@ fn should_hide_param_name_hint(
// parameter is a prefix/suffix of argument with _ splitting it off
// - param starts with `ra_fixture`
// - param is a well known name in a unary function
+ // - param is generated name
let param_name = param_name.trim_matches('_');
if param_name.is_empty() {
return true;
}
- if param_name.starts_with("ra_fixture") {
+ if param_name.starts_with("ra_fixture") || name::is_generated(param_name) {
return true;
}
@@ -608,6 +609,7 @@ impl Test {
fn test_func(mut foo: i32, bar: i32, msg: &str, _: i32, last: i32) -> i32 {
foo + bar
}
+async fn test_async(foo: i32, _: i32) {}
fn main() {
let not_literal = 1;
@@ -631,6 +633,8 @@ fn main() {
None,
//^^^^ docs
);
+ test_async(1, 2)
+ //^ foo
}"#,
);
}
diff --git a/crates/ide/src/lib.rs b/crates/ide/src/lib.rs
index e131e7bdd1..88cb570c6b 100644
--- a/crates/ide/src/lib.rs
+++ b/crates/ide/src/lib.rs
@@ -41,6 +41,7 @@ mod matching_brace;
mod moniker;
mod move_item;
mod parent_module;
+mod predicate_eval;
mod references;
mod rename;
mod runnables;
@@ -122,7 +123,7 @@ pub use crate::{
},
test_explorer::{TestItem, TestItemKind},
};
-pub use hir::Semantics;
+pub use hir::{PredicateEvaluationResult, PredicateEvaluationStatus, Semantics};
pub use ide_assists::{
Assist, AssistConfig, AssistId, AssistKind, AssistResolveStrategy, SingleResolve,
};
@@ -391,6 +392,14 @@ impl Analysis {
self.with_db(|db| view_hir::view_hir(db, position))
}
+ pub fn evaluate_predicate(
+ &self,
+ text: String,
+ position: FilePosition,
+ ) -> Cancellable<PredicateEvaluationResult> {
+ self.with_db(|db| predicate_eval::evaluate_predicate(db, text, position))
+ }
+
pub fn view_mir(&self, position: FilePosition) -> Cancellable<String> {
self.with_db(|db| view_mir::view_mir(db, position))
}
diff --git a/crates/ide/src/predicate_eval.rs b/crates/ide/src/predicate_eval.rs
new file mode 100644
index 0000000000..c6ec4ca18e
--- /dev/null
+++ b/crates/ide/src/predicate_eval.rs
@@ -0,0 +1,165 @@
+//! Evaluates type predicates at a given position in the source code.
+
+use hir::{PredicateEvaluationResult, Semantics};
+use ide_db::{FilePosition, RootDatabase};
+use syntax::{AstNode, SourceFile, ast};
+
+pub(crate) fn evaluate_predicate(
+ db: &RootDatabase,
+ text: String,
+ position: FilePosition,
+) -> PredicateEvaluationResult {
+ let sema = Semantics::new(db);
+ let source_file = sema.parse_guess_edition(position.file_id);
+ let edition = sema.attach_first_edition(position.file_id).edition(db);
+
+ let Some(where_clause) = parse_where_clause(&text, edition) else {
+ return PredicateEvaluationResult::invalid("expected a single where-clause predicate");
+ };
+
+ let node = source_file
+ .syntax()
+ .token_at_offset(position.offset)
+ .next()
+ .and_then(|token| token.parent())
+ .unwrap_or_else(|| source_file.syntax().clone());
+ sema.evaluate_where_clause_at(&node, position.offset, where_clause)
+}
+
+fn parse_where_clause(text: &str, edition: span::Edition) -> Option<ast::WhereClause> {
+ let text = text.trim().trim_end_matches(',').trim_end();
+ let wrapped = format!("fn __ra_evaluate_predicate() where {text}, {{}}");
+ let parse = SourceFile::parse(&wrapped, edition);
+ if !parse.errors().is_empty() {
+ return None;
+ }
+
+ let where_clause = parse.tree().syntax().descendants().find_map(ast::WhereClause::cast)?;
+ if where_clause.predicates().count() == 1 { Some(where_clause) } else { None }
+}
+
+#[cfg(test)]
+mod tests {
+ use hir::PredicateEvaluationStatus;
+
+ use crate::fixture;
+
+ fn check(ra_fixture: &str, predicate: &str, status: PredicateEvaluationStatus) {
+ let (analysis, position) = fixture::position(ra_fixture);
+ let result = analysis.evaluate_predicate(predicate.to_owned(), position).unwrap();
+ assert_eq!(result.status, status, "{}", result.message);
+ }
+
+ #[test]
+ fn evaluates_concrete_trait_predicate() {
+ check(
+ r#"
+trait Trait {}
+struct S;
+impl Trait for S {}
+fn f() { $0 }
+"#,
+ "S: Trait",
+ PredicateEvaluationStatus::Holds,
+ );
+ }
+
+ #[test]
+ fn evaluates_generic_bound_from_environment() {
+ check(
+ r#"
+trait Trait {}
+fn f<T: Trait>() { $0 }
+"#,
+ "T: Trait",
+ PredicateEvaluationStatus::Holds,
+ );
+ }
+
+ #[test]
+ fn reports_missing_generic_bound_as_not_proven() {
+ check(
+ r#"
+trait Trait {}
+fn f<T>() { $0 }
+"#,
+ "T: Trait",
+ PredicateEvaluationStatus::NotProven,
+ );
+ }
+
+ #[test]
+ fn evaluates_associated_type_binding() {
+ check(
+ r#"
+trait Iterator { type Item; }
+fn f<I: Iterator<Item = u32>>() { $0 }
+"#,
+ "I: Iterator<Item = u32>",
+ PredicateEvaluationStatus::Holds,
+ );
+ }
+
+ #[test]
+ fn reports_unresolved_type_as_invalid() {
+ check(
+ r#"
+trait Trait {}
+fn f() { $0 }
+"#,
+ "Type: Trait",
+ PredicateEvaluationStatus::Invalid,
+ );
+ }
+
+ #[test]
+ fn reports_unresolved_trait_as_invalid() {
+ check(
+ r#"
+struct Type;
+fn f() { $0 }
+"#,
+ "Type: Trait",
+ PredicateEvaluationStatus::Invalid,
+ );
+ }
+
+ #[test]
+ fn evaluates_lifetime_predicate() {
+ check(
+ r#"
+fn f<'a, 'b>()
+where
+ 'a: 'b,
+{
+ $0
+}
+"#,
+ "'a: 'b",
+ PredicateEvaluationStatus::Holds,
+ );
+ }
+
+ #[test]
+ fn evaluates_type_outlives_predicate() {
+ check(
+ r#"
+fn f<T: 'static>() { $0 }
+"#,
+ "T: 'static",
+ PredicateEvaluationStatus::Holds,
+ );
+ }
+
+ #[test]
+ fn rejects_invalid_predicate() {
+ check(
+ r#"
+trait Trait {}
+fn f() { $0 }
+"#,
+ "u32 Trait",
+ PredicateEvaluationStatus::Invalid,
+ );
+ }
+}
diff --git a/crates/intern/Cargo.toml b/crates/intern/Cargo.toml
index 1e6e8ff32f..2ba802f057 100644
--- a/crates/intern/Cargo.toml
+++ b/crates/intern/Cargo.toml
@@ -15,7 +15,10 @@ doctest = false
[dependencies]
dashmap.workspace = true
-hashbrown.workspace = true
+# We need to freeze the version of the crate, as it needs to match with dashmap
+hashbrown = { version = "0.14.*", features = [
+ "inline-more",
+], default-features = false }
rustc-hash.workspace = true
triomphe.workspace = true
rayon.workspace = true
diff --git a/crates/intern/src/symbol/symbols.rs b/crates/intern/src/symbol/symbols.rs
index e5f66a202e..fe303aa0e0 100644
--- a/crates/intern/src/symbol/symbols.rs
+++ b/crates/intern/src/symbol/symbols.rs
@@ -295,6 +295,7 @@ define_symbols! {
doc,
drop_in_place,
drop,
+ pin_drop,
dyn_metadata,
efiapi,
eh_catch_typeinfo,
diff --git a/crates/parser/src/grammar/expressions/atom.rs b/crates/parser/src/grammar/expressions/atom.rs
index cabdd74b09..bc7db630d1 100644
--- a/crates/parser/src/grammar/expressions/atom.rs
+++ b/crates/parser/src/grammar/expressions/atom.rs
@@ -320,6 +320,10 @@ fn builtin_expr(p: &mut Parser<'_>) -> Option<CompletedMarker> {
// builtin#naked_asm("");
// }
parse_asm_expr(p, m)
+ } else if p.eat_contextual_kw(T![include_bytes]) {
+ // test include_bytes
+ // fn foo() { builtin # include_bytes }
+ Some(m.complete(p, INCLUDE_BYTES_EXPR))
} else {
m.abandon(p);
None
diff --git a/crates/parser/src/grammar/items/adt.rs b/crates/parser/src/grammar/items/adt.rs
index a030190ad3..33e19f5725 100644
--- a/crates/parser/src/grammar/items/adt.rs
+++ b/crates/parser/src/grammar/items/adt.rs
@@ -87,24 +87,27 @@ pub(crate) fn variant_list(p: &mut Parser<'_>) {
attributes::outer_attrs(p);
if p.at(IDENT) {
name(p);
- match p.current() {
- T!['{'] => record_field_list(p),
- T!['('] => tuple_field_list(p),
- _ => (),
- }
-
- // test variant_discriminant
- // enum E { X(i32) = 10 }
- if p.eat(T![=]) {
- let m = p.start();
- expressions::expr(p);
- m.complete(p, CONST_ARG);
- }
- m.complete(p, VARIANT);
+ } else if p.at(T![_]) {
+ p.bump(T![_]);
} else {
m.abandon(p);
p.err_and_bump("expected enum variant");
+ return;
+ }
+ match p.current() {
+ T!['{'] => record_field_list(p),
+ T!['('] => tuple_field_list(p),
+ _ => (),
+ }
+
+ // test variant_discriminant
+ // enum E { X(i32) = 10 }
+ if p.eat(T![=]) {
+ let m = p.start();
+ expressions::expr(p);
+ m.complete(p, CONST_ARG);
}
+ m.complete(p, VARIANT);
}
}
diff --git a/crates/parser/src/grammar/types.rs b/crates/parser/src/grammar/types.rs
index f92afde60d..db0185331c 100644
--- a/crates/parser/src/grammar/types.rs
+++ b/crates/parser/src/grammar/types.rs
@@ -1,4 +1,4 @@
-use crate::grammar::entry::prefix::pat;
+use crate::grammar::entry::prefix::pat_top;
use super::*;
@@ -430,7 +430,7 @@ fn pattern_type(p: &mut Parser<'_>) {
if !p.eat_contextual_kw(T![is]) {
p.error("expected `is`")
}
- pat(p);
+ pat_top(p);
p.expect(T![')']);
m.complete(p, PATTERN_TYPE);
} else {
diff --git a/crates/parser/src/syntax_kind/generated.rs b/crates/parser/src/syntax_kind/generated.rs
index dd675e0834..1c4fcf080f 100644
--- a/crates/parser/src/syntax_kind/generated.rs
+++ b/crates/parser/src/syntax_kind/generated.rs
@@ -125,6 +125,7 @@ pub enum SyntaxKind {
FORMAT_ARGS_KW,
GEN_KW,
GLOBAL_ASM_KW,
+ INCLUDE_BYTES_KW,
INLATEOUT_KW,
INOUT_KW,
IS_KW,
@@ -225,6 +226,7 @@ pub enum SyntaxKind {
IMPL,
IMPL_RESTRICTION,
IMPL_TRAIT_TYPE,
+ INCLUDE_BYTES_EXPR,
INDEX_EXPR,
INFER_TYPE,
ITEM_LIST,
@@ -412,6 +414,7 @@ impl SyntaxKind {
| IMPL
| IMPL_RESTRICTION
| IMPL_TRAIT_TYPE
+ | INCLUDE_BYTES_EXPR
| INDEX_EXPR
| INFER_TYPE
| ITEM_LIST
@@ -641,6 +644,7 @@ impl SyntaxKind {
DYN_KW => "dyn",
FORMAT_ARGS_KW => "format_args",
GLOBAL_ASM_KW => "global_asm",
+ INCLUDE_BYTES_KW => "include_bytes",
INLATEOUT_KW => "inlateout",
INOUT_KW => "inout",
IS_KW => "is",
@@ -750,6 +754,7 @@ impl SyntaxKind {
DYN_KW if edition < Edition::Edition2018 => true,
FORMAT_ARGS_KW => true,
GLOBAL_ASM_KW => true,
+ INCLUDE_BYTES_KW => true,
INLATEOUT_KW => true,
INOUT_KW => true,
IS_KW => true,
@@ -847,6 +852,7 @@ impl SyntaxKind {
DYN_KW if edition < Edition::Edition2018 => true,
FORMAT_ARGS_KW => true,
GLOBAL_ASM_KW => true,
+ INCLUDE_BYTES_KW => true,
INLATEOUT_KW => true,
INOUT_KW => true,
IS_KW => true,
@@ -1007,6 +1013,7 @@ impl SyntaxKind {
"dyn" if edition < Edition::Edition2018 => DYN_KW,
"format_args" => FORMAT_ARGS_KW,
"global_asm" => GLOBAL_ASM_KW,
+ "include_bytes" => INCLUDE_BYTES_KW,
"inlateout" => INLATEOUT_KW,
"inout" => INOUT_KW,
"is" => IS_KW,
@@ -1185,6 +1192,7 @@ macro_rules ! T_ {
[dyn] => { $ crate :: SyntaxKind :: DYN_KW };
[format_args] => { $ crate :: SyntaxKind :: FORMAT_ARGS_KW };
[global_asm] => { $ crate :: SyntaxKind :: GLOBAL_ASM_KW };
+ [include_bytes] => { $ crate :: SyntaxKind :: INCLUDE_BYTES_KW };
[inlateout] => { $ crate :: SyntaxKind :: INLATEOUT_KW };
[inout] => { $ crate :: SyntaxKind :: INOUT_KW };
[is] => { $ crate :: SyntaxKind :: IS_KW };
diff --git a/crates/parser/test_data/generated/runner.rs b/crates/parser/test_data/generated/runner.rs
index ccf8b89be7..26d28ddfc6 100644
--- a/crates/parser/test_data/generated/runner.rs
+++ b/crates/parser/test_data/generated/runner.rs
@@ -362,6 +362,8 @@ mod ok {
run_and_expect_no_errors("test_data/parser/inline/ok/impl_type_params.rs");
}
#[test]
+ fn include_bytes() { run_and_expect_no_errors("test_data/parser/inline/ok/include_bytes.rs"); }
+ #[test]
fn index_expr() { run_and_expect_no_errors("test_data/parser/inline/ok/index_expr.rs"); }
#[test]
fn label() { run_and_expect_no_errors("test_data/parser/inline/ok/label.rs"); }
diff --git a/crates/parser/test_data/parser/inline/ok/include_bytes.rast b/crates/parser/test_data/parser/inline/ok/include_bytes.rast
new file mode 100644
index 0000000000..df47eb9207
--- /dev/null
+++ b/crates/parser/test_data/parser/inline/ok/include_bytes.rast
@@ -0,0 +1,23 @@
+SOURCE_FILE
+ FN
+ FN_KW "fn"
+ WHITESPACE " "
+ NAME
+ IDENT "foo"
+ PARAM_LIST
+ L_PAREN "("
+ R_PAREN ")"
+ WHITESPACE " "
+ BLOCK_EXPR
+ STMT_LIST
+ L_CURLY "{"
+ WHITESPACE " "
+ INCLUDE_BYTES_EXPR
+ BUILTIN_KW "builtin"
+ WHITESPACE " "
+ POUND "#"
+ WHITESPACE " "
+ INCLUDE_BYTES_KW "include_bytes"
+ WHITESPACE " "
+ R_CURLY "}"
+ WHITESPACE "\n"
diff --git a/crates/parser/test_data/parser/inline/ok/include_bytes.rs b/crates/parser/test_data/parser/inline/ok/include_bytes.rs
new file mode 100644
index 0000000000..6367235d72
--- /dev/null
+++ b/crates/parser/test_data/parser/inline/ok/include_bytes.rs
@@ -0,0 +1 @@
+fn foo() { builtin # include_bytes }
diff --git a/crates/parser/test_data/parser/ok/0019_enums.rast b/crates/parser/test_data/parser/ok/0019_enums.rast
index 51837e5372..24256ea294 100644
--- a/crates/parser/test_data/parser/ok/0019_enums.rast
+++ b/crates/parser/test_data/parser/ok/0019_enums.rast
@@ -151,6 +151,16 @@ SOURCE_FILE
L_PAREN "("
R_PAREN ")"
COMMA ","
+ WHITESPACE "\n "
+ VARIANT
+ UNDERSCORE "_"
+ WHITESPACE " "
+ EQ "="
+ WHITESPACE " "
+ CONST_ARG
+ RANGE_EXPR
+ DOT2 ".."
+ COMMA ","
WHITESPACE "\n"
R_CURLY "}"
WHITESPACE "\n"
diff --git a/crates/parser/test_data/parser/ok/0019_enums.rs b/crates/parser/test_data/parser/ok/0019_enums.rs
index 7a1afa0e62..f548479e45 100644
--- a/crates/parser/test_data/parser/ok/0019_enums.rs
+++ b/crates/parser/test_data/parser/ok/0019_enums.rs
@@ -22,4 +22,5 @@ enum E5 {
F {},
D(u32,),
E(),
+ _ = ..,
}
diff --git a/crates/proc-macro-srv/Cargo.toml b/crates/proc-macro-srv/Cargo.toml
index a161d79693..72d394d37b 100644
--- a/crates/proc-macro-srv/Cargo.toml
+++ b/crates/proc-macro-srv/Cargo.toml
@@ -35,8 +35,7 @@ line-index.workspace = true
proc-macro-test.path = "./proc-macro-test"
[features]
-default = []
-# default = ["in-rust-tree"]
+default = ["in-rust-tree"]
in-rust-tree = []
[lints]
diff --git a/crates/proc-macro-srv/src/dylib.rs b/crates/proc-macro-srv/src/dylib.rs
index 96daa2c462..f654d21cfe 100644
--- a/crates/proc-macro-srv/src/dylib.rs
+++ b/crates/proc-macro-srv/src/dylib.rs
@@ -1,9 +1,14 @@
//! Handles dynamic library loading for proc macro
mod proc_macros;
-mod version;
+use rustc_codegen_ssa::back::metadata::DefaultMetadataLoader;
+use rustc_interface::util::rustc_version_str;
+use rustc_metadata::locator::MetadataError;
use rustc_proc_macro::bridge;
+use rustc_session::config::host_tuple;
+use rustc_target::spec::{Target, TargetTuple};
+use std::path::Path;
use std::{fmt, fs, io, time::SystemTime};
use temp_dir::TempDir;
@@ -13,7 +18,8 @@ use paths::{Utf8Path, Utf8PathBuf};
use crate::{
PanicMessage, ProcMacroClientHandle, ProcMacroKind, ProcMacroSrvSpan, TrackedEnv,
- dylib::proc_macros::ProcMacros, token_stream::TokenStream,
+ dylib::proc_macros::{ProcMacroClients, ProcMacros},
+ token_stream::TokenStream,
};
pub(crate) struct Expander {
@@ -76,18 +82,15 @@ impl Expander {
pub enum LoadProcMacroDylibError {
Io(io::Error),
LibLoading(libloading::Error),
- AbiMismatch(String),
+ MetadataError(MetadataError<'static>),
}
impl fmt::Display for LoadProcMacroDylibError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Self::Io(e) => e.fmt(f),
- Self::AbiMismatch(v) => {
- use crate::RUSTC_VERSION_STRING;
- write!(f, "mismatched ABI expected: `{RUSTC_VERSION_STRING}`, got `{v}`")
- }
Self::LibLoading(e) => e.fmt(f),
+ Self::MetadataError(e) => e.fmt(f),
}
}
}
@@ -104,25 +107,44 @@ impl From<libloading::Error> for LoadProcMacroDylibError {
}
}
+impl From<MetadataError<'_>> for LoadProcMacroDylibError {
+ fn from(e: MetadataError<'_>) -> Self {
+ LoadProcMacroDylibError::MetadataError(match e {
+ MetadataError::NotPresent(path) => MetadataError::NotPresent(path.into_owned().into()),
+ MetadataError::LoadFailure(err) => MetadataError::LoadFailure(err),
+ MetadataError::VersionMismatch { expected_version, found_version } => {
+ MetadataError::VersionMismatch { expected_version, found_version }
+ }
+ })
+ }
+}
+
struct ProcMacroLibrary {
- // 'static is actually the lifetime of library, so make sure this drops before _lib
- proc_macros: &'static ProcMacros,
+ // this contains references to the library, so make sure this drops before _lib
+ proc_macros: ProcMacros,
// Hold on to the library so it doesn't unload
_lib: Library,
}
impl ProcMacroLibrary {
fn open(path: &Utf8Path) -> Result<Self, LoadProcMacroDylibError> {
+ let proc_macro_kinds = rustc_span::create_default_session_globals_then(|| {
+ let (target, _) =
+ Target::search(&TargetTuple::from_tuple(host_tuple()), Path::new(""), false)
+ .unwrap();
+ rustc_metadata::locator::get_proc_macro_info(
+ &target,
+ path.as_ref(),
+ &DefaultMetadataLoader,
+ rustc_version_str().unwrap_or("unknown"),
+ )
+ })?;
+
let file = fs::File::open(path)?;
#[allow(clippy::undocumented_unsafe_blocks)] // FIXME
let file = unsafe { memmap2::Mmap::map(&file) }?;
let obj = object::File::parse(&*file)
.map_err(|e| io::Error::new(io::ErrorKind::InvalidData, e))?;
- let version_info = version::read_dylib_info(&obj)?;
- if version_info.version_string != crate::RUSTC_VERSION_STRING {
- return Err(LoadProcMacroDylibError::AbiMismatch(version_info.version_string));
- }
-
let symbol_name =
find_registrar_symbol(&obj).map_err(invalid_data_err)?.ok_or_else(|| {
invalid_data_err(format!("Cannot find registrar symbol in file {path}"))
@@ -135,9 +157,12 @@ impl ProcMacroLibrary {
// due to self-referentiality
// But we make sure that we do not drop it before the symbol is dropped
let proc_macros =
- unsafe { lib.get::<&'static &'static ProcMacros>(symbol_name.as_bytes()) };
+ unsafe { lib.get::<&'static &'static ProcMacroClients>(symbol_name.as_bytes()) };
match proc_macros {
- Ok(proc_macros) => Ok(ProcMacroLibrary { proc_macros: *proc_macros, _lib: lib }),
+ Ok(proc_macros) => Ok(ProcMacroLibrary {
+ proc_macros: ProcMacros::new(*proc_macros, proc_macro_kinds),
+ _lib: lib,
+ }),
Err(e) => Err(e.into()),
}
}
diff --git a/crates/proc-macro-srv/src/dylib/proc_macros.rs b/crates/proc-macro-srv/src/dylib/proc_macros.rs
index 4ed32f8e6c..ef6752d816 100644
--- a/crates/proc-macro-srv/src/dylib/proc_macros.rs
+++ b/crates/proc-macro-srv/src/dylib/proc_macros.rs
@@ -5,7 +5,7 @@ use crate::{
use rustc_proc_macro::bridge;
#[repr(transparent)]
-pub(crate) struct ProcMacros([bridge::client::ProcMacro]);
+pub(crate) struct ProcMacroClients([bridge::client::Client]);
impl From<bridge::PanicMessage> for crate::PanicMessage {
fn from(p: bridge::PanicMessage) -> Self {
@@ -13,7 +13,16 @@ impl From<bridge::PanicMessage> for crate::PanicMessage {
}
}
+pub(crate) struct ProcMacros(Vec<(bridge::client::Client, rustc_metadata::ProcMacroKind)>);
+
impl ProcMacros {
+ pub(super) fn new(
+ clients: &ProcMacroClients,
+ kinds: Vec<rustc_metadata::ProcMacroKind>,
+ ) -> Self {
+ ProcMacros(clients.0.iter().copied().zip(kinds).collect::<Vec<_>>())
+ }
+
pub(crate) fn expand<'a, S: ProcMacroSrvSpan>(
&self,
macro_name: &str,
@@ -27,12 +36,12 @@ impl ProcMacros {
) -> Result<TokenStream<S>, crate::PanicMessage> {
let parsed_attributes = attribute.unwrap_or_default();
- for proc_macro in &self.0 {
- match proc_macro {
- bridge::client::ProcMacro::CustomDerive { trait_name, client, .. }
- if *trait_name == macro_name =>
+ for (client, kind) in &self.0 {
+ match kind {
+ rustc_metadata::ProcMacroKind::CustomDerive { trait_name, .. }
+ if trait_name.as_str() == macro_name =>
{
- let res = client.run(
+ let res = client.run1(
&bridge::server::SAME_THREAD,
S::make_server(call_site, def_site, mixed_site, tracked_env, callback),
macro_body,
@@ -40,8 +49,8 @@ impl ProcMacros {
);
return res.map_err(crate::PanicMessage::from);
}
- bridge::client::ProcMacro::Bang { name, client } if *name == macro_name => {
- let res = client.run(
+ rustc_metadata::ProcMacroKind::Bang { name } if name.as_str() == macro_name => {
+ let res = client.run1(
&bridge::server::SAME_THREAD,
S::make_server(call_site, def_site, mixed_site, tracked_env, callback),
macro_body,
@@ -49,8 +58,8 @@ impl ProcMacros {
);
return res.map_err(crate::PanicMessage::from);
}
- bridge::client::ProcMacro::Attr { name, client } if *name == macro_name => {
- let res = client.run(
+ rustc_metadata::ProcMacroKind::Attr { name } if name.as_str() == macro_name => {
+ let res = client.run2(
&bridge::server::SAME_THREAD,
S::make_server(call_site, def_site, mixed_site, tracked_env, callback),
parsed_attributes,
@@ -67,12 +76,16 @@ impl ProcMacros {
}
pub(crate) fn list_macros(&self) -> impl Iterator<Item = (&str, ProcMacroKind)> {
- self.0.iter().map(|proc_macro| match *proc_macro {
- bridge::client::ProcMacro::CustomDerive { trait_name, .. } => {
- (trait_name, ProcMacroKind::CustomDerive)
+ self.0.iter().map(|(_client, kind)| match kind {
+ rustc_metadata::ProcMacroKind::CustomDerive { trait_name, .. } => {
+ (trait_name.as_str(), ProcMacroKind::CustomDerive)
+ }
+ rustc_metadata::ProcMacroKind::Bang { name, .. } => {
+ (name.as_str(), ProcMacroKind::Bang)
+ }
+ rustc_metadata::ProcMacroKind::Attr { name, .. } => {
+ (name.as_str(), ProcMacroKind::Attr)
}
- bridge::client::ProcMacro::Bang { name, .. } => (name, ProcMacroKind::Bang),
- bridge::client::ProcMacro::Attr { name, .. } => (name, ProcMacroKind::Attr),
})
}
}
diff --git a/crates/proc-macro-srv/src/dylib/version.rs b/crates/proc-macro-srv/src/dylib/version.rs
deleted file mode 100644
index 209693b4da..0000000000
--- a/crates/proc-macro-srv/src/dylib/version.rs
+++ /dev/null
@@ -1,168 +0,0 @@
-//! Reading proc-macro rustc version information from binary data
-
-use std::io::{self, Read};
-
-use object::read::{Object, ObjectSection};
-
-#[derive(Debug)]
-pub struct RustCInfo {
- #[allow(dead_code)]
- pub version: (usize, usize, usize),
- #[allow(dead_code)]
- pub channel: String,
- #[allow(dead_code)]
- pub commit: Option<String>,
- #[allow(dead_code)]
- pub date: Option<String>,
- // something like "rustc 1.58.1 (db9d1b20b 2022-01-20)"
- pub version_string: String,
-}
-
-/// Read rustc dylib information
-pub fn read_dylib_info(obj: &object::File<'_>) -> io::Result<RustCInfo> {
- macro_rules! err {
- ($e:literal) => {
- io::Error::new(io::ErrorKind::InvalidData, $e)
- };
- }
-
- let ver_str = read_version(obj)?;
- let mut items = ver_str.split_whitespace();
- let tag = items.next().ok_or_else(|| err!("version format error"))?;
- if tag != "rustc" {
- return Err(err!("no rustc tag"));
- }
-
- let version_part = items.next().ok_or_else(|| err!("no version string"))?;
- let mut version_parts = version_part.split('-');
- let version = version_parts.next().ok_or_else(|| err!("no version"))?;
- let channel = version_parts.next().unwrap_or_default().to_owned();
-
- let commit = match items.next() {
- Some(commit) => {
- match commit.len() {
- 0 => None,
- _ => Some(commit[1..].to_string() /* remove ( */),
- }
- }
- None => None,
- };
- let date = match items.next() {
- Some(date) => {
- match date.len() {
- 0 => None,
- _ => Some(date[0..date.len() - 2].to_string() /* remove ) */),
- }
- }
- None => None,
- };
-
- let version_numbers = version
- .split('.')
- .map(|it| it.parse::<usize>())
- .collect::<Result<Vec<_>, _>>()
- .map_err(|_| err!("version number error"))?;
-
- if version_numbers.len() != 3 {
- return Err(err!("version number format error"));
- }
- let version = (version_numbers[0], version_numbers[1], version_numbers[2]);
-
- Ok(RustCInfo { version, channel, commit, date, version_string: ver_str })
-}
-
-/// This is used inside read_version() to locate the ".rustc" section
-/// from a proc macro crate's binary file.
-fn read_section<'a>(obj: &object::File<'a>, section_name: &str) -> io::Result<&'a [u8]> {
- obj.section_by_name(section_name)
- .ok_or_else(|| io::Error::new(io::ErrorKind::InvalidData, "section read error"))?
- .data()
- .map_err(|e| io::Error::new(io::ErrorKind::InvalidData, e))
-}
-
-/// Check the version of rustc that was used to compile a proc macro crate's
-/// binary file.
-///
-/// A proc macro crate binary's ".rustc" section has following byte layout:
-/// * [b'r',b'u',b's',b't',0,0,0,5] is the first 8 bytes
-/// * ff060000 734e6150 is followed, it's the snappy format magic bytes,
-/// means bytes from here (including this sequence) are compressed in
-/// snappy compression format. Version info is inside here, so decompress
-/// this.
-///
-/// The bytes you get after decompressing the snappy format portion has
-/// following layout:
-/// * [b'r',b'u',b's',b't',0,0,0,5] is the first 8 bytes(again)
-/// * [crate root bytes] next 8 bytes (4 in old versions) is to store
-/// crate root position, according to rustc's source code comment
-/// * [length byte] next 1 byte tells us how many bytes we should read next
-/// for the version string's utf8 bytes
-/// * [version string bytes encoded in utf8] <- GET THIS BOI
-/// * [some more bytes that we don't really care but about still there] :-)
-///
-/// Check this issue for more about the bytes layout:
-/// <https://github.com/rust-lang/rust-analyzer/issues/6174>
-pub fn read_version(obj: &object::File<'_>) -> io::Result<String> {
- let dot_rustc = read_section(obj, ".rustc")?;
-
- // check if magic is valid
- if &dot_rustc[0..4] != b"rust" {
- return Err(io::Error::new(
- io::ErrorKind::InvalidData,
- format!("unknown metadata magic, expected `rust`, found `{:?}`", &dot_rustc[0..4]),
- ));
- }
- let version = u32::from_be_bytes([dot_rustc[4], dot_rustc[5], dot_rustc[6], dot_rustc[7]]);
- // Last version with breaking changes is:
- // https://github.com/rust-lang/rust/commit/b94cfefc860715fb2adf72a6955423d384c69318
- let (mut metadata_portion, bytes_before_version) = match version {
- 8 => {
- let len_bytes = &dot_rustc[8..12];
- let data_len = u32::from_be_bytes(len_bytes.try_into().unwrap()) as usize;
- (&dot_rustc[12..data_len + 12], 13)
- }
- 9 | 10 => {
- let len_bytes = &dot_rustc[8..16];
- let data_len = u64::from_le_bytes(len_bytes.try_into().unwrap()) as usize;
- (&dot_rustc[16..data_len + 12], 17)
- }
- _ => {
- return Err(io::Error::new(
- io::ErrorKind::InvalidData,
- format!("unsupported metadata version {version}"),
- ));
- }
- };
-
- // We're going to skip over the bytes before the version string, so basically:
- // 8 bytes for [b'r',b'u',b's',b't',0,0,0,5]
- // 4 or 8 bytes for [crate root bytes]
- // 1 byte for length of version string
- // so 13 or 17 bytes in total, and we should check the last of those bytes
- // to know the length
- let mut bytes = [0u8; 17];
- metadata_portion.read_exact(&mut bytes[..bytes_before_version])?;
- let length = bytes[bytes_before_version - 1];
-
- let mut version_string_utf8 = vec![0u8; length as usize];
- metadata_portion.read_exact(&mut version_string_utf8)?;
- let version_string = String::from_utf8(version_string_utf8);
- version_string.map_err(|e| io::Error::new(io::ErrorKind::InvalidData, e))
-}
-
-#[test]
-fn test_version_check() {
- let info = read_dylib_info(
- &object::File::parse(&*std::fs::read(crate::proc_macro_test_dylib_path()).unwrap())
- .unwrap(),
- )
- .unwrap();
-
- assert_eq!(
- info.version_string,
- crate::RUSTC_VERSION_STRING,
- "sysroot ABI mismatch: dylib rustc version (read from .rustc section): {:?} != proc-macro-srv version (read from 'rustc --version'): {:?}",
- info.version_string,
- crate::RUSTC_VERSION_STRING,
- );
-}
diff --git a/crates/proc-macro-srv/src/lib.rs b/crates/proc-macro-srv/src/lib.rs
index 7562a2e664..b8cd3621d6 100644
--- a/crates/proc-macro-srv/src/lib.rs
+++ b/crates/proc-macro-srv/src/lib.rs
@@ -14,9 +14,15 @@
#![allow(unused_features, unused_crate_dependencies)]
#![deny(deprecated_safe, clippy::undocumented_unsafe_blocks)]
+extern crate rustc_codegen_ssa;
extern crate rustc_driver as _;
+extern crate rustc_interface;
extern crate rustc_lexer;
+extern crate rustc_metadata;
extern crate rustc_proc_macro;
+extern crate rustc_session;
+extern crate rustc_span;
+extern crate rustc_target;
mod bridge;
mod dylib;
diff --git a/crates/rust-analyzer/src/command.rs b/crates/rust-analyzer/src/command.rs
index 49ce6db4ea..ff2e21c865 100644
--- a/crates/rust-analyzer/src/command.rs
+++ b/crates/rust-analyzer/src/command.rs
@@ -13,7 +13,7 @@ use std::{
use anyhow::Context;
use crossbeam_channel::Sender;
use paths::Utf8PathBuf;
-use process_wrap::std::{StdChildWrapper, StdCommandWrap};
+use process_wrap::std::{ChildWrapper, CommandWrap};
use stdx::process::streaming_output;
/// This trait abstracts parsing one line of JSON output into a Rust
@@ -120,7 +120,7 @@ impl<T: Sized + Send + 'static> CommandActor<T> {
/// 'Join On Drop' wrapper for a child process.
///
/// This wrapper kills the process when the wrapper is dropped.
-struct JodGroupChild(Box<dyn StdChildWrapper>);
+struct JodGroupChild(Box<dyn ChildWrapper>);
impl Drop for JodGroupChild {
fn drop(&mut self) {
@@ -164,7 +164,7 @@ impl<T: Sized + Send + 'static> CommandHandle<T> {
let arguments = command.get_args().map(|arg| arg.into()).collect::<Vec<OsString>>();
let current_dir = command.get_current_dir().map(|arg| arg.to_path_buf());
- let mut child = StdCommandWrap::from(command);
+ let mut child = CommandWrap::from(command);
#[cfg(unix)]
child.wrap(process_wrap::std::ProcessSession);
#[cfg(windows)]
diff --git a/crates/rust-analyzer/src/handlers/request.rs b/crates/rust-analyzer/src/handlers/request.rs
index 5bc0f5f0a7..cf85db39f3 100644
--- a/crates/rust-analyzer/src/handlers/request.rs
+++ b/crates/rust-analyzer/src/handlers/request.rs
@@ -2598,6 +2598,28 @@ pub(crate) fn internal_testing_fetch_config(
}))
}
+pub(crate) fn handle_evaluate_predicate(
+ snap: GlobalStateSnapshot,
+ params: lsp_ext::EvaluatePredicateParams,
+) -> anyhow::Result<lsp_ext::EvaluatePredicateResult> {
+ let _p = tracing::info_span!("handle_evaluate_predicate").entered();
+ let file_id = try_default!(from_proto::file_id(&snap, &params.text_document.uri)?);
+ let line_index = snap.file_line_index(file_id)?;
+ let offset = from_proto::offset(&line_index, params.position)?;
+
+ let result = snap.analysis.evaluate_predicate(params.text, FilePosition { file_id, offset })?;
+ let status = match result.status {
+ ide::PredicateEvaluationStatus::Holds => lsp_ext::PredicateEvaluationStatus::Holds,
+ ide::PredicateEvaluationStatus::NotProven => lsp_ext::PredicateEvaluationStatus::NotProven,
+ ide::PredicateEvaluationStatus::Invalid => lsp_ext::PredicateEvaluationStatus::Invalid,
+ ide::PredicateEvaluationStatus::Unsupported => {
+ lsp_ext::PredicateEvaluationStatus::Unsupported
+ }
+ };
+
+ Ok(lsp_ext::EvaluatePredicateResult { status, message: result.message })
+}
+
pub(crate) fn get_failed_obligations(
snap: GlobalStateSnapshot,
params: GetFailedObligationsParams,
diff --git a/crates/rust-analyzer/src/lsp/ext.rs b/crates/rust-analyzer/src/lsp/ext.rs
index 754d6e65fe..444715891f 100644
--- a/crates/rust-analyzer/src/lsp/ext.rs
+++ b/crates/rust-analyzer/src/lsp/ext.rs
@@ -859,6 +859,39 @@ pub struct ClientCommandOptions {
pub commands: Vec<String>,
}
+pub enum EvaluatePredicate {}
+
+#[derive(Deserialize, Serialize, Debug)]
+#[serde(rename_all = "camelCase")]
+pub struct EvaluatePredicateParams {
+ pub text: String,
+ pub text_document: TextDocumentIdentifier,
+ pub position: Position,
+}
+
+#[derive(Deserialize, Serialize, Debug, Default)]
+#[serde(rename_all = "camelCase")]
+pub struct EvaluatePredicateResult {
+ pub status: PredicateEvaluationStatus,
+ pub message: String,
+}
+
+#[derive(Deserialize, Serialize, Debug, Default, PartialEq, Eq)]
+#[serde(rename_all = "camelCase")]
+pub enum PredicateEvaluationStatus {
+ Holds,
+ #[default]
+ NotProven,
+ Invalid,
+ Unsupported,
+}
+
+impl Request for EvaluatePredicate {
+ type Params = EvaluatePredicateParams;
+ type Result = EvaluatePredicateResult;
+ const METHOD: &'static str = "rust-analyzer/evaluatePredicate";
+}
+
pub enum GetFailedObligations {}
#[derive(Deserialize, Serialize, Debug)]
diff --git a/crates/rust-analyzer/src/lsp/to_proto.rs b/crates/rust-analyzer/src/lsp/to_proto.rs
index eff5477969..3e8de073a3 100644
--- a/crates/rust-analyzer/src/lsp/to_proto.rs
+++ b/crates/rust-analyzer/src/lsp/to_proto.rs
@@ -934,8 +934,8 @@ pub(crate) fn folding_range(
| FoldKind::ExternCrates
| FoldKind::MatchArm
| FoldKind::Function
- | FoldKind::Stmt(_)
- | FoldKind::TailExpr(_) => None,
+ | FoldKind::Stmt
+ | FoldKind::TailExpr => None,
};
let range = range(line_index, text_range);
diff --git a/crates/rust-analyzer/src/main_loop.rs b/crates/rust-analyzer/src/main_loop.rs
index 92d5323e96..edf3da5e6c 100644
--- a/crates/rust-analyzer/src/main_loop.rs
+++ b/crates/rust-analyzer/src/main_loop.rs
@@ -1379,6 +1379,7 @@ impl GlobalState {
.on::<NO_RETRY, lsp_ext::MoveItem>(handlers::handle_move_item)
//
.on::<NO_RETRY, lsp_ext::InternalTestingFetchConfig>(handlers::internal_testing_fetch_config)
+ .on::<RETRY, lsp_ext::EvaluatePredicate>(handlers::handle_evaluate_predicate)
.on::<RETRY, lsp_ext::GetFailedObligations>(handlers::get_failed_obligations)
.finish();
}
diff --git a/crates/rust-analyzer/src/target_spec.rs b/crates/rust-analyzer/src/target_spec.rs
index 5bdc9d8ca3..81d9786809 100644
--- a/crates/rust-analyzer/src/target_spec.rs
+++ b/crates/rust-analyzer/src/target_spec.rs
@@ -99,7 +99,7 @@ impl ProjectJsonTargetSpec {
arg.replace("{label}", &this.label)
}),
RunnableKind::Test { test_id, .. } => {
- self.find_replace_runnable(project_json::RunnableKind::Run, &|this, arg| {
+ self.find_replace_runnable(project_json::RunnableKind::TestOne, &|this, arg| {
arg.replace("{label}", &this.label).replace("{test_id}", &test_id.to_string())
})
}
diff --git a/crates/rust-analyzer/tests/slow-tests/main.rs b/crates/rust-analyzer/tests/slow-tests/main.rs
index a863263078..b91bde8428 100644
--- a/crates/rust-analyzer/tests/slow-tests/main.rs
+++ b/crates/rust-analyzer/tests/slow-tests/main.rs
@@ -1543,6 +1543,45 @@ version = "0.0.0"
}
#[test]
+fn test_evaluate_predicate() {
+ if skip_slow_tests() {
+ return;
+ }
+
+ let server = Project::with_fixture(
+ r#"
+//- /Cargo.toml
+[package]
+name = "foo"
+version = "0.0.0"
+
+//- /src/lib.rs
+trait Trait {}
+struct S;
+impl Trait for S {}
+
+fn test<T: Trait>() {
+ let _ = 0;$0
+}
+"#,
+ )
+ .server()
+ .wait_until_workspace_is_loaded();
+
+ let res = server.send_request::<rust_analyzer::lsp::ext::EvaluatePredicate>(
+ rust_analyzer::lsp::ext::EvaluatePredicateParams {
+ text: "T: Trait".to_owned(),
+ text_document: server.doc_id("src/lib.rs"),
+ position: Position::new(5, 14),
+ },
+ );
+
+ let res: rust_analyzer::lsp::ext::EvaluatePredicateResult =
+ serde_json::from_value(res).unwrap();
+ assert_eq!(res.status, rust_analyzer::lsp::ext::PredicateEvaluationStatus::Holds);
+}
+
+#[test]
fn test_get_failed_obligations() {
use expect_test::expect;
if skip_slow_tests() {
diff --git a/crates/syntax/rust.ungram b/crates/syntax/rust.ungram
index 408f2f4b32..e1c91c41e6 100644
--- a/crates/syntax/rust.ungram
+++ b/crates/syntax/rust.ungram
@@ -305,7 +305,7 @@ VariantList =
Variant =
Attr* Visibility?
- Name FieldList? ('=' ConstArg)?
+ (Name | '_') FieldList? ('=' ConstArg)?
Union =
Attr* Visibility?
@@ -442,6 +442,12 @@ Expr =
| YeetExpr
| LetExpr
| UnderscoreExpr
+| IncludeBytesExpr
+
+// We need a special expression for this because we don't have access to the file,
+// and emitting a specific array will have problems with the length.
+IncludeBytesExpr =
+ 'builtin' '#' 'include_bytes'
OffsetOfExpr =
Attr* 'builtin' '#' 'offset_of' '(' Type ',' fields:(NameRef ('.' NameRef)* ) ')'
diff --git a/crates/syntax/src/ast/generated/nodes.rs b/crates/syntax/src/ast/generated/nodes.rs
index c18311bfa3..ac1cddf74c 100644
--- a/crates/syntax/src/ast/generated/nodes.rs
+++ b/crates/syntax/src/ast/generated/nodes.rs
@@ -845,6 +845,19 @@ impl ImplTraitType {
#[inline]
pub fn impl_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![impl]) }
}
+pub struct IncludeBytesExpr {
+ pub(crate) syntax: SyntaxNode,
+}
+impl IncludeBytesExpr {
+ #[inline]
+ pub fn pound_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![#]) }
+ #[inline]
+ pub fn builtin_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![builtin]) }
+ #[inline]
+ pub fn include_bytes_token(&self) -> Option<SyntaxToken> {
+ support::token(&self.syntax, T![include_bytes])
+ }
+}
pub struct IndexExpr {
pub(crate) syntax: SyntaxNode,
}
@@ -2059,6 +2072,8 @@ impl Variant {
pub fn field_list(&self) -> Option<FieldList> { support::child(&self.syntax) }
#[inline]
pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) }
+ #[inline]
+ pub fn underscore_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![_]) }
}
pub struct VariantList {
pub(crate) syntax: SyntaxNode,
@@ -2212,6 +2227,7 @@ pub enum Expr {
ForExpr(ForExpr),
FormatArgsExpr(FormatArgsExpr),
IfExpr(IfExpr),
+ IncludeBytesExpr(IncludeBytesExpr),
IndexExpr(IndexExpr),
LetExpr(LetExpr),
Literal(Literal),
@@ -4373,6 +4389,38 @@ impl fmt::Debug for ImplTraitType {
f.debug_struct("ImplTraitType").field("syntax", &self.syntax).finish()
}
}
+impl AstNode for IncludeBytesExpr {
+ #[inline]
+ fn kind() -> SyntaxKind
+ where
+ Self: Sized,
+ {
+ INCLUDE_BYTES_EXPR
+ }
+ #[inline]
+ fn can_cast(kind: SyntaxKind) -> bool { kind == INCLUDE_BYTES_EXPR }
+ #[inline]
+ fn cast(syntax: SyntaxNode) -> Option<Self> {
+ if Self::can_cast(syntax.kind()) { Some(Self { syntax }) } else { None }
+ }
+ #[inline]
+ fn syntax(&self) -> &SyntaxNode { &self.syntax }
+}
+impl hash::Hash for IncludeBytesExpr {
+ fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); }
+}
+impl Eq for IncludeBytesExpr {}
+impl PartialEq for IncludeBytesExpr {
+ fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax }
+}
+impl Clone for IncludeBytesExpr {
+ fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } }
+}
+impl fmt::Debug for IncludeBytesExpr {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+ f.debug_struct("IncludeBytesExpr").field("syntax", &self.syntax).finish()
+ }
+}
impl AstNode for IndexExpr {
#[inline]
fn kind() -> SyntaxKind
@@ -8101,6 +8149,10 @@ impl From<IfExpr> for Expr {
#[inline]
fn from(node: IfExpr) -> Expr { Expr::IfExpr(node) }
}
+impl From<IncludeBytesExpr> for Expr {
+ #[inline]
+ fn from(node: IncludeBytesExpr) -> Expr { Expr::IncludeBytesExpr(node) }
+}
impl From<IndexExpr> for Expr {
#[inline]
fn from(node: IndexExpr) -> Expr { Expr::IndexExpr(node) }
@@ -8205,6 +8257,7 @@ impl AstNode for Expr {
| FOR_EXPR
| FORMAT_ARGS_EXPR
| IF_EXPR
+ | INCLUDE_BYTES_EXPR
| INDEX_EXPR
| LET_EXPR
| LITERAL
@@ -8246,6 +8299,7 @@ impl AstNode for Expr {
FOR_EXPR => Expr::ForExpr(ForExpr { syntax }),
FORMAT_ARGS_EXPR => Expr::FormatArgsExpr(FormatArgsExpr { syntax }),
IF_EXPR => Expr::IfExpr(IfExpr { syntax }),
+ INCLUDE_BYTES_EXPR => Expr::IncludeBytesExpr(IncludeBytesExpr { syntax }),
INDEX_EXPR => Expr::IndexExpr(IndexExpr { syntax }),
LET_EXPR => Expr::LetExpr(LetExpr { syntax }),
LITERAL => Expr::Literal(Literal { syntax }),
@@ -8289,6 +8343,7 @@ impl AstNode for Expr {
Expr::ForExpr(it) => &it.syntax,
Expr::FormatArgsExpr(it) => &it.syntax,
Expr::IfExpr(it) => &it.syntax,
+ Expr::IncludeBytesExpr(it) => &it.syntax,
Expr::IndexExpr(it) => &it.syntax,
Expr::LetExpr(it) => &it.syntax,
Expr::Literal(it) => &it.syntax,
@@ -10405,6 +10460,11 @@ impl std::fmt::Display for ImplTraitType {
std::fmt::Display::fmt(self.syntax(), f)
}
}
+impl std::fmt::Display for IncludeBytesExpr {
+ fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+ std::fmt::Display::fmt(self.syntax(), f)
+ }
+}
impl std::fmt::Display for IndexExpr {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
std::fmt::Display::fmt(self.syntax(), f)
diff --git a/crates/syntax/src/ast/prec.rs b/crates/syntax/src/ast/prec.rs
index d99cf49261..8411275350 100644
--- a/crates/syntax/src/ast/prec.rs
+++ b/crates/syntax/src/ast/prec.rs
@@ -134,7 +134,8 @@ pub fn precedence(expr: &ast::Expr) -> ExprPrecedence {
| Expr::RecordExpr(_)
| Expr::TupleExpr(_)
| Expr::UnderscoreExpr(_)
- | Expr::WhileExpr(_) => ExprPrecedence::Unambiguous,
+ | Expr::WhileExpr(_)
+ | Expr::IncludeBytesExpr(_) => ExprPrecedence::Unambiguous,
}
}
@@ -375,7 +376,7 @@ impl Expr {
ArrayExpr(_) | TupleExpr(_) | Literal(_) | PathExpr(_) | ParenExpr(_) | IfExpr(_)
| WhileExpr(_) | ForExpr(_) | LoopExpr(_) | MatchExpr(_) | BlockExpr(_)
- | RecordExpr(_) | UnderscoreExpr(_) => (0, 0),
+ | RecordExpr(_) | UnderscoreExpr(_) | IncludeBytesExpr(_) => (0, 0),
}
}
@@ -519,7 +520,8 @@ impl Expr {
AsmExpr(e) => e.builtin_token(),
ArrayExpr(_) | TupleExpr(_) | Literal(_) | PathExpr(_) | ParenExpr(_)
| IfExpr(_) | WhileExpr(_) | ForExpr(_) | LoopExpr(_) | MatchExpr(_)
- | BlockExpr(_) | RecordExpr(_) | UnderscoreExpr(_) | MacroExpr(_) => None,
+ | BlockExpr(_) | RecordExpr(_) | UnderscoreExpr(_) | MacroExpr(_)
+ | IncludeBytesExpr(_) => None,
};
token.map(|t| t.text_range()).unwrap_or_else(|| this.syntax().text_range()).start()
@@ -546,7 +548,7 @@ impl Expr {
.map(|e| e.child_is_followed_by_a_block())
.unwrap_or(false),
- ForExpr(_) | IfExpr(_) | MatchExpr(_) | WhileExpr(_) => true,
+ ForExpr(_) | IfExpr(_) | MatchExpr(_) | WhileExpr(_) | IncludeBytesExpr(_) => true,
}
}
}
diff --git a/crates/syntax/src/ast/token_ext.rs b/crates/syntax/src/ast/token_ext.rs
index 29b3b0930a..b5c4e1aa9d 100644
--- a/crates/syntax/src/ast/token_ext.rs
+++ b/crates/syntax/src/ast/token_ext.rs
@@ -315,8 +315,8 @@ impl ast::CString {
let mut prev_end = 0;
let mut has_error = None;
let extend_unit = |buf: &mut Vec<u8>, unit: MixedUnit| match unit {
- MixedUnit::Char(c) => buf.extend(c.encode_utf8(&mut [0; 4]).as_bytes()),
- MixedUnit::HighByte(b) => buf.push(b),
+ MixedUnit::Char(c) => buf.extend(c.get().encode_utf8(&mut [0; 4]).as_bytes()),
+ MixedUnit::HighByte(b) => buf.push(b.get()),
};
unescape_c_str(text, |char_range, unescaped| match (unescaped, buf.capacity() == 0) {
(Ok(u), false) => extend_unit(&mut buf, u),
diff --git a/crates/test-utils/src/fixture.rs b/crates/test-utils/src/fixture.rs
index 730e9aeb52..64a0d23e6e 100644
--- a/crates/test-utils/src/fixture.rs
+++ b/crates/test-utils/src/fixture.rs
@@ -399,6 +399,7 @@ impl MiniCore {
///
/// This is probably over-engineered to support flags dependencies.
pub fn source_code(mut self, raw_source: &str) -> String {
+ let raw_source = raw_source.replace("\r\n", "\n").replace('\r', "\n");
let mut buf = String::new();
let mut lines = raw_source.split_inclusive('\n');
@@ -580,3 +581,12 @@ mod m;
assert_eq!("/lib.rs", meta.path);
assert_eq!(2, meta.env.len());
}
+
+#[test]
+fn minicore_source_code_normalizes_line_endings() {
+ let source = MiniCore::RAW_SOURCE.replace("\r\n", "\n").replace('\r', "\n");
+ let source = source.replace('\n', "\r\n");
+ let source = MiniCore::from_flags(["option"]).source_code(&source);
+
+ assert!(!source.contains('\r'));
+}
diff --git a/crates/test-utils/src/minicore.rs b/crates/test-utils/src/minicore.rs
index bd15dca609..0588b1c77d 100644
--- a/crates/test-utils/src/minicore.rs
+++ b/crates/test-utils/src/minicore.rs
@@ -655,6 +655,10 @@ pub mod ops {
#[lang = "drop"]
pub trait Drop {
fn drop(&mut self);
+
+ // region:pin
+ fn pin_drop(self: crate::pin::Pin<&mut Self>) {}
+ // endregion:pin
}
// endregion:drop
@@ -2349,6 +2353,18 @@ pub mod pat {
}
}
+ impl const RangePattern for i32 {
+ const MIN: i32 = 0x80_00_00_00;
+ const MAX: i32 = 0x7F_FF_FF_FF;
+ fn sub_one(self) -> Self {
+ if self == Self::MIN {
+ panic!("exclusive range end at minimum value of type")
+ } else {
+ self - 1
+ }
+ }
+ }
+
// region:coerce_unsized
impl<T: crate::marker::PointeeSized, U: crate::marker::PointeeSized>
crate::ops::CoerceUnsized<pattern_type!(*const U is !null)> for pattern_type!(*const T is !null)
diff --git a/docs/book/src/contributing/lsp-extensions.md b/docs/book/src/contributing/lsp-extensions.md
index b74c40c422..a3189402a9 100644
--- a/docs/book/src/contributing/lsp-extensions.md
+++ b/docs/book/src/contributing/lsp-extensions.md
@@ -1,5 +1,5 @@
<!---
-lsp/ext.rs hash: 57ae57d2a5c65b14
+lsp/ext.rs hash: cec81c987f189e83
If you need to change the above hash to make the test pass, please check if you
need to adjust this doc as well and ping this issue:
diff --git a/editors/code/package.json b/editors/code/package.json
index 8df606d4c4..53c5a295ce 100644
--- a/editors/code/package.json
+++ b/editors/code/package.json
@@ -347,6 +347,11 @@
"command": "rust-analyzer.getFailedObligations",
"title": "Get Failed Obligations",
"category": "rust-analyzer (debug command)"
+ },
+ {
+ "command": "rust-analyzer.evaluatePredicate",
+ "title": "Evaluate Predicate",
+ "category": "rust-analyzer"
}
],
"keybindings": [
@@ -3864,6 +3869,10 @@
{
"command": "rust-analyzer.getFailedObligations",
"when": "inRustProject"
+ },
+ {
+ "command": "rust-analyzer.evaluatePredicate",
+ "when": "inRustProject"
}
],
"editor/context": [
diff --git a/editors/code/src/commands.ts b/editors/code/src/commands.ts
index 302f51dee4..9c8b7071b3 100644
--- a/editors/code/src/commands.ts
+++ b/editors/code/src/commands.ts
@@ -494,6 +494,102 @@ export function ssr(ctx: CtxInit): Cmd {
};
}
+const EVALUATE_PREDICATE_LAST_INPUT_KEY = "evaluatePredicate.lastInput";
+
+export function evaluatePredicate(ctx: CtxInit): Cmd {
+ return async () => {
+ const editor = ctx.activeRustEditor;
+ if (!editor) {
+ await vscode.window.showWarningMessage(
+ "rust-analyzer: evaluate predicate requires an active Rust editor",
+ );
+ return;
+ }
+
+ const client = ctx.client;
+ const textDocument = client.code2ProtocolConverter.asTextDocumentIdentifier(
+ editor.document,
+ );
+ const position = client.code2ProtocolConverter.asPosition(editor.selection.active);
+
+ const input = vscode.window.createInputBox();
+ input.value = ctx.extCtx.workspaceState.get<string>(
+ EVALUATE_PREDICATE_LAST_INPUT_KEY,
+ "Vec<u32>: Clone",
+ );
+ input.prompt = "Enter a Rust where-clause predicate";
+ input.placeholder = "Vec<u32>: Clone";
+
+ let requestId = 0;
+ let hidden = false;
+ const updatePredicateResult = async (text: string) => {
+ const currentRequestId = ++requestId;
+ await ctx.extCtx.workspaceState.update(EVALUATE_PREDICATE_LAST_INPUT_KEY, text);
+ if (text.trim() === "") {
+ input.validationMessage = undefined;
+ return;
+ }
+
+ try {
+ const result = await client.sendRequest(ra.evaluatePredicate, {
+ text,
+ textDocument,
+ position,
+ });
+ if (!hidden && currentRequestId === requestId) {
+ input.validationMessage = predicateEvaluationValidationMessage(result);
+ }
+ } catch (error) {
+ if (!hidden && currentRequestId === requestId) {
+ input.validationMessage = {
+ message: String(error),
+ severity: vscode.InputBoxValidationSeverity.Error,
+ };
+ }
+ }
+ };
+
+ await new Promise<void>((resolve) => {
+ input.onDidChangeValue((text) => void updatePredicateResult(text));
+ input.onDidAccept(() => input.hide());
+ input.onDidHide(() => {
+ hidden = true;
+ input.dispose();
+ resolve();
+ });
+ input.show();
+ void updatePredicateResult(input.value);
+ });
+ };
+}
+
+function predicateEvaluationValidationMessage(
+ result: ra.EvaluatePredicateResult,
+): vscode.InputBoxValidationMessage {
+ switch (result.status) {
+ case "holds":
+ return {
+ message: result.message,
+ severity: vscode.InputBoxValidationSeverity.Info,
+ };
+ case "notProven":
+ return {
+ message: result.message,
+ severity: vscode.InputBoxValidationSeverity.Warning,
+ };
+ case "invalid":
+ return {
+ message: result.message,
+ severity: vscode.InputBoxValidationSeverity.Error,
+ };
+ case "unsupported":
+ return {
+ message: result.message,
+ severity: vscode.InputBoxValidationSeverity.Warning,
+ };
+ }
+}
+
export function serverVersion(ctx: CtxInit): Cmd {
return async () => {
if (!ctx.serverPath) {
diff --git a/editors/code/src/lsp_ext.ts b/editors/code/src/lsp_ext.ts
index cf190ea3ce..80cb04de99 100644
--- a/editors/code/src/lsp_ext.ts
+++ b/editors/code/src/lsp_ext.ts
@@ -67,6 +67,21 @@ export const interpretFunction = new lc.RequestType<lc.TextDocumentPositionParam
export const viewItemTree = new lc.RequestType<ViewItemTreeParams, string, void>(
"rust-analyzer/viewItemTree",
);
+export type EvaluatePredicateParams = {
+ text: string;
+ textDocument: lc.TextDocumentIdentifier;
+ position: lc.Position;
+};
+export type PredicateEvaluationStatus = "holds" | "notProven" | "invalid" | "unsupported";
+export type EvaluatePredicateResult = {
+ status: PredicateEvaluationStatus;
+ message: string;
+};
+export const evaluatePredicate = new lc.RequestType<
+ EvaluatePredicateParams,
+ EvaluatePredicateResult,
+ void
+>("rust-analyzer/evaluatePredicate");
export const getFailedObligations = new lc.RequestType<lc.TextDocumentPositionParams, string, void>(
"rust-analyzer/getFailedObligations",
);
diff --git a/editors/code/src/main.ts b/editors/code/src/main.ts
index 7d91286552..6567bcd2f1 100644
--- a/editors/code/src/main.ts
+++ b/editors/code/src/main.ts
@@ -187,6 +187,7 @@ function createCommands(): Record<string, CommandFactory> {
clearFlycheck: { enabled: commands.clearFlycheck },
runFlycheck: { enabled: commands.runFlycheck },
ssr: { enabled: commands.ssr },
+ evaluatePredicate: { enabled: commands.evaluatePredicate },
serverVersion: { enabled: commands.serverVersion },
viewMemoryLayout: { enabled: commands.viewMemoryLayout },
toggleCheckOnSave: { enabled: commands.toggleCheckOnSave },
diff --git a/rust-version b/rust-version
index 4b1ba970b7..387bd8edd2 100644
--- a/rust-version
+++ b/rust-version
@@ -1 +1 @@
-ba0949ab745985a442e274ba52e8fb348cb0c662
+029c9e18dd1f4668e1d42bb187c1c263dfe20093
diff --git a/xtask/src/codegen/grammar/ast_src.rs b/xtask/src/codegen/grammar/ast_src.rs
index 49a625bdbd..1ae139fe7e 100644
--- a/xtask/src/codegen/grammar/ast_src.rs
+++ b/xtask/src/codegen/grammar/ast_src.rs
@@ -154,6 +154,7 @@ const CONTEXTUAL_BUILTIN_KEYWORDS: &[&str] = &[
"deref",
"pattern_type",
"is",
+ "include_bytes",
];
// keywords that are keywords depending on the edition
diff --git a/xtask/src/tidy.rs b/xtask/src/tidy.rs
index 122cf4887e..33145a8834 100644
--- a/xtask/src/tidy.rs
+++ b/xtask/src/tidy.rs
@@ -21,13 +21,13 @@ impl Tidy {
}
fn check_lsp_extensions_docs(sh: &Shell) {
- let expected_hash = {
+ let actual_hash = {
let lsp_ext_rs =
sh.read_file(project_root().join("crates/rust-analyzer/src/lsp/ext.rs")).unwrap();
stable_hash(lsp_ext_rs.as_str())
};
- let actual_hash = {
+ let expected_hash = {
let lsp_extensions_md = sh
.read_file(project_root().join("docs/book/src/contributing/lsp-extensions.md"))
.unwrap();
@@ -135,7 +135,6 @@ fn check_licenses(sh: &Shell) {
"(MIT OR Apache-2.0) AND Unicode-3.0",
"0BSD OR MIT OR Apache-2.0",
"Apache-2.0 / MIT",
- "Apache-2.0 OR BSL-1.0",
"Apache-2.0 OR MIT",
"Apache-2.0 WITH LLVM-exception OR Apache-2.0 OR MIT",
"Apache-2.0 WITH LLVM-exception",
@@ -155,6 +154,7 @@ fn check_licenses(sh: &Shell) {
"Unlicense OR MIT",
"Unlicense/MIT",
"Zlib",
+ "Zlib OR Apache-2.0 OR MIT",
];
let meta = cmd!(sh, "cargo metadata --format-version 1").read().unwrap();