Skip to content

Commit 30a3706

Browse files
committedAug 2, 2022
⬆️ rust-analyzer
2 parents 9d5cd21 + 2b472f6 commit 30a3706

File tree

45 files changed

+765
-241
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+765
-241
lines changed
 

‎src/tools/rust-analyzer/.github/workflows/publish.yml

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,21 @@ jobs:
3434
git config --global user.email "runner@gha.local"
3535
git config --global user.name "Github Action"
3636
rm Cargo.lock
37+
# Fix names for crates that were published before switch to kebab-case.
38+
cargo workspaces rename --from base-db base_db
39+
cargo workspaces rename --from hir-def hir_def
40+
cargo workspaces rename --from hir-expand hir_expand
41+
cargo workspaces rename --from hir-ty hir_ty
42+
cargo workspaces rename --from ide-assists ide_assists
43+
cargo workspaces rename --from ide-completion ide_completion
44+
cargo workspaces rename --from ide-db ide_db
45+
cargo workspaces rename --from ide-diagnostics ide_diagnostics
46+
cargo workspaces rename --from ide-ssr ide_ssr
47+
cargo workspaces rename --from proc-macro-api proc_macro_api
48+
cargo workspaces rename --from proc-macro-srv proc_macro_srv
49+
cargo workspaces rename --from project-model project_model
50+
cargo workspaces rename --from test-utils test_utils
51+
cargo workspaces rename --from text-edit text_edit
3752
cargo workspaces rename ra_ap_%n
3853
find crates/rust-analyzer -type f -name '*.rs' -exec sed -i 's/rust_analyzer/ra_ap_rust_analyzer/g' {} +
39-
# Fix names for crates that were published before switch to kebab-case.
40-
find crates -name 'Cargo.toml' -exec sed -i "s/ra_ap_base-db/ra_ap_base_db/g; s/ra_ap_hir-def/ra_ap_hir_def/g; s/ra_ap_hir-expand/ra_ap_hir_expand/g; s/ra_ap_hir-ty/ra_ap_hir_ty/g; s/ra_ap_ide-assists/ra_ap_ide_assists/g; s/ra_ap_ide-completion/ra_ap_ide_completion/g; s/ra_ap_ide-db/ra_ap_ide_db/g; s/ra_ap_ide-diagnostics/ra_ap_ide_diagnostics/g; s/ra_ap_ide-ssr/ra_ap_ide_ssr/g; s/ra_ap_proc-macro-api/ra_ap_proc_macro_api/g; s/ra_ap_proc-macro-srv/ra_ap_proc_macro_srv/g; s/ra_ap_project-model/ra_ap_project_model/g; s/ra_ap_test-utils/ra_ap_test_utils/g; s/ra_ap_text-edit/ra_ap_text_edit/g" {} +
4154
cargo workspaces publish --yes --force '*' --exact --no-git-commit --allow-dirty --skip-published custom 0.0.$PATCH

‎src/tools/rust-analyzer/crates/hir-def/src/attr.rs

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -124,13 +124,24 @@ impl RawAttrs {
124124

125125
pub(crate) fn merge(&self, other: Self) -> Self {
126126
// FIXME: This needs to fixup `AttrId`s
127-
match (&self.entries, &other.entries) {
127+
match (&self.entries, other.entries) {
128128
(None, None) => Self::EMPTY,
129-
(Some(entries), None) | (None, Some(entries)) => {
130-
Self { entries: Some(entries.clone()) }
131-
}
129+
(None, entries @ Some(_)) => Self { entries },
130+
(Some(entries), None) => Self { entries: Some(entries.clone()) },
132131
(Some(a), Some(b)) => {
133-
Self { entries: Some(a.iter().chain(b.iter()).cloned().collect()) }
132+
let last_ast_index = a.last().map_or(0, |it| it.id.ast_index + 1);
133+
Self {
134+
entries: Some(
135+
a.iter()
136+
.cloned()
137+
.chain(b.iter().map(|it| {
138+
let mut it = it.clone();
139+
it.id.ast_index += last_ast_index;
140+
it
141+
}))
142+
.collect(),
143+
),
144+
}
134145
}
135146
}
136147
}

0 commit comments

Comments
 (0)