Skip to content

Subtree update of rust-analyzer #132314

New issue

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

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

Already on GitHub? Sign in to your account

Merged
merged 118 commits into from
Oct 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
118 commits
Select commit Hold shift + click to select a range
bac672c
Remove now-incorrect code
ChayimFriedman2 Sep 29, 2024
b4f0403
Handle destructuring assignments uniformly
ChayimFriedman2 Oct 6, 2024
fc5912b
Store patterns desugared from destructuring assignments in source map
ChayimFriedman2 Oct 6, 2024
e46ea16
GotoDefinition on a Range or InclusiveRange operator will link to the…
duncpro Oct 21, 2024
8e69377
Move explicit range handling out of goto_definition, use OperatorClas…
duncpro Oct 22, 2024
88b9b9d
goto definition on RangeFrom, RangeFull, RangeTo, and RangeToInclusiv…
duncpro Oct 22, 2024
b763913
tidy
duncpro Oct 22, 2024
5087af2
Auto merge of #18362 - duncpro:goto-def-ranges, r=Veykril
bors Oct 22, 2024
3e02349
Fix status bar messagen not being marked markdown
Veykril Oct 22, 2024
5e3561e
Cleanup file structure proto handling
Veykril Oct 22, 2024
ec4b9e0
tests: Add `lsif_contains_generated_constant` test
Urhengulas Oct 16, 2024
76368b8
Fix new nightly lints
Veykril Oct 22, 2024
d4742e7
Auto merge of #18366 - Veykril:veykril/push-uvwvwzxnkmnz, r=Veykril
bors Oct 22, 2024
21636ac
resolve range patterns to the their struct types
duncpro Oct 22, 2024
b181cac
remove duplicate test
duncpro Oct 22, 2024
734710f
tidy
duncpro Oct 22, 2024
273d9d7
tidy
duncpro Oct 22, 2024
b70feec
feat: render docs from aliased type when docs are missing
dqkqd Oct 22, 2024
6f71369
fix: Fix incorrect parsing of use bounds
Veykril Oct 22, 2024
919ba41
Auto merge of #18371 - Veykril:veykril/push-kwttrusywysp, r=Veykril
bors Oct 22, 2024
0b906b6
Auto merge of #18349 - dqkqd:issue-18344, r=Veykril
bors Oct 22, 2024
7c315cf
Switch CI from bors to merge queues
Kobzol Oct 22, 2024
7cad4da
Auto merge of #18368 - Veykril:test-lsif_contains_generated_macros, r…
bors Oct 22, 2024
408f924
Auto merge of #18370 - duncpro:goto-def-ranges, r=Veykril
bors Oct 22, 2024
5482247
Merge pull request #18372 from Kobzol/ci-merge-queue
marcoieni Oct 22, 2024
7aad1a2
Merge closure capture inlay hints into one
Veykril Oct 22, 2024
7c29f8c
Merge adjustment inlay hints into one
Veykril Oct 22, 2024
770df7f
Merge binding_mode inlay hints into one
Veykril Oct 22, 2024
ec7ad89
Merge pull request #18373 from Veykril/veykril/push-mzumrrvynxqu
Veykril Oct 22, 2024
983383f
Add test for tuple struct destructuring assignment where the path com…
ChayimFriedman2 Oct 22, 2024
fa59a76
Merge pull request #18254 from ChayimFriedman2/fix-mut
Veykril Oct 22, 2024
7ee25a0
Implement semitransparent hygiene
ChayimFriedman2 Oct 7, 2024
8f36d1c
Correctly resolve variables and labels from before macro definition i…
ChayimFriedman2 Oct 22, 2024
cb816ad
Add text edit to adjustment hints
Veykril Oct 23, 2024
c92f76d
Add text edit to binding mode hints
Veykril Oct 23, 2024
49322a1
Add text edit to discriminant hints
Veykril Oct 23, 2024
41fc1fb
Add text edit to implicit 'static hints
Veykril Oct 23, 2024
4fdc63c
Don't emit edits for postfix adjustment hints
Veykril Oct 23, 2024
bde2000
Merge pull request #18376 from Veykril/veykril/push-ptmnsoqzsmqk
Veykril Oct 23, 2024
ac3db41
fix dyn incompatible hint message
usamoi Oct 23, 2024
c8a04e3
Merge pull request #18379 from usamoi/master
Veykril Oct 23, 2024
1fbaccd
Merge pull request #18264 from ChayimFriedman2/semi-transparent
Veykril Oct 23, 2024
33f27d1
fix: Handle missing time offsets gracefully
Wilfred Oct 23, 2024
7dad963
Merge pull request #18386 from Wilfred/missing_offset
lnicola Oct 23, 2024
d7f137e
Fix checking for `false` `labelDetailsSupport` value.
jaboatman Oct 23, 2024
bc6b2ec
Rewrite `label_details_support` condition to be consistent with other…
jaboatman Oct 23, 2024
6f8e75a
Merge pull request #18388 from jaboatman/master
lnicola Oct 23, 2024
eee4037
fix: Prevent public reexport of private item
ShoyuVanilla Oct 23, 2024
4d541f7
internal: log original syntax on panic
davidbarsky Oct 23, 2024
a7ea9c0
Merge pull request #18391 from davidbarsky/david/log-syntax-on-panic
Veykril Oct 23, 2024
c8ce150
Swap query call order in file_item_tree_query
Veykril Oct 23, 2024
8cf856e
Merge pull request #18392 from Veykril/veykril/push-wktpkuklnzot
Veykril Oct 23, 2024
2204724
internal: Pretty-print Config in status command
Wilfred Oct 23, 2024
c93514b
fix: Add missing cfg flags for `core` crate
Wilfred Oct 23, 2024
5b0821f
Merge pull request #18394 from Wilfred/pretty_print_status
Veykril Oct 24, 2024
582f1a6
Merge pull request #18395 from Wilfred/missing_cfg_for_core
Veykril Oct 24, 2024
f3d9784
Hide default config in Debug impl
lnicola Oct 24, 2024
97eb4c7
Bump smol_str
lnicola Oct 24, 2024
7147bc9
Merge pull request #18396 from lnicola/hide-default-config
lnicola Oct 24, 2024
981ea19
Merge pull request #18390 from ShoyuVanilla/issue-18308
Veykril Oct 24, 2024
39881f5
Fix diagnostic enable config being ignored
Veykril Oct 24, 2024
3c75b4a
Merge pull request #18399 from Veykril/veykril/push-nnsoxqrwqkmv
Veykril Oct 24, 2024
38e9da2
minor: Remove intermediate allocations
Veykril Oct 24, 2024
e789a77
internal: Improve proc-macro error msg for failed build scripts
Veykril Oct 24, 2024
7e67a18
Merge pull request #18401 from Veykril/veykril/push-ulpowvsymyys
Veykril Oct 24, 2024
bada8ba
Merge pull request #18402 from Veykril/veykril/push-wrvtystlszlr
Veykril Oct 24, 2024
c5a1bd9
feat: Implement diagnostics pull model
Veykril Oct 24, 2024
0a8ebdf
Merge pull request #18404 from Veykril/veykril/push-swpmkoqqxrvu
Veykril Oct 24, 2024
9832131
Update changelog generation for merge queues
lnicola Oct 24, 2024
aaae1d4
Merge pull request #18405 from lnicola/fix-changelog
lnicola Oct 24, 2024
a05b16b
Build source map for `hir_def::TypeRef`s
ChayimFriedman2 Sep 6, 2024
ab81593
Fix memory usage calculation's queries list
ChayimFriedman2 Oct 13, 2024
fc5bce9
Reuse empty `GenericParams`
ChayimFriedman2 Oct 18, 2024
a16a3d3
Shrink `ItemTreeSourceMaps`
ChayimFriedman2 Oct 19, 2024
61d14ba
Do not allocate attributes entry if there are no attributes
ChayimFriedman2 Oct 19, 2024
183796e
editors/code: Add md for walkthrough setup example
hackervole Oct 25, 2024
fd7648d
Shrink `Path` to 16 bytes
ChayimFriedman2 Oct 19, 2024
3f63848
Shrink `TypeRef` from 16 from 32 bytes
ChayimFriedman2 Oct 19, 2024
f2d12ff
Merge pull request #18407 from hackervole/code-fix-welcome-setup-tips
Veykril Oct 25, 2024
1613548
Don't compute diagnostics for non local files
Veykril Oct 25, 2024
bf77cf7
Add server cancellation support to pull diagnostic handler
Veykril Oct 25, 2024
e37c6dc
Merge pull request #18408 from Veykril/veykril/push-ulxyznwzokut
Veykril Oct 25, 2024
c6d1f78
Only construct a resolver in macro descension when needed
Veykril Oct 23, 2024
cf5ab63
Merge pull request #18409 from Veykril/veykril/push-rkrkpvzvumvx
Veykril Oct 25, 2024
57683cf
Factor out token ranking
Veykril Oct 25, 2024
08b504a
Stop producing .gz artifacts for Windows
lnicola Oct 25, 2024
fe425cd
Turn Remove dbg into a quick fix for better prioritization
lnicola Oct 26, 2024
ed670e0
Merge pull request #18415 from lnicola/nicer-remove-dbg
lnicola Oct 26, 2024
510090f
Start using `Option::is_none_or`
766974616c79 Oct 7, 2024
f719ee7
Use method syntax
766974616c79 Oct 7, 2024
56b0299
Bump MSRV to 1.82
lnicola Oct 26, 2024
d6b2658
Correctly handle `#""` in edition <2024
ChayimFriedman2 Oct 26, 2024
071bd3c
Split `macro-error` diagnostic so users can ignore only parts of it
ChayimFriedman2 Oct 27, 2024
e970e07
Support `cfg(true)` and `cfg(false)`
ChayimFriedman2 Oct 27, 2024
59dd642
Merge pull request #18417 from ChayimFriedman2/hash-string
Veykril Oct 27, 2024
66a81d3
Merge pull request #18418 from ChayimFriedman2/explicitly-disable
Veykril Oct 27, 2024
6c70806
Invert token iteration order in macro mapping
Veykril Oct 25, 2024
0d441c3
Merge pull request #18410 from Veykril/veykril/push-lvwxpnowqrxk
Veykril Oct 27, 2024
f50b201
Put leading `|` in patterns under `OrPat`
ChayimFriedman2 Oct 27, 2024
14607ba
Merge pull request #18419 from ChayimFriedman2/leading-or
Veykril Oct 27, 2024
0abb563
fix: Allow public re-export of `extern crate` import
ShoyuVanilla Oct 25, 2024
709805a
Properly resolve prelude paths inside modules inside blocks
ChayimFriedman2 Oct 27, 2024
47e5759
add LetStmt arm
LastExceed Oct 16, 2024
b889a11
add test
LastExceed Oct 27, 2024
7ec2042
Merge pull request #18412 from lnicola/windows-no-gz
lnicola Oct 28, 2024
5346e84
Merge pull request #18256 from MoskalykA/use-is_none_or
lnicola Oct 28, 2024
25b0846
Merge pull request #18074 from ChayimFriedman2/typeref-source-map
Veykril Oct 28, 2024
c155155
Move text-edit into ide-db
Veykril Oct 27, 2024
86ae80c
Reformat
Veykril Oct 28, 2024
003270d
Merge pull request #18312 from LastExceed/symbolkind-variable
Veykril Oct 28, 2024
9a7fd6f
Merge pull request #18422 from ChayimFriedman2/cursed-name-res
Veykril Oct 28, 2024
b12859a
Merge pull request #18413 from ShoyuVanilla/extern-crate-reexport
Veykril Oct 28, 2024
8e97f40
Merge pull request #18421 from Veykril/push-uxxwvwnqvomr
Veykril Oct 28, 2024
af764db
Merge pull request #18420 from ChayimFriedman2/cfg-true-false
Veykril Oct 28, 2024
4b27980
Preparing for merge from rust-lang/rust
lnicola Oct 29, 2024
772d138
Merge from rust-lang/rust
lnicola Oct 29, 2024
49baaf0
Bump rustc crates
lnicola Oct 29, 2024
eae9d7a
Merge pull request #18431 from lnicola/sync-from-rust
lnicola Oct 29, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 17 additions & 20 deletions src/tools/rust-analyzer/.github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
# Please make sure that the `needs` fields for both `end-success` and `end-failure`
# Please make sure that the `needs` field for the `conclusion` job
# are updated when adding new jobs!

name: CI
on:
pull_request:
push:
branches:
- auto
- try
- automation/bors/try
merge_group:

env:
CARGO_INCREMENTAL: 0
Expand Down Expand Up @@ -237,20 +233,21 @@ jobs:
- name: check for typos
run: typos

end-success:
name: bors build finished
if: github.event.pusher.name == 'bors' && success()
runs-on: ubuntu-latest
conclusion:
needs: [rust, rust-cross, typescript, typo-check]
steps:
- name: Mark the job as successful
run: exit 0

end-failure:
name: bors build finished
if: github.event.pusher.name == 'bors' && !success()
# We need to ensure this job does *not* get skipped if its dependencies fail,
# because a skipped job is considered a success by GitHub. So we have to
# overwrite `if:`. We use `!cancelled()` to ensure the job does still not get run
# when the workflow is canceled manually.
#
# ALL THE PREVIOUS JOBS NEED TO BE ADDED TO THE `needs` SECTION OF THIS JOB!
if: ${{ !cancelled() }}
runs-on: ubuntu-latest
needs: [rust, rust-cross, typescript, typo-check]
steps:
- name: Mark the job as a failure
run: exit 1
# Manually check the status of all dependencies. `if: failure()` does not work.
- name: Conclusion
run: |
# Print the dependent jobs to see them in the CI log
jq -C <<< '${{ toJson(needs) }}'
# Check if all jobs that we depend on (in the needs array) were successful.
jq --exit-status 'all(.result == "success")' <<< '${{ toJson(needs) }}'
3 changes: 1 addition & 2 deletions src/tools/rust-analyzer/.gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/target/
target/
/dist/
crates/*/target
**/*.rs.bk
**/*.rs.pending-snap
.idea/*
Expand Down
45 changes: 16 additions & 29 deletions src/tools/rust-analyzer/Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ dependencies = [
"rustc-hash 2.0.0",
"syntax",
"syntax-bridge",
"tracing",
"tt",
]

Expand Down Expand Up @@ -556,6 +557,7 @@ dependencies = [
"syntax-bridge",
"test-fixture",
"test-utils",
"text-size",
"tracing",
"triomphe",
"tt",
Expand Down Expand Up @@ -670,7 +672,6 @@ dependencies = [
"syntax",
"test-fixture",
"test-utils",
"text-edit",
"toolchain",
"tracing",
"triomphe",
Expand All @@ -692,7 +693,6 @@ dependencies = [
"syntax",
"test-fixture",
"test-utils",
"text-edit",
"tracing",
]

Expand All @@ -711,7 +711,6 @@ dependencies = [
"syntax",
"test-fixture",
"test-utils",
"text-edit",
"tracing",
]

Expand Down Expand Up @@ -743,7 +742,6 @@ dependencies = [
"syntax",
"test-fixture",
"test-utils",
"text-edit",
"tracing",
"triomphe",
]
Expand All @@ -765,7 +763,6 @@ dependencies = [
"syntax",
"test-fixture",
"test-utils",
"text-edit",
"tracing",
]

Expand All @@ -784,7 +781,6 @@ dependencies = [
"syntax",
"test-fixture",
"test-utils",
"text-edit",
"triomphe",
]

Expand Down Expand Up @@ -1497,9 +1493,9 @@ dependencies = [

[[package]]
name = "ra-ap-rustc_abi"
version = "0.73.0"
version = "0.75.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "879ece0781e3c1cb670b9f29775c81a43a16db789d1296fad6bc5c74065b2fac"
checksum = "d5bc2cfc7264d84215a08875ef90a1d35f76b5c9ad1993515d2da7e4e40b2b4b"
dependencies = [
"bitflags 2.6.0",
"ra-ap-rustc_index",
Expand All @@ -1508,9 +1504,9 @@ dependencies = [

[[package]]
name = "ra-ap-rustc_index"
version = "0.73.0"
version = "0.75.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6910087ff89bb9f3db114bfcd86b5139042731fe7278d3ff4ceaa69a140154a7"
checksum = "e8929140697812e5dd09e19cf446d85146332363f0dbc125d4214834c34ead96"
dependencies = [
"arrayvec",
"ra-ap-rustc_index_macros",
Expand All @@ -1519,9 +1515,9 @@ dependencies = [

[[package]]
name = "ra-ap-rustc_index_macros"
version = "0.73.0"
version = "0.75.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3b6f7bd12b678fbb37444ba77f3b0cfc13b7394a6dc7b0c799491fc9df0a9997"
checksum = "514a3f5d04c8b4a2750f29746cc9abb1f78deb7e72e4ad1dc95bbc608f3db157"
dependencies = [
"proc-macro2",
"quote",
Expand All @@ -1530,29 +1526,29 @@ dependencies = [

[[package]]
name = "ra-ap-rustc_lexer"
version = "0.73.0"
version = "0.75.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "119bc05b5b6bc3e7f5b67ce8b8080e185da94bd83c447f91b6b3f3ecf60cbab1"
checksum = "276fcb1205da071a0cd64416f3f0e198043c11f176c5b501a45dbf0cb33979f2"
dependencies = [
"unicode-properties",
"unicode-xid",
]

[[package]]
name = "ra-ap-rustc_parse_format"
version = "0.73.0"
version = "0.75.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "70ed6150ae71d905c064dc88d7824ebb0fa81083f45d7477cba7b57176f2f635"
checksum = "961b30b22cfac296b14b72e9f95e79c16cebc8c926872755fb1568a6c4243a62"
dependencies = [
"ra-ap-rustc_index",
"ra-ap-rustc_lexer",
]

[[package]]
name = "ra-ap-rustc_pattern_analysis"
version = "0.73.0"
version = "0.75.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6e830862a0ec85fce211d34735315686bb8d6a12d418d6d735fb534aa1cd3293"
checksum = "614232513814a4b714fea7f11345d31c0c277bca3089bb6ca1ec20870bfc022a"
dependencies = [
"ra-ap-rustc_index",
"rustc-hash 2.0.0",
Expand Down Expand Up @@ -1884,9 +1880,9 @@ checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67"

[[package]]
name = "smol_str"
version = "0.3.1"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "66eaf762c5af19db3108300515c8aa7a50efc90ff745f4c62288052ebf9fdd25"
checksum = "9676b89cd56310a87b93dec47b11af744f34d5fc9f367b829474eec0a891350d"
dependencies = [
"borsh",
"serde",
Expand Down Expand Up @@ -1978,7 +1974,6 @@ dependencies = [
"smol_str",
"stdx",
"test-utils",
"text-edit",
"tracing",
"triomphe",
]
Expand Down Expand Up @@ -2026,14 +2021,6 @@ dependencies = [
"tracing",
]

[[package]]
name = "text-edit"
version = "0.0.0"
dependencies = [
"itertools",
"text-size",
]

[[package]]
name = "text-size"
version = "1.1.1"
Expand Down
15 changes: 7 additions & 8 deletions src/tools/rust-analyzer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ exclude = ["crates/proc-macro-srv/proc-macro-test/imp"]
resolver = "2"

[workspace.package]
rust-version = "1.81"
rust-version = "1.82"
edition = "2021"
license = "MIT OR Apache-2.0"
authors = ["rust-analyzer team"]
Expand Down Expand Up @@ -79,17 +79,16 @@ span = { path = "./crates/span", version = "0.0.0" }
stdx = { path = "./crates/stdx", version = "0.0.0" }
syntax = { path = "./crates/syntax", version = "0.0.0" }
syntax-bridge = { path = "./crates/syntax-bridge", version = "0.0.0" }
text-edit = { path = "./crates/text-edit", version = "0.0.0" }
toolchain = { path = "./crates/toolchain", version = "0.0.0" }
tt = { path = "./crates/tt", version = "0.0.0" }
vfs-notify = { path = "./crates/vfs-notify", version = "0.0.0" }
vfs = { path = "./crates/vfs", version = "0.0.0" }

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

# local crates that aren't published to crates.io. These should not have versions.
test-fixture = { path = "./crates/test-fixture" }
Expand Down Expand Up @@ -145,7 +144,7 @@ smallvec = { version = "1.10.0", features = [
"union",
"const_generics",
] }
smol_str = "0.3.1"
smol_str = "0.3.2"
snap = "1.1.0"
text-size = "1.1.1"
tracing = "0.1.40"
Expand Down
1 change: 1 addition & 0 deletions src/tools/rust-analyzer/crates/cfg/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ doctest = false

[dependencies]
rustc-hash.workspace = true
tracing.workspace = true

# locals deps
tt = { workspace = true, optional = true }
Expand Down
32 changes: 26 additions & 6 deletions src/tools/rust-analyzer/crates/cfg/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use std::fmt;

use rustc_hash::FxHashSet;

use intern::Symbol;
use intern::{sym, Symbol};

pub use cfg_expr::{CfgAtom, CfgExpr};
pub use dnf::DnfExpr;
Expand All @@ -24,11 +24,17 @@ pub use dnf::DnfExpr;
/// of key and value in `key_values`.
///
/// See: <https://doc.rust-lang.org/reference/conditional-compilation.html#set-configuration-options>
#[derive(Clone, PartialEq, Eq, Default)]
#[derive(Clone, PartialEq, Eq)]
pub struct CfgOptions {
enabled: FxHashSet<CfgAtom>,
}

impl Default for CfgOptions {
fn default() -> Self {
Self { enabled: FxHashSet::from_iter([CfgAtom::Flag(sym::true_.clone())]) }
}
}

impl fmt::Debug for CfgOptions {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let mut items = self
Expand All @@ -54,23 +60,37 @@ impl CfgOptions {
}

pub fn insert_atom(&mut self, key: Symbol) {
self.enabled.insert(CfgAtom::Flag(key));
self.insert_any_atom(CfgAtom::Flag(key));
}

pub fn insert_key_value(&mut self, key: Symbol, value: Symbol) {
self.enabled.insert(CfgAtom::KeyValue { key, value });
self.insert_any_atom(CfgAtom::KeyValue { key, value });
}

pub fn apply_diff(&mut self, diff: CfgDiff) {
for atom in diff.enable {
self.enabled.insert(atom);
self.insert_any_atom(atom);
}

for atom in diff.disable {
let (CfgAtom::Flag(sym) | CfgAtom::KeyValue { key: sym, .. }) = &atom;
if *sym == sym::true_ || *sym == sym::false_ {
tracing::error!("cannot remove `true` or `false` from cfg");
continue;
}
self.enabled.remove(&atom);
}
}

fn insert_any_atom(&mut self, atom: CfgAtom) {
let (CfgAtom::Flag(sym) | CfgAtom::KeyValue { key: sym, .. }) = &atom;
if *sym == sym::true_ || *sym == sym::false_ {
tracing::error!("cannot insert `true` or `false` to cfg");
return;
}
self.enabled.insert(atom);
}

pub fn get_cfg_keys(&self) -> impl Iterator<Item = &Symbol> {
self.enabled.iter().map(|it| match it {
CfgAtom::Flag(key) => key,
Expand All @@ -88,7 +108,7 @@ impl CfgOptions {

impl Extend<CfgAtom> for CfgOptions {
fn extend<T: IntoIterator<Item = CfgAtom>>(&mut self, iter: T) {
iter.into_iter().for_each(|cfg_flag| _ = self.enabled.insert(cfg_flag));
iter.into_iter().for_each(|cfg_flag| self.insert_any_atom(cfg_flag));
}
}

Expand Down
1 change: 1 addition & 0 deletions src/tools/rust-analyzer/crates/hir-def/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ smallvec.workspace = true
hashbrown.workspace = true
triomphe.workspace = true
rustc_apfloat = "0.2.0"
text-size.workspace = true

ra-ap-rustc_parse_format.workspace = true
ra-ap-rustc_abi.workspace = true
Expand Down
Loading
Loading